drivers/usb/dwc3/dwc3-imx8mp.c
Source file repositories/reference/linux-study-clean/drivers/usb/dwc3/dwc3-imx8mp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/dwc3/dwc3-imx8mp.c- Extension
.c- Size
- 11813 bytes
- Lines
- 459
- 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.
- 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/cleanup.hlinux/clk.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hcore.h
Detected Declarations
struct dwc3_imx8mpfunction imx8mp_configure_gluefunction dwc3_imx8mp_wakeup_enablefunction dwc3_imx8mp_wakeup_disablefunction dwc3_imx8mp_interruptfunction dwc3_imx_pre_set_rolefunction dwc3_imx8mp_probefunction dwc3_imx8mp_removefunction dwc3_imx8mp_suspendfunction dwc3_imx8mp_resumefunction dwc3_imx8mp_pm_suspendfunction dwc3_imx8mp_pm_resumefunction dwc3_imx8mp_runtime_suspendfunction dwc3_imx8mp_runtime_resume
Annotated Snippet
struct dwc3_imx8mp {
struct device *dev;
struct platform_device *dwc3_pdev;
void __iomem *hsio_blk_base;
void __iomem *glue_base;
struct clk *hsio_clk;
struct clk *suspend_clk;
int irq;
bool pm_suspended;
bool wakeup_pending;
};
static void imx8mp_configure_glue(struct dwc3_imx8mp *dwc3_imx)
{
struct device *dev = dwc3_imx->dev;
u32 value;
if (!dwc3_imx->glue_base)
return;
value = readl(dwc3_imx->glue_base + USB_CTRL0);
if (device_property_read_bool(dev, "fsl,permanently-attached"))
value |= (USB_CTRL0_USB2_FIXED | USB_CTRL0_USB3_FIXED);
else
value &= ~(USB_CTRL0_USB2_FIXED | USB_CTRL0_USB3_FIXED);
if (device_property_read_bool(dev, "fsl,disable-port-power-control"))
value &= ~(USB_CTRL0_PORTPWR_EN);
else
value |= USB_CTRL0_PORTPWR_EN;
writel(value, dwc3_imx->glue_base + USB_CTRL0);
value = readl(dwc3_imx->glue_base + USB_CTRL1);
if (device_property_read_bool(dev, "fsl,over-current-active-low"))
value |= USB_CTRL1_OC_POLARITY;
else
value &= ~USB_CTRL1_OC_POLARITY;
if (device_property_read_bool(dev, "fsl,power-active-low"))
value |= USB_CTRL1_PWR_POLARITY;
else
value &= ~USB_CTRL1_PWR_POLARITY;
writel(value, dwc3_imx->glue_base + USB_CTRL1);
}
static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx,
pm_message_t msg)
{
struct dwc3 *dwc3 = platform_get_drvdata(dwc3_imx->dwc3_pdev);
u32 val;
if (!dwc3)
return;
val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) {
val |= USB_WAKEUP_EN | USB_WAKEUP_DPDM_EN;
if (PMSG_IS_AUTO(msg))
val |= USB_WAKEUP_SS_CONN | USB_WAKEUP_U3_EN;
} else {
val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN |
USB_WAKEUP_VBUS_SRC_SESS_VAL;
}
writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
}
static void dwc3_imx8mp_wakeup_disable(struct dwc3_imx8mp *dwc3_imx)
{
u32 val;
val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
val &= ~(USB_WAKEUP_EN | USB_WAKEUP_EN_MASK);
writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL);
}
static const struct property_entry dwc3_imx8mp_properties[] = {
PROPERTY_ENTRY_BOOL("xhci-missing-cas-quirk"),
PROPERTY_ENTRY_BOOL("xhci-skip-phy-init-quirk"),
{},
};
static const struct software_node dwc3_imx8mp_swnode = {
.properties = dwc3_imx8mp_properties,
};
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/clk.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/of_platform.h`.
- Detected declarations: `struct dwc3_imx8mp`, `function imx8mp_configure_glue`, `function dwc3_imx8mp_wakeup_enable`, `function dwc3_imx8mp_wakeup_disable`, `function dwc3_imx8mp_interrupt`, `function dwc3_imx_pre_set_role`, `function dwc3_imx8mp_probe`, `function dwc3_imx8mp_remove`, `function dwc3_imx8mp_suspend`, `function dwc3_imx8mp_resume`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- 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.