drivers/phy/tegra/xusb-tegra210.c
Source file repositories/reference/linux-study-clean/drivers/phy/tegra/xusb-tegra210.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/tegra/xusb-tegra210.c- Extension
.c- Size
- 102571 bytes
- Lines
- 3300
- Domain
- Driver Families
- Bucket
- drivers/phy
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/clk.hlinux/clk/tegra.hlinux/delay.hlinux/io.hlinux/mailbox_client.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/phy/phy.hlinux/platform_device.hlinux/regmap.hlinux/regulator/consumer.hlinux/reset.hlinux/slab.hsoc/tegra/fuse.hxusb.h
Detected Declarations
struct tegra210_xusb_fuse_calibrationstruct tegra210_xusb_padctl_contextstruct tegra210_xusb_padctlfunction to_tegra210_xusb_padctlfunction tegra210_usb3_lane_mapfunction tegra210_pex_uphy_enablefunction tegra210_pex_uphy_disablefunction tegra210_sata_uphy_enablefunction tegra210_sata_uphy_disablefunction tegra210_aux_mux_lp0_clamp_disablefunction tegra210_aux_mux_lp0_clamp_enablefunction tegra210_uphy_initfunction tegra210_uphy_deinitfunction tegra210_hsic_set_idlefunction tegra210_usb3_enable_phy_sleepwalkfunction tegra210_usb3_disable_phy_sleepwalkfunction tegra210_usb3_enable_phy_wakefunction tegra210_usb3_disable_phy_wakefunction tegra210_usb3_phy_remote_wake_detectedfunction tegra210_utmi_enable_phy_wakefunction tegra210_utmi_disable_phy_wakefunction tegra210_utmi_phy_remote_wake_detectedfunction tegra210_hsic_enable_phy_wakefunction tegra210_hsic_disable_phy_wakefunction tegra210_hsic_phy_remote_wake_detectedfunction tegra210_pmc_utmi_enable_phy_sleepwalkfunction tegra210_pmc_utmi_disable_phy_sleepwalkfunction tegra210_pmc_hsic_enable_phy_sleepwalkfunction tegra210_pmc_hsic_disable_phy_sleepwalkfunction tegra210_usb3_set_lfps_detectfunction tegra210_usb2_lane_probefunction tegra210_usb2_lane_removefunction tegra210_usb2_phy_initfunction tegra210_usb2_phy_exitfunction tegra210_xusb_padctl_vbus_overridefunction tegra210_xusb_padctl_id_overridefunction tegra210_usb2_phy_set_modefunction tegra210_usb2_phy_power_onfunction tegra210_usb2_phy_power_offfunction tegra210_usb2_pad_probefunction tegra210_usb2_pad_removefunction tegra210_hsic_lane_probefunction tegra210_hsic_lane_removefunction tegra210_hsic_phy_initfunction tegra210_hsic_phy_exitfunction tegra210_hsic_phy_power_onfunction tegra210_hsic_phy_power_offfunction tegra210_hsic_pad_probe
Annotated Snippet
struct tegra210_xusb_fuse_calibration {
u32 hs_curr_level[4];
u32 hs_term_range_adj;
u32 rpd_ctrl;
};
struct tegra210_xusb_padctl_context {
u32 usb2_pad_mux;
u32 usb2_port_cap;
u32 ss_port_map;
u32 usb3_pad_mux;
};
struct tegra210_xusb_padctl {
struct tegra_xusb_padctl base;
struct regmap *regmap;
struct tegra210_xusb_fuse_calibration fuse;
struct tegra210_xusb_padctl_context context;
};
static inline struct tegra210_xusb_padctl *
to_tegra210_xusb_padctl(struct tegra_xusb_padctl *padctl)
{
return container_of(padctl, struct tegra210_xusb_padctl, base);
}
static const struct tegra_xusb_lane_map tegra210_usb3_map[] = {
{ 0, "pcie", 6 },
{ 1, "pcie", 5 },
{ 2, "pcie", 0 },
{ 2, "pcie", 3 },
{ 3, "pcie", 4 },
{ 3, "sata", 0 },
{ 0, NULL, 0 }
};
static int tegra210_usb3_lane_map(struct tegra_xusb_lane *lane)
{
const struct tegra_xusb_lane_map *map;
for (map = tegra210_usb3_map; map->type; map++) {
if (map->index == lane->index &&
strcmp(map->type, lane->pad->soc->name) == 0) {
dev_dbg(lane->pad->padctl->dev, "lane = %s map to port = usb3-%d\n",
lane->pad->soc->lanes[lane->index].name, map->port);
return map->port;
}
}
return -EINVAL;
}
/* must be called under padctl->lock */
static int tegra210_pex_uphy_enable(struct tegra_xusb_padctl *padctl)
{
struct tegra_xusb_pcie_pad *pcie = to_pcie_pad(padctl->pcie);
unsigned long timeout;
u32 value;
unsigned int i;
int err;
if (pcie->enable)
return 0;
err = clk_prepare_enable(pcie->pll);
if (err < 0)
return err;
if (tegra210_plle_hw_sequence_is_enabled())
goto skip_pll_init;
err = reset_control_deassert(pcie->rst);
if (err < 0)
goto disable;
value = padctl_readl(padctl, XUSB_PADCTL_UPHY_PLL_P0_CTL2);
value &= ~(XUSB_PADCTL_UPHY_PLL_CTL2_CAL_CTRL_MASK <<
XUSB_PADCTL_UPHY_PLL_CTL2_CAL_CTRL_SHIFT);
value |= XUSB_PADCTL_UPHY_PLL_CTL2_CAL_CTRL_VAL <<
XUSB_PADCTL_UPHY_PLL_CTL2_CAL_CTRL_SHIFT;
padctl_writel(padctl, value, XUSB_PADCTL_UPHY_PLL_P0_CTL2);
value = padctl_readl(padctl, XUSB_PADCTL_UPHY_PLL_P0_CTL5);
value &= ~(XUSB_PADCTL_UPHY_PLL_CTL5_DCO_CTRL_MASK <<
XUSB_PADCTL_UPHY_PLL_CTL5_DCO_CTRL_SHIFT);
value |= XUSB_PADCTL_UPHY_PLL_CTL5_DCO_CTRL_VAL <<
XUSB_PADCTL_UPHY_PLL_CTL5_DCO_CTRL_SHIFT;
padctl_writel(padctl, value, XUSB_PADCTL_UPHY_PLL_P0_CTL5);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk/tegra.h`, `linux/delay.h`, `linux/io.h`, `linux/mailbox_client.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`.
- Detected declarations: `struct tegra210_xusb_fuse_calibration`, `struct tegra210_xusb_padctl_context`, `struct tegra210_xusb_padctl`, `function to_tegra210_xusb_padctl`, `function tegra210_usb3_lane_map`, `function tegra210_pex_uphy_enable`, `function tegra210_pex_uphy_disable`, `function tegra210_sata_uphy_enable`, `function tegra210_sata_uphy_disable`, `function tegra210_aux_mux_lp0_clamp_disable`.
- Atlas domain: Driver Families / drivers/phy.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.