drivers/usb/gadget/udc/atmel_usba_udc.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/atmel_usba_udc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/atmel_usba_udc.c- Extension
.c- Size
- 60062 bytes
- Lines
- 2460
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/clk.hlinux/clk/at91_pmc.hlinux/module.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/slab.hlinux/device.hlinux/dma-mapping.hlinux/list.hlinux/mfd/syscon.hlinux/platform_device.hlinux/regmap.hlinux/ctype.hlinux/usb.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/delay.hlinux/of.hlinux/irq.hlinux/gpio/consumer.hatmel_usba_udc.hlinux/debugfs.hlinux/uaccess.h
Detected Declarations
function Copyrightfunction queue_dbg_readfunction queue_dbg_releasefunction list_for_each_entry_safefunction regs_dbg_openfunction regs_dbg_readfunction regs_dbg_releasefunction usba_ep_init_debugfsfunction usba_ep_cleanup_debugfsfunction usba_init_debugfsfunction usba_cleanup_debugfsfunction usba_ep_init_debugfsfunction usba_config_fifo_tablefunction usba_int_enb_getfunction usba_int_enb_setfunction usba_int_enb_clearfunction vbus_is_presentfunction toggle_biasfunction generate_bias_pulsefunction next_fifo_transactionfunction submit_requestfunction submit_next_requestfunction send_statusfunction receive_datafunction request_completefunction request_complete_listfunction list_for_each_entry_safefunction usba_ep_enablefunction usba_ep_disablefunction usba_ep_alloc_requestfunction usba_ep_free_requestfunction queue_dmafunction usba_ep_queuefunction usba_update_reqfunction stop_dmafunction usba_ep_dequeuefunction list_for_each_entryfunction usba_ep_set_haltfunction usba_ep_fifo_statusfunction usba_ep_fifo_flushfunction usba_udc_get_framefunction usba_udc_wakeupfunction usba_udc_set_selfpoweredfunction reset_all_endpointsfunction list_for_each_entryfunction set_protocol_stallfunction is_stalledfunction set_address
Annotated Snippet
static const struct file_operations queue_dbg_fops = {
.owner = THIS_MODULE,
.open = queue_dbg_open,
.read = queue_dbg_read,
.release = queue_dbg_release,
};
static const struct file_operations regs_dbg_fops = {
.owner = THIS_MODULE,
.open = regs_dbg_open,
.llseek = generic_file_llseek,
.read = regs_dbg_read,
.release = regs_dbg_release,
};
static void usba_ep_init_debugfs(struct usba_udc *udc,
struct usba_ep *ep)
{
struct dentry *ep_root;
ep_root = debugfs_create_dir(ep->ep.name, udc->debugfs_root);
ep->debugfs_dir = ep_root;
debugfs_create_file("queue", 0400, ep_root, ep, &queue_dbg_fops);
if (ep->can_dma)
debugfs_create_u32("dma_status", 0400, ep_root,
&ep->last_dma_status);
if (ep_is_control(ep))
debugfs_create_u32("state", 0400, ep_root, &ep->state);
}
static void usba_ep_cleanup_debugfs(struct usba_ep *ep)
{
debugfs_remove_recursive(ep->debugfs_dir);
}
static void usba_init_debugfs(struct usba_udc *udc)
{
struct dentry *root;
struct resource *regs_resource;
root = debugfs_create_dir(udc->gadget.name, usb_debug_root);
udc->debugfs_root = root;
regs_resource = platform_get_resource(udc->pdev, IORESOURCE_MEM,
CTRL_IOMEM_ID);
if (regs_resource) {
debugfs_create_file_size("regs", 0400, root, udc,
®s_dbg_fops,
resource_size(regs_resource));
}
usba_ep_init_debugfs(udc, to_usba_ep(udc->gadget.ep0));
}
static void usba_cleanup_debugfs(struct usba_udc *udc)
{
usba_ep_cleanup_debugfs(to_usba_ep(udc->gadget.ep0));
debugfs_remove_recursive(udc->debugfs_root);
}
#else
static inline void usba_ep_init_debugfs(struct usba_udc *udc,
struct usba_ep *ep)
{
}
static inline void usba_ep_cleanup_debugfs(struct usba_ep *ep)
{
}
static inline void usba_init_debugfs(struct usba_udc *udc)
{
}
static inline void usba_cleanup_debugfs(struct usba_udc *udc)
{
}
#endif
static ushort fifo_mode;
module_param(fifo_mode, ushort, 0x0);
MODULE_PARM_DESC(fifo_mode, "Endpoint configuration mode");
/* mode 0 - uses autoconfig */
Annotation
- Immediate include surface: `linux/clk.h`, `linux/clk/at91_pmc.h`, `linux/module.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/slab.h`, `linux/device.h`.
- Detected declarations: `function Copyright`, `function queue_dbg_read`, `function queue_dbg_release`, `function list_for_each_entry_safe`, `function regs_dbg_open`, `function regs_dbg_read`, `function regs_dbg_release`, `function usba_ep_init_debugfs`, `function usba_ep_cleanup_debugfs`, `function usba_init_debugfs`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.