drivers/usb/fotg210/fotg210-hcd.c
Source file repositories/reference/linux-study-clean/drivers/usb/fotg210/fotg210-hcd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/fotg210/fotg210-hcd.c- Extension
.c- Size
- 158609 bytes
- Lines
- 5642
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/of.hlinux/device.hlinux/dmapool.hlinux/kernel.hlinux/delay.hlinux/ioport.hlinux/sched.hlinux/vmalloc.hlinux/errno.hlinux/init.hlinux/hrtimer.hlinux/list.hlinux/interrupt.hlinux/usb.hlinux/usb/hcd.hlinux/moduleparam.hlinux/dma-mapping.hlinux/debugfs.hlinux/slab.hlinux/uaccess.hlinux/platform_device.hlinux/io.hlinux/iopoll.hasm/byteorder.hasm/irq.hlinux/unaligned.hfotg210.hfotg210-hcd.h
Detected Declarations
struct debug_bufferfunction dbg_hcs_paramsfunction dbg_hcc_paramsfunction dbg_qtdfunction dbg_qhfunction dbg_itdfunction dbg_status_buffunction dbg_intr_buffunction dbg_command_buffunction speed_charfunction token_markfunction qh_linesfunction fill_async_bufferfunction output_buf_tds_dirfunction fill_periodic_bufferfunction fill_registers_bufferfunction fill_bufferfunction debug_outputfunction debug_closefunction debug_async_openfunction debug_periodic_openfunction debug_registers_openfunction create_debug_filesfunction remove_debug_filesfunction handshakefunction fotg210_haltfunction fotg210_resetfunction fotg210_quiescefunction fotg210_set_command_bitfunction fotg210_clear_command_bitfunction fotg210_enable_eventfunction fotg210_poll_ASSfunction fotg210_disable_ASEfunction fotg210_poll_PSSfunction fotg210_disable_PSEfunction fotg210_handle_controller_deathfunction fotg210_handle_intr_unlinksfunction start_free_itdsfunction end_free_itdsfunction list_for_each_entry_safefunction fotg210_iaa_watchdogfunction turn_on_io_watchdogfunction fotg210_hrtimer_funcfunction check_reset_completefunction fotg210_hub_status_datafunction fotg210_hub_descriptorfunction fotg210_hub_controlfunction values
Annotated Snippet
static const struct file_operations debug_async_fops = {
.owner = THIS_MODULE,
.open = debug_async_open,
.read = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
static const struct file_operations debug_periodic_fops = {
.owner = THIS_MODULE,
.open = debug_periodic_open,
.read = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
static const struct file_operations debug_registers_fops = {
.owner = THIS_MODULE,
.open = debug_registers_open,
.read = debug_output,
.release = debug_close,
.llseek = default_llseek,
};
static struct dentry *fotg210_debug_root;
struct debug_buffer {
ssize_t (*fill_func)(struct debug_buffer *); /* fill method */
struct usb_bus *bus;
struct mutex mutex; /* protect filling of buffer */
size_t count; /* number of characters filled into buffer */
char *output_buf;
size_t alloc_size;
};
static inline char speed_char(u32 scratch)
{
switch (scratch & (3 << 12)) {
case QH_FULL_SPEED:
return 'f';
case QH_LOW_SPEED:
return 'l';
case QH_HIGH_SPEED:
return 'h';
default:
return '?';
}
}
static inline char token_mark(struct fotg210_hcd *fotg210, __hc32 token)
{
__u32 v = hc32_to_cpu(fotg210, token);
if (v & QTD_STS_ACTIVE)
return '*';
if (v & QTD_STS_HALT)
return '-';
if (!IS_SHORT_READ(v))
return ' ';
/* tries to advance through hw_alt_next */
return '/';
}
static void qh_lines(struct fotg210_hcd *fotg210, struct fotg210_qh *qh,
char **nextp, unsigned *sizep)
{
u32 scratch;
u32 hw_curr;
struct fotg210_qtd *td;
unsigned temp;
unsigned size = *sizep;
char *next = *nextp;
char mark;
__le32 list_end = FOTG210_LIST_END(fotg210);
struct fotg210_qh_hw *hw = qh->hw;
if (hw->hw_qtd_next == list_end) /* NEC does this */
mark = '@';
else
mark = token_mark(fotg210, hw->hw_token);
if (mark == '/') { /* qh_alt_next controls qh advance? */
if ((hw->hw_alt_next & QTD_MASK(fotg210)) ==
fotg210->async->hw->hw_alt_next)
mark = '#'; /* blocked */
else if (hw->hw_alt_next == list_end)
mark = '.'; /* use hw_qtd_next */
/* else alt_next points to some other qtd */
}
scratch = hc32_to_cpup(fotg210, &hw->hw_info1);
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/device.h`, `linux/dmapool.h`, `linux/kernel.h`, `linux/delay.h`, `linux/ioport.h`, `linux/sched.h`.
- Detected declarations: `struct debug_buffer`, `function dbg_hcs_params`, `function dbg_hcc_params`, `function dbg_qtd`, `function dbg_qh`, `function dbg_itd`, `function dbg_status_buf`, `function dbg_intr_buf`, `function dbg_command_buf`, `function speed_char`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: pattern 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.