drivers/usb/gadget/udc/aspeed_udc.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/aspeed_udc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/aspeed_udc.c- Extension
.c- Size
- 40270 bytes
- Lines
- 1605
- 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/clk.hlinux/delay.hlinux/dma-mapping.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/prefetch.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/slab.h
Detected Declarations
struct ast_udc_requeststruct ast_dma_descstruct ast_udc_epstruct ast_udc_devfunction ast_udc_donefunction ast_udc_nukefunction ast_udc_stop_activityfunction ast_udc_ep_enablefunction ast_udc_ep_disablefunction ast_udc_ep_free_requestfunction ast_dma_descriptor_setupfunction ast_udc_epn_kickfunction ast_udc_epn_kick_descfunction ast_udc_ep0_queuefunction ast_udc_ep_queuefunction ast_udc_ep_dequeuefunction ast_udc_ep_set_haltfunction ast_udc_ep0_rxfunction ast_udc_ep0_txfunction ast_udc_ep0_outfunction ast_udc_ep0_infunction ast_udc_epn_handlefunction ast_udc_epn_handle_descfunction ast_udc_ep0_data_txfunction ast_udc_getstatusfunction ast_udc_ep0_handle_setupfunction requestfunction ast_udc_isrfunction ast_udc_gadget_getframefunction ast_udc_wake_workfunction ast_udc_wakeup_allfunction ast_udc_wakeupfunction ast_udc_pullupfunction ast_udc_startfunction ast_udc_stopfunction ast_udc_init_epfunction ast_udc_init_devfunction ast_udc_init_hwfunction ast_udc_removefunction ast_udc_probe
Annotated Snippet
struct ast_udc_request {
struct usb_request req;
struct list_head queue;
unsigned mapped:1;
unsigned int actual_dma_length;
u32 saved_dma_wptr;
};
#define to_ast_req(__req) container_of(__req, struct ast_udc_request, req)
struct ast_dma_desc {
u32 des_0;
u32 des_1;
};
struct ast_udc_ep {
struct usb_ep ep;
/* Request queue */
struct list_head queue;
struct ast_udc_dev *udc;
void __iomem *ep_reg;
void *epn_buf;
dma_addr_t epn_buf_dma;
const struct usb_endpoint_descriptor *desc;
/* DMA Descriptors */
struct ast_dma_desc *descs;
dma_addr_t descs_dma;
u32 descs_wptr;
u32 chunk_max;
bool dir_in:1;
unsigned stopped:1;
bool desc_mode:1;
};
#define to_ast_ep(__ep) container_of(__ep, struct ast_udc_ep, ep)
struct ast_udc_dev {
struct platform_device *pdev;
void __iomem *reg;
int irq;
spinlock_t lock;
struct clk *clk;
struct work_struct wake_work;
/* EP0 DMA buffers allocated in one chunk */
void *ep0_buf;
dma_addr_t ep0_buf_dma;
struct ast_udc_ep ep[AST_UDC_NUM_ENDPOINTS];
struct usb_gadget gadget;
struct usb_gadget_driver *driver;
void __iomem *creq;
enum usb_device_state suspended_from;
int desc_mode;
/* Force full speed only */
bool force_usb1:1;
unsigned is_control_tx:1;
bool wakeup_en:1;
};
#define to_ast_dev(__g) container_of(__g, struct ast_udc_dev, gadget)
static const char * const ast_ep_name[] = {
"ep0", "ep1", "ep2", "ep3", "ep4"
};
#ifdef AST_UDC_DEBUG_ALL
#define AST_UDC_DEBUG
#define AST_SETUP_DEBUG
#define AST_EP_DEBUG
#define AST_ISR_DEBUG
#endif
#ifdef AST_SETUP_DEBUG
#define SETUP_DBG(u, fmt, ...) \
dev_dbg(&(u)->pdev->dev, "%s() " fmt, __func__, ##__VA_ARGS__)
#else
#define SETUP_DBG(u, fmt, ...)
#endif
#ifdef AST_EP_DEBUG
#define EP_DBG(e, fmt, ...) \
dev_dbg(&(e)->udc->pdev->dev, "%s():%s " fmt, __func__, \
(e)->ep.name, ##__VA_ARGS__)
#else
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct ast_udc_request`, `struct ast_dma_desc`, `struct ast_udc_ep`, `struct ast_udc_dev`, `function ast_udc_done`, `function ast_udc_nuke`, `function ast_udc_stop_activity`, `function ast_udc_ep_enable`, `function ast_udc_ep_disable`, `function ast_udc_ep_free_request`.
- 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.