drivers/usb/host/fhci-hcd.c
Source file repositories/reference/linux-study-clean/drivers/usb/host/fhci-hcd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/host/fhci-hcd.c- Extension
.c- Size
- 18510 bytes
- Lines
- 795
- 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/types.hlinux/spinlock.hlinux/kernel.hlinux/delay.hlinux/errno.hlinux/list.hlinux/interrupt.hlinux/io.hlinux/usb.hlinux/usb/hcd.hlinux/of.hlinux/of_address.hlinux/of_irq.hlinux/platform_device.hlinux/slab.hlinux/gpio/consumer.hsoc/fsl/qe/qe.hasm/fsl_gtm.hfhci.h
Detected Declarations
function Copyrightfunction fhci_stop_sof_timerfunction fhci_get_sof_timer_countfunction endpoint_zero_initfunction fhci_usb_enable_interruptfunction fhci_usb_disable_interruptfunction fhci_usb_enablefunction fhci_usb_disablefunction fhci_ioports_check_bus_statefunction fhci_mem_freefunction list_for_each_entry_safefunction list_for_each_entry_safefunction fhci_mem_initfunction fhci_usb_freefunction fhci_usb_initfunction fhci_startfunction fhci_stopfunction fhci_urb_enqueuefunction fhci_urb_dequeuefunction fhci_endpoint_disablefunction fhci_get_frame_numberfunction of_fhci_probefunction fhci_removefunction of_fhci_remove
Annotated Snippet
while (ed->td_head != NULL) {
struct td *td = fhci_remove_td_from_ed(ed);
fhci_urb_complete_free(fhci, td->urb);
}
fhci_recycle_empty_ed(fhci, ed);
ep->hcpriv = NULL;
}
spin_unlock_irqrestore(&fhci->lock, flags);
}
static int fhci_get_frame_number(struct usb_hcd *hcd)
{
struct fhci_hcd *fhci = hcd_to_fhci(hcd);
return get_frame_num(fhci);
}
static const struct hc_driver fhci_driver = {
.description = "fsl,usb-fhci",
.product_desc = "FHCI HOST Controller",
.hcd_priv_size = sizeof(struct fhci_hcd),
/* generic hardware linkage */
.irq = fhci_irq,
.flags = HCD_DMA | HCD_USB11 | HCD_MEMORY,
/* basic lifecycle operation */
.start = fhci_start,
.stop = fhci_stop,
/* managing i/o requests and associated device resources */
.urb_enqueue = fhci_urb_enqueue,
.urb_dequeue = fhci_urb_dequeue,
.endpoint_disable = fhci_endpoint_disable,
/* scheduling support */
.get_frame_number = fhci_get_frame_number,
/* root hub support */
.hub_status_data = fhci_hub_status_data,
.hub_control = fhci_hub_control,
};
static int of_fhci_probe(struct platform_device *ofdev)
{
struct device *dev = &ofdev->dev;
struct device_node *node = dev->of_node;
struct usb_hcd *hcd;
struct fhci_hcd *fhci;
struct resource usb_regs;
unsigned long pram_addr;
unsigned int usb_irq;
const char *sprop;
const u32 *iprop;
int size;
int ret;
int i;
int j;
if (usb_disabled())
return -ENODEV;
sprop = of_get_property(node, "mode", NULL);
if (sprop && strcmp(sprop, "host"))
return -ENODEV;
hcd = usb_create_hcd(&fhci_driver, dev, dev_name(dev));
if (!hcd) {
dev_err(dev, "could not create hcd\n");
return -ENOMEM;
}
fhci = hcd_to_fhci(hcd);
hcd->self.controller = dev;
dev_set_drvdata(dev, hcd);
iprop = of_get_property(node, "hub-power-budget", &size);
if (iprop && size == sizeof(*iprop))
hcd->power_budget = *iprop;
/* FHCI registers. */
ret = of_address_to_resource(node, 0, &usb_regs);
if (ret) {
dev_err(dev, "could not get regs\n");
goto err_regs;
}
hcd->regs = ioremap(usb_regs.start, resource_size(&usb_regs));
if (!hcd->regs) {
dev_err(dev, "could not ioremap regs\n");
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/spinlock.h`, `linux/kernel.h`, `linux/delay.h`, `linux/errno.h`, `linux/list.h`, `linux/interrupt.h`.
- Detected declarations: `function Copyright`, `function fhci_stop_sof_timer`, `function fhci_get_sof_timer_count`, `function endpoint_zero_init`, `function fhci_usb_enable_interrupt`, `function fhci_usb_disable_interrupt`, `function fhci_usb_enable`, `function fhci_usb_disable`, `function fhci_ioports_check_bus_state`, `function fhci_mem_free`.
- 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.