drivers/usb/cdns3/cdns3-ti.c
Source file repositories/reference/linux-study-clean/drivers/usb/cdns3/cdns3-ti.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/cdns3/cdns3-ti.c- Extension
.c- Size
- 6908 bytes
- Lines
- 280
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bits.hlinux/clk.hlinux/module.hlinux/kernel.hlinux/interrupt.hlinux/platform_device.hlinux/dma-mapping.hlinux/io.hlinux/of_platform.hlinux/pm_runtime.hlinux/property.hcore.h
Detected Declarations
struct cdns_tienum modestrap_modefunction cdns_ti_readlfunction cdns_ti_writelfunction cdns_ti_reset_and_init_hwfunction cdns_ti_probefunction cdns_ti_remove_corefunction cdns_ti_removefunction cdns_ti_runtime_resume
Annotated Snippet
struct cdns_ti {
struct device *dev;
void __iomem *usbss;
unsigned usb2_only:1;
unsigned vbus_divider:1;
struct clk *usb2_refclk;
struct clk *lpm_clk;
int usb2_refclk_rate_code;
};
static const int cdns_ti_rate_table[] = { /* in KHZ */
9600,
10000,
12000,
19200,
20000,
24000,
25000,
26000,
38400,
40000,
58000,
50000,
52000,
};
static inline u32 cdns_ti_readl(struct cdns_ti *data, u32 offset)
{
return readl(data->usbss + offset);
}
static inline void cdns_ti_writel(struct cdns_ti *data, u32 offset, u32 value)
{
writel(value, data->usbss + offset);
}
static struct cdns3_platform_data cdns_ti_pdata = {
.quirks = CDNS3_DRD_SUSPEND_RESIDENCY_ENABLE, /* Errata i2409 */
};
static const struct of_dev_auxdata cdns_ti_auxdata[] = {
{
.compatible = "cdns,usb3",
.platform_data = &cdns_ti_pdata,
},
{},
};
static void cdns_ti_reset_and_init_hw(struct cdns_ti *data)
{
u32 reg;
/* assert RESET */
reg = cdns_ti_readl(data, USBSS_W1);
reg &= ~USBSS_W1_PWRUP_RST;
cdns_ti_writel(data, USBSS_W1, reg);
/* set static config */
reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG);
reg &= ~USBSS1_STATIC_PLL_REF_SEL_MASK;
reg |= data->usb2_refclk_rate_code << USBSS1_STATIC_PLL_REF_SEL_SHIFT;
reg &= ~USBSS1_STATIC_VBUS_SEL_MASK;
if (data->vbus_divider)
reg |= 1 << USBSS1_STATIC_VBUS_SEL_SHIFT;
cdns_ti_writel(data, USBSS_STATIC_CONFIG, reg);
reg = cdns_ti_readl(data, USBSS_STATIC_CONFIG);
/* set USB2_ONLY mode if requested */
reg = cdns_ti_readl(data, USBSS_W1);
if (data->usb2_only)
reg |= USBSS_W1_USB2_ONLY;
/* set default modestrap */
reg |= USBSS_W1_MODESTRAP_SEL;
reg &= ~USBSS_W1_MODESTRAP_MASK;
reg |= USBSS_MODESTRAP_MODE_NONE << USBSS_W1_MODESTRAP_SHIFT;
cdns_ti_writel(data, USBSS_W1, reg);
/* de-assert RESET */
reg |= USBSS_W1_PWRUP_RST;
cdns_ti_writel(data, USBSS_W1, reg);
}
static int cdns_ti_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct device_node *node = pdev->dev.of_node;
struct cdns_ti *data;
Annotation
- Immediate include surface: `linux/bits.h`, `linux/clk.h`, `linux/module.h`, `linux/kernel.h`, `linux/interrupt.h`, `linux/platform_device.h`, `linux/dma-mapping.h`, `linux/io.h`.
- Detected declarations: `struct cdns_ti`, `enum modestrap_mode`, `function cdns_ti_readl`, `function cdns_ti_writel`, `function cdns_ti_reset_and_init_hw`, `function cdns_ti_probe`, `function cdns_ti_remove_core`, `function cdns_ti_remove`, `function cdns_ti_runtime_resume`.
- 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.