drivers/usb/gadget/udc/pxa27x_udc.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/pxa27x_udc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/pxa27x_udc.c- Extension
.c- Size
- 67320 bytes
- Lines
- 2594
- 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/types.hlinux/errno.hlinux/err.hlinux/platform_device.hlinux/delay.hlinux/list.hlinux/interrupt.hlinux/proc_fs.hlinux/clk.hlinux/irq.hlinux/gpio.hlinux/gpio/consumer.hlinux/slab.hlinux/string_choices.hlinux/prefetch.hlinux/byteorder/generic.hlinux/platform_data/pxa2xx_udc.hlinux/of.hlinux/usb.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/usb/phy.hpxa27x_udc.hlinux/debugfs.hlinux/uaccess.hlinux/seq_file.h
Detected Declarations
function state_dbg_showfunction queues_dbg_showfunction list_for_each_entryfunction eps_dbg_showfunction pxa_init_debugfsfunction pxa_cleanup_debugfsfunction pxa_init_debugfsfunction driversfunction upfunction pio_irq_enablefunction pio_irq_disablefunction udc_set_mask_UDCCRfunction udc_clear_mask_UDCCRfunction UDCCSRfunction ep_count_bytes_remainfunction ep_is_emptyfunction ep_is_fullfunction epout_has_pktfunction set_ep0statefunction ep0_idlefunction inc_ep_stats_reqsfunction inc_ep_stats_bytesfunction pxa_ep_setupfunction pxa_eps_setupfunction pxa_ep_alloc_requestfunction pxa_ep_free_requestfunction ep_add_requestfunction ep_del_requestfunction req_donefunction requestfunction requestfunction requestfunction requestfunction endpointfunction read_packetfunction write_packetfunction read_fifofunction readyfunction read_ep0_fifofunction requestfunction pxa_ep_queuefunction pxa_ep_dequeuefunction pxa_ep_set_haltfunction pxa_ep_fifo_statusfunction endpointfunction pxa_ep_enablefunction pxa_ep_disablefunction dplus_pullup
Annotated Snippet
if (list_empty(&ep->queue)) {
seq_puts(s, "\t(nothing queued)\n");
continue;
}
list_for_each_entry(req, &ep->queue, queue) {
seq_printf(s, "\treq %p len %d/%d buf %p\n",
&req->req, req->req.actual,
req->req.length, req->req.buf);
}
}
return 0;
}
DEFINE_SHOW_ATTRIBUTE(queues_dbg);
static int eps_dbg_show(struct seq_file *s, void *p)
{
struct pxa_udc *udc = s->private;
struct pxa_ep *ep;
int i;
u32 tmp;
if (!udc->driver)
return -ENODEV;
ep = &udc->pxa_ep[0];
tmp = udc_ep_readl(ep, UDCCSR);
seq_printf(s, "udccsr0=0x%03x(%s%s%s%s%s%s%s)\n",
tmp,
(tmp & UDCCSR0_SA) ? " sa" : "",
(tmp & UDCCSR0_RNE) ? " rne" : "",
(tmp & UDCCSR0_FST) ? " fst" : "",
(tmp & UDCCSR0_SST) ? " sst" : "",
(tmp & UDCCSR0_DME) ? " dme" : "",
(tmp & UDCCSR0_IPR) ? " ipr" : "",
(tmp & UDCCSR0_OPC) ? " opc" : "");
for (i = 0; i < NR_PXA_ENDPOINTS; i++) {
ep = &udc->pxa_ep[i];
tmp = i? udc_ep_readl(ep, UDCCR) : udc_readl(udc, UDCCR);
seq_printf(s, "%-12s: IN %lu(%lu reqs), OUT %lu(%lu reqs), irqs=%lu, udccr=0x%08x, udccsr=0x%03x, udcbcr=%d\n",
EPNAME(ep),
ep->stats.in_bytes, ep->stats.in_ops,
ep->stats.out_bytes, ep->stats.out_ops,
ep->stats.irqs,
tmp, udc_ep_readl(ep, UDCCSR),
udc_ep_readl(ep, UDCBCR));
}
return 0;
}
DEFINE_SHOW_ATTRIBUTE(eps_dbg);
static void pxa_init_debugfs(struct pxa_udc *udc)
{
struct dentry *root;
root = debugfs_create_dir(udc->gadget.name, usb_debug_root);
debugfs_create_file("udcstate", 0400, root, udc, &state_dbg_fops);
debugfs_create_file("queues", 0400, root, udc, &queues_dbg_fops);
debugfs_create_file("epstate", 0400, root, udc, &eps_dbg_fops);
}
static void pxa_cleanup_debugfs(struct pxa_udc *udc)
{
debugfs_lookup_and_remove(udc->gadget.name, usb_debug_root);
}
#else
static inline void pxa_init_debugfs(struct pxa_udc *udc)
{
}
static inline void pxa_cleanup_debugfs(struct pxa_udc *udc)
{
}
#endif
/**
* is_match_usb_pxa - check if usb_ep and pxa_ep match
* @udc_usb_ep: usb endpoint
* @ep: pxa endpoint
* @config: configuration required in pxa_ep
* @interface: interface required in pxa_ep
* @altsetting: altsetting required in pxa_ep
*
* Returns 1 if all criteria match between pxa and usb endpoint, 0 otherwise
*/
static int is_match_usb_pxa(struct udc_usb_ep *udc_usb_ep, struct pxa_ep *ep,
int config, int interface, int altsetting)
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/types.h`, `linux/errno.h`, `linux/err.h`, `linux/platform_device.h`, `linux/delay.h`, `linux/list.h`.
- Detected declarations: `function state_dbg_show`, `function queues_dbg_show`, `function list_for_each_entry`, `function eps_dbg_show`, `function pxa_init_debugfs`, `function pxa_cleanup_debugfs`, `function pxa_init_debugfs`, `function drivers`, `function up`, `function pio_irq_enable`.
- 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.