drivers/usb/host/xhci-rcar.c
Source file repositories/reference/linux-study-clean/drivers/usb/host/xhci-rcar.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/host/xhci-rcar.c- Extension
.c- Size
- 8565 bytes
- Lines
- 301
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/firmware.hlinux/iopoll.hlinux/module.hlinux/platform_device.hlinux/of.hlinux/usb/phy.hlinux/reset.hxhci.hxhci-plat.hxhci-rcar-regs.hxhci-rzg3e-regs.hxhci-rzv2m.h
Detected Declarations
function xhci_rcar_start_gen2function xhci_rcar_is_gen2function xhci_rcar_startfunction xhci_rzg3e_startfunction xhci_rzg3e_resumefunction xhci_rzg3e_post_resumefunction xhci_rzg3e_suspendfunction xhci_rcar_download_firmwarefunction xhci_rcar_wait_for_pll_activefunction xhci_rcar_init_quirkfunction xhci_rcar_resume_quirkfunction xhci_renesas_probe
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* xHCI host controller driver for R-Car SoCs
*
* Copyright (C) 2014 Renesas Electronics Corporation
*/
#include <linux/firmware.h>
#include <linux/iopoll.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/usb/phy.h>
#include <linux/reset.h>
#include "xhci.h"
#include "xhci-plat.h"
#include "xhci-rcar-regs.h"
#include "xhci-rzg3e-regs.h"
#include "xhci-rzv2m.h"
#define XHCI_RCAR_FIRMWARE_NAME_V1 "r8a779x_usb3_v1.dlmem"
#define XHCI_RCAR_FIRMWARE_NAME_V3 "r8a779x_usb3_v3.dlmem"
/*
* - The V3 firmware is for all R-Car Gen3
* - The V2 firmware is possible to use on R-Car Gen2. However, the V2 causes
* performance degradation. So, this driver continues to use the V1 if R-Car
* Gen2.
* - The V1 firmware is impossible to use on R-Car Gen3.
*/
MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V1);
MODULE_FIRMWARE(XHCI_RCAR_FIRMWARE_NAME_V3);
static void xhci_rcar_start_gen2(struct usb_hcd *hcd)
{
/* LCLK Select */
writel(RCAR_USB3_LCLK_ENA_VAL, hcd->regs + RCAR_USB3_LCLK);
/* USB3.0 Configuration */
writel(RCAR_USB3_CONF1_VAL, hcd->regs + RCAR_USB3_CONF1);
writel(RCAR_USB3_CONF2_VAL, hcd->regs + RCAR_USB3_CONF2);
writel(RCAR_USB3_CONF3_VAL, hcd->regs + RCAR_USB3_CONF3);
/* USB3.0 Polarity */
writel(RCAR_USB3_RX_POL_VAL, hcd->regs + RCAR_USB3_RX_POL);
writel(RCAR_USB3_TX_POL_VAL, hcd->regs + RCAR_USB3_TX_POL);
}
static int xhci_rcar_is_gen2(struct device *dev)
{
struct device_node *node = dev->of_node;
return of_device_is_compatible(node, "renesas,xhci-r8a7790") ||
of_device_is_compatible(node, "renesas,xhci-r8a7791") ||
of_device_is_compatible(node, "renesas,xhci-r8a7793") ||
of_device_is_compatible(node, "renesas,rcar-gen2-xhci");
}
static void xhci_rcar_start(struct usb_hcd *hcd)
{
u32 temp;
if (hcd->regs != NULL) {
/* Interrupt Enable */
temp = readl(hcd->regs + RCAR_USB3_INT_ENA);
temp |= RCAR_USB3_INT_ENA_VAL;
writel(temp, hcd->regs + RCAR_USB3_INT_ENA);
if (xhci_rcar_is_gen2(hcd->self.controller))
xhci_rcar_start_gen2(hcd);
}
}
static void xhci_rzg3e_start(struct usb_hcd *hcd)
{
u32 int_en;
if (hcd->regs) {
/* Update the controller initial setting */
writel(0x03130200, hcd->regs + RZG3E_USB3_HOST_U3P0PIPESC(0));
writel(0x00160200, hcd->regs + RZG3E_USB3_HOST_U3P0PIPESC(1));
writel(0x03150000, hcd->regs + RZG3E_USB3_HOST_U3P0PIPESC(2));
writel(0x03130200, hcd->regs + RZG3E_USB3_HOST_U3P0PIPESC(3));
writel(0x00180000, hcd->regs + RZG3E_USB3_HOST_U3P0PIPESC(4));
/* Interrupt Enable */
int_en = readl(hcd->regs + RZG3E_USB3_HOST_INTEN);
int_en |= RZG3E_USB3_HOST_INTEN_ENA;
writel(int_en, hcd->regs + RZG3E_USB3_HOST_INTEN);
}
}
Annotation
- Immediate include surface: `linux/firmware.h`, `linux/iopoll.h`, `linux/module.h`, `linux/platform_device.h`, `linux/of.h`, `linux/usb/phy.h`, `linux/reset.h`, `xhci.h`.
- Detected declarations: `function xhci_rcar_start_gen2`, `function xhci_rcar_is_gen2`, `function xhci_rcar_start`, `function xhci_rzg3e_start`, `function xhci_rzg3e_resume`, `function xhci_rzg3e_post_resume`, `function xhci_rzg3e_suspend`, `function xhci_rcar_download_firmware`, `function xhci_rcar_wait_for_pll_active`, `function xhci_rcar_init_quirk`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.