drivers/usb/chipidea/host.c
Source file repositories/reference/linux-study-clean/drivers/usb/chipidea/host.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/chipidea/host.c- Extension
.c- Size
- 12430 bytes
- Lines
- 510
- 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/kernel.hlinux/io.hlinux/usb.hlinux/usb/hcd.hlinux/usb/chipidea.hlinux/regulator/consumer.hlinux/string_choices.hlinux/pinctrl/consumer.h../host/ehci.hci.hbits.hhost.h
Detected Declarations
struct ehci_ci_privstruct ci_hdrc_dma_aligned_bufferfunction ehci_ci_portpowerfunction ehci_ci_resetfunction host_irqfunction host_startfunction host_stopfunction ci_hdrc_host_destroyfunction ci_ehci_hub_controlfunction ci_ehci_bus_suspendfunction ci_hdrc_free_dma_aligned_bufferfunction ci_hdrc_alloc_dma_aligned_bufferfunction ci_hdrc_map_urb_for_dmafunction ci_hdrc_unmap_urb_for_dmafunction ci_hdrc_host_suspendfunction ci_hdrc_host_resumefunction ci_hdrc_host_initfunction ci_hdrc_host_driver_init
Annotated Snippet
struct ehci_ci_priv {
struct regulator *reg_vbus;
bool enabled;
};
struct ci_hdrc_dma_aligned_buffer {
void *original_buffer;
u8 data[];
};
static int ehci_ci_portpower(struct usb_hcd *hcd, int portnum, bool enable)
{
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
struct ehci_ci_priv *priv = (struct ehci_ci_priv *)ehci->priv;
struct device *dev = hcd->self.controller;
struct ci_hdrc *ci = dev_get_drvdata(dev);
int ret = 0;
int port = HCS_N_PORTS(ehci->hcs_params);
if (priv->reg_vbus && enable != priv->enabled) {
if (port > 1) {
dev_warn(dev,
"Not support multi-port regulator control\n");
return 0;
}
if (enable)
ret = regulator_enable(priv->reg_vbus);
else
ret = regulator_disable(priv->reg_vbus);
if (ret) {
dev_err(dev,
"Failed to %s vbus regulator, ret=%d\n",
str_enable_disable(enable), ret);
return ret;
}
priv->enabled = enable;
}
if (ci->platdata->flags & CI_HDRC_PHY_VBUS_CONTROL) {
if (enable)
usb_phy_vbus_on(ci->usb_phy);
else
usb_phy_vbus_off(ci->usb_phy);
}
if (enable && (ci->platdata->phy_mode == USBPHY_INTERFACE_MODE_HSIC)) {
/*
* Marvell 28nm HSIC PHY requires forcing the port to HS mode.
* As HSIC is always HS, this should be safe for others.
*/
hw_port_test_set(ci, 5);
hw_port_test_set(ci, 0);
}
return 0;
};
static int ehci_ci_reset(struct usb_hcd *hcd)
{
struct device *dev = hcd->self.controller;
struct ci_hdrc *ci = dev_get_drvdata(dev);
struct ehci_hcd *ehci = hcd_to_ehci(hcd);
int ret;
ret = ehci_setup(hcd);
if (ret)
return ret;
ehci->need_io_watchdog = 0;
if (ci->platdata->notify_event) {
ret = ci->platdata->notify_event(ci,
CI_HDRC_CONTROLLER_RESET_EVENT);
if (ret)
return ret;
}
ci_platform_configure(ci);
return ret;
}
static const struct ehci_driver_overrides ehci_ci_overrides = {
.extra_priv_size = sizeof(struct ehci_ci_priv),
.port_power = ehci_ci_portpower,
.reset = ehci_ci_reset,
};
static irqreturn_t host_irq(struct ci_hdrc *ci)
{
return usb_hcd_irq(ci->irq, ci->hcd);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/io.h`, `linux/usb.h`, `linux/usb/hcd.h`, `linux/usb/chipidea.h`, `linux/regulator/consumer.h`, `linux/string_choices.h`, `linux/pinctrl/consumer.h`.
- Detected declarations: `struct ehci_ci_priv`, `struct ci_hdrc_dma_aligned_buffer`, `function ehci_ci_portpower`, `function ehci_ci_reset`, `function host_irq`, `function host_start`, `function host_stop`, `function ci_hdrc_host_destroy`, `function ci_ehci_hub_control`, `function ci_ehci_bus_suspend`.
- 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.