drivers/phy/tegra/xusb-tegra186.c
Source file repositories/reference/linux-study-clean/drivers/phy/tegra/xusb-tegra186.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/phy/tegra/xusb-tegra186.c- Extension
.c- Size
- 49228 bytes
- Lines
- 1761
- 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/delay.hlinux/io.hlinux/module.hlinux/of.hlinux/phy/phy.hlinux/regulator/consumer.hlinux/platform_device.hlinux/clk.hlinux/slab.hsoc/tegra/fuse.hxusb.h
Detected Declarations
struct tegra_xusb_fuse_calibrationstruct tegra186_xusb_padctl_contextstruct tegra186_xusb_padctlfunction ao_writelfunction ao_readlfunction to_tegra186_xusb_padctlfunction tegra186_usb2_lane_probefunction tegra186_usb2_lane_removefunction tegra186_utmi_enable_phy_sleepwalkfunction tegra186_utmi_disable_phy_sleepwalkfunction tegra186_utmi_enable_phy_wakefunction tegra186_utmi_disable_phy_wakefunction tegra186_utmi_phy_remote_wake_detectedfunction tegra186_utmi_bias_pad_power_onfunction tegra186_utmi_bias_pad_power_offfunction tegra186_utmi_pad_power_onfunction tegra186_utmi_pad_power_downfunction tegra186_xusb_padctl_vbus_overridefunction tegra186_xusb_padctl_id_overridefunction tegra186_utmi_phy_set_modefunction tegra186_utmi_phy_power_onfunction tegra186_utmi_phy_power_offfunction tegra186_utmi_phy_initfunction tegra186_utmi_phy_exitfunction tegra186_usb2_pad_probefunction tegra186_usb2_pad_removefunction tegra186_usb2_port_enablefunction tegra186_usb2_port_disablefunction tegra186_usb3_lane_probefunction tegra186_usb3_lane_removefunction tegra186_usb3_enable_phy_sleepwalkfunction tegra186_usb3_disable_phy_sleepwalkfunction tegra186_usb3_enable_phy_wakefunction tegra186_usb3_disable_phy_wakefunction tegra186_usb3_phy_remote_wake_detectedfunction tegra186_usb3_port_enablefunction tegra186_usb3_port_disablefunction tegra186_usb3_phy_power_onfunction tegra186_usb3_phy_power_offfunction tegra186_usb3_phy_initfunction tegra186_usb3_phy_exitfunction tegra186_usb3_pad_probefunction tegra186_usb3_pad_removefunction tegra186_xusb_read_fuse_calibrationfunction tegra186_xusb_padctl_probefunction tegra186_xusb_padctl_savefunction tegra186_xusb_padctl_restorefunction tegra186_xusb_padctl_suspend_noirq
Annotated Snippet
struct tegra_xusb_fuse_calibration {
u32 *hs_curr_level;
u32 hs_squelch;
u32 *hs_term_range_adj;
u32 rpd_ctrl;
};
struct tegra186_xusb_padctl_context {
u32 vbus_id;
u32 usb2_pad_mux;
u32 usb2_port_cap;
u32 ss_port_cap;
};
struct tegra186_xusb_padctl {
struct tegra_xusb_padctl base;
void __iomem *ao_regs;
struct tegra_xusb_fuse_calibration calib;
/* UTMI bias and tracking */
struct clk *usb2_trk_clk;
DECLARE_BITMAP(utmi_pad_enabled, TEGRA_UTMI_PAD_MAX);
/* padctl context */
struct tegra186_xusb_padctl_context context;
};
static inline void ao_writel(struct tegra186_xusb_padctl *priv, u32 value, unsigned int offset)
{
writel(value, priv->ao_regs + offset);
}
static inline u32 ao_readl(struct tegra186_xusb_padctl *priv, unsigned int offset)
{
return readl(priv->ao_regs + offset);
}
static inline struct tegra186_xusb_padctl *
to_tegra186_xusb_padctl(struct tegra_xusb_padctl *padctl)
{
return container_of(padctl, struct tegra186_xusb_padctl, base);
}
/* USB 2.0 UTMI PHY support */
static struct tegra_xusb_lane *
tegra186_usb2_lane_probe(struct tegra_xusb_pad *pad, struct device_node *np,
unsigned int index)
{
struct tegra_xusb_usb2_lane *usb2;
int err;
usb2 = kzalloc_obj(*usb2);
if (!usb2)
return ERR_PTR(-ENOMEM);
INIT_LIST_HEAD(&usb2->base.list);
usb2->base.soc = &pad->soc->lanes[index];
usb2->base.index = index;
usb2->base.pad = pad;
usb2->base.np = np;
err = tegra_xusb_lane_parse_dt(&usb2->base, np);
if (err < 0) {
kfree(usb2);
return ERR_PTR(err);
}
return &usb2->base;
}
static void tegra186_usb2_lane_remove(struct tegra_xusb_lane *lane)
{
struct tegra_xusb_usb2_lane *usb2 = to_usb2_lane(lane);
kfree(usb2);
}
static int tegra186_utmi_enable_phy_sleepwalk(struct tegra_xusb_lane *lane,
enum usb_device_speed speed)
{
struct tegra_xusb_padctl *padctl = lane->pad->padctl;
struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl);
unsigned int index = lane->index;
u32 value;
mutex_lock(&padctl->lock);
/* ensure sleepwalk logic is disabled */
value = ao_readl(priv, XUSB_AO_UTMIP_SLEEPWALK_CFG(index));
Annotation
- Immediate include surface: `linux/delay.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/phy/phy.h`, `linux/regulator/consumer.h`, `linux/platform_device.h`, `linux/clk.h`.
- Detected declarations: `struct tegra_xusb_fuse_calibration`, `struct tegra186_xusb_padctl_context`, `struct tegra186_xusb_padctl`, `function ao_writel`, `function ao_readl`, `function to_tegra186_xusb_padctl`, `function tegra186_usb2_lane_probe`, `function tegra186_usb2_lane_remove`, `function tegra186_utmi_enable_phy_sleepwalk`, `function tegra186_utmi_disable_phy_sleepwalk`.
- 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.