drivers/usb/phy/phy-tegra-usb.c
Source file repositories/reference/linux-study-clean/drivers/usb/phy/phy-tegra-usb.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/phy/phy-tegra-usb.c- Extension
.c- Size
- 43791 bytes
- Lines
- 1656
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/err.hlinux/export.hlinux/gpio/consumer.hlinux/iopoll.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/resource.hlinux/slab.hlinux/spinlock.hlinux/regulator/consumer.hlinux/usb/ehci_def.hlinux/usb/of.hlinux/usb/tegra_usb_phy.hlinux/usb/ulpi.h
Detected Declarations
struct tegra_xtal_freqfunction set_ptsfunction set_phcdfunction utmip_pad_openfunction utmip_pad_closefunction utmip_pad_power_onfunction utmip_pad_power_offfunction utmi_wait_registerfunction utmi_phy_clk_disablefunction utmi_phy_clk_enablefunction utmi_phy_power_onfunction utmi_phy_power_offfunction ulpi_phy_power_onfunction ulpi_phy_power_offfunction tegra_hsic_readlfunction tegra_hsic_writelfunction uhsic_phy_power_onfunction uhsic_phy_power_offfunction tegra_usb_phy_power_onfunction tegra_usb_phy_power_offfunction tegra_usb_phy_shutdownfunction tegra_usb_phy_isrfunction tegra_usb_phy_set_wakeupfunction tegra_usb_phy_set_suspendfunction tegra_usb_phy_configure_pmcfunction tegra_usb_phy_initfunction read_utmi_paramfunction utmi_phy_probefunction tegra_usb_phy_put_pmc_devicefunction tegra_usb_phy_parse_pmcfunction tegra_usb_phy_probefunction tegra_usb_phy_remove
Annotated Snippet
struct tegra_xtal_freq {
unsigned int freq;
u8 enable_delay;
u8 stable_count;
u8 active_delay;
u8 utmi_xtal_freq_count;
u16 hsic_xtal_freq_count;
u16 debounce;
};
static const struct tegra_xtal_freq tegra_freq_table[] = {
{
.freq = 12000000,
.enable_delay = 0x02,
.stable_count = 0x2F,
.active_delay = 0x04,
.utmi_xtal_freq_count = 0x76,
.hsic_xtal_freq_count = 0x1CA,
.debounce = 0x7530,
},
{
.freq = 13000000,
.enable_delay = 0x02,
.stable_count = 0x33,
.active_delay = 0x05,
.utmi_xtal_freq_count = 0x7F,
.hsic_xtal_freq_count = 0x1F0,
.debounce = 0x7EF4,
},
{
.freq = 19200000,
.enable_delay = 0x03,
.stable_count = 0x4B,
.active_delay = 0x06,
.utmi_xtal_freq_count = 0xBB,
.hsic_xtal_freq_count = 0x2DD,
.debounce = 0xBB80,
},
{
.freq = 26000000,
.enable_delay = 0x04,
.stable_count = 0x66,
.active_delay = 0x09,
.utmi_xtal_freq_count = 0xFE,
.hsic_xtal_freq_count = 0x3E0,
.debounce = 0xFDE8,
},
};
static inline struct tegra_usb_phy *to_tegra_usb_phy(struct usb_phy *u_phy)
{
return container_of(u_phy, struct tegra_usb_phy, u_phy);
}
static void set_pts(struct tegra_usb_phy *phy, u8 pts_val)
{
void __iomem *base = phy->regs;
u32 val;
if (phy->soc_config->has_hostpc) {
val = readl_relaxed(base + TEGRA_USB_HOSTPC1_DEVLC);
val &= ~TEGRA_USB_HOSTPC1_DEVLC_PTS(~0);
val |= TEGRA_USB_HOSTPC1_DEVLC_PTS(pts_val);
writel_relaxed(val, base + TEGRA_USB_HOSTPC1_DEVLC);
} else {
val = readl_relaxed(base + TEGRA_USB_PORTSC1);
val &= ~TEGRA_PORTSC1_RWC_BITS;
val &= ~TEGRA_USB_PORTSC1_PTS(~0);
val |= TEGRA_USB_PORTSC1_PTS(pts_val);
writel_relaxed(val, base + TEGRA_USB_PORTSC1);
}
}
static void set_phcd(struct tegra_usb_phy *phy, bool enable)
{
void __iomem *base = phy->regs;
u32 val;
if (phy->soc_config->has_hostpc) {
val = readl_relaxed(base + TEGRA_USB_HOSTPC1_DEVLC);
if (enable)
val |= TEGRA_USB_HOSTPC1_DEVLC_PHCD;
else
val &= ~TEGRA_USB_HOSTPC1_DEVLC_PHCD;
writel_relaxed(val, base + TEGRA_USB_HOSTPC1_DEVLC);
} else {
val = readl_relaxed(base + TEGRA_USB_PORTSC1) & ~PORT_RWC_BITS;
if (enable)
val |= TEGRA_USB_PORTSC1_PHCD;
else
Annotation
- Immediate include surface: `linux/delay.h`, `linux/err.h`, `linux/export.h`, `linux/gpio/consumer.h`, `linux/iopoll.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`.
- Detected declarations: `struct tegra_xtal_freq`, `function set_pts`, `function set_phcd`, `function utmip_pad_open`, `function utmip_pad_close`, `function utmip_pad_power_on`, `function utmip_pad_power_off`, `function utmi_wait_register`, `function utmi_phy_clk_disable`, `function utmi_phy_clk_enable`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.