drivers/usb/musb/omap2430.c
Source file repositories/reference/linux-study-clean/drivers/usb/musb/omap2430.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/musb/omap2430.c- Extension
.c- Size
- 15498 bytes
- Lines
- 625
- 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/module.hlinux/kernel.hlinux/sched.hlinux/init.hlinux/list.hlinux/io.hlinux/of.hlinux/of_irq.hlinux/platform_device.hlinux/dma-mapping.hlinux/pm_runtime.hlinux/err.hlinux/delay.hlinux/usb/musb.hlinux/phy/omap_control_phy.hlinux/of_platform.hmusb_core.homap2430.h
Detected Declarations
struct omap2430_gluefunction omap2430_low_level_exitfunction omap2430_low_level_initfunction omap2430_musb_mailboxfunction musb_set_peripheralfunction omap_musb_mailbox_workfunction omap2430_musb_interruptfunction omap2430_musb_initfunction omap2430_musb_enablefunction omap2430_musb_disablefunction omap2430_musb_exitfunction omap2430_probefunction omap2430_removefunction omap2430_runtime_suspendfunction omap2430_runtime_resumefunction omap2430_suspendfunction omap2430_suspend_latefunction omap2430_resume_earlyfunction omap2430_resume
Annotated Snippet
struct omap2430_glue {
struct device *dev;
struct platform_device *musb;
enum musb_vbus_id_status status;
struct work_struct omap_musb_mailbox_work;
struct device *control_otghs;
unsigned int is_runtime_suspended:1;
unsigned int needs_resume:1;
unsigned int phy_suspended:1;
};
#define glue_to_musb(g) platform_get_drvdata(g->musb)
static struct omap2430_glue *_glue;
static inline void omap2430_low_level_exit(struct musb *musb)
{
u32 l;
/* in any role */
l = musb_readl(musb->mregs, OTG_FORCESTDBY);
l |= ENABLEFORCE; /* enable MSTANDBY */
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}
static inline void omap2430_low_level_init(struct musb *musb)
{
u32 l;
l = musb_readl(musb->mregs, OTG_FORCESTDBY);
l &= ~ENABLEFORCE; /* disable MSTANDBY */
musb_writel(musb->mregs, OTG_FORCESTDBY, l);
}
static int omap2430_musb_mailbox(enum musb_vbus_id_status status)
{
struct omap2430_glue *glue = _glue;
if (!glue) {
pr_err("%s: musb core is not yet initialized\n", __func__);
return -EPROBE_DEFER;
}
glue->status = status;
if (!glue_to_musb(glue)) {
pr_err("%s: musb core is not yet ready\n", __func__);
return -EPROBE_DEFER;
}
schedule_work(&glue->omap_musb_mailbox_work);
return 0;
}
/*
* HDRC controls CPEN, but beware current surges during device connect.
* They can trigger transient overcurrent conditions that must be ignored.
*
* Note that we're skipping A_WAIT_VFALL -> A_IDLE and jumping right to B_IDLE
* as set by musb_set_peripheral().
*/
static void omap_musb_set_mailbox(struct omap2430_glue *glue)
{
struct musb *musb = glue_to_musb(glue);
int error;
pm_runtime_get_sync(musb->controller);
dev_dbg(musb->controller, "VBUS %s, devctl %02x\n",
usb_otg_state_string(musb->xceiv->otg->state),
musb_readb(musb->mregs, MUSB_DEVCTL));
switch (glue->status) {
case MUSB_ID_GROUND:
dev_dbg(musb->controller, "ID GND\n");
switch (musb->xceiv->otg->state) {
case OTG_STATE_A_IDLE:
error = musb_set_host(musb);
if (error)
break;
musb->xceiv->otg->state = OTG_STATE_A_WAIT_VRISE;
fallthrough;
case OTG_STATE_A_WAIT_VRISE:
case OTG_STATE_A_WAIT_BCON:
case OTG_STATE_A_HOST:
/*
* On multiple ID ground interrupts just keep enabling
* VBUS. At least cpcap VBUS shuts down otherwise.
*/
otg_set_vbus(musb->xceiv->otg, 1);
break;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/sched.h`, `linux/init.h`, `linux/list.h`, `linux/io.h`, `linux/of.h`, `linux/of_irq.h`.
- Detected declarations: `struct omap2430_glue`, `function omap2430_low_level_exit`, `function omap2430_low_level_init`, `function omap2430_musb_mailbox`, `function musb_set_peripheral`, `function omap_musb_mailbox_work`, `function omap2430_musb_interrupt`, `function omap2430_musb_init`, `function omap2430_musb_enable`, `function omap2430_musb_disable`.
- 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.