drivers/usb/gadget/udc/bcm63xx_udc.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/bcm63xx_udc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/bcm63xx_udc.c- Extension
.c- Size
- 66647 bytes
- Lines
- 2381
- 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/bitops.hlinux/bug.hlinux/clk.hlinux/compiler.hlinux/debugfs.hlinux/delay.hlinux/device.hlinux/dma-mapping.hlinux/errno.hlinux/interrupt.hlinux/ioport.hlinux/kernel.hlinux/list.hlinux/module.hlinux/moduleparam.hlinux/platform_device.hlinux/sched.hlinux/seq_file.hlinux/slab.hlinux/timer.hlinux/usb.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/workqueue.hbcm63xx_cpu.hbcm63xx_iudma.hbcm63xx_dev_usb_usbd.hbcm63xx_io.hbcm63xx_regs.h
Detected Declarations
struct iudma_ch_cfgstruct bcm63xx_udcstruct iudma_chstruct bcm63xx_epstruct bcm63xx_reqstruct bcm63xx_udcenum bcm63xx_ep0_statefunction usbd_readlfunction usbd_writelfunction usb_dma_readlfunction usb_dma_writelfunction usb_dmac_readlfunction usb_dmac_writelfunction usb_dmas_readlfunction usb_dmas_writelfunction set_clocksfunction bcm63xx_ep_dma_selectfunction bcm63xx_update_wedgefunction bcm63xx_fifo_setupfunction bcm63xx_fifo_reset_epfunction bcm63xx_fifo_resetfunction bcm63xx_ep_initfunction bcm63xx_ep_setupfunction iudma_writefunction iudma_readfunction iudma_reset_channelfunction iudma_init_channelfunction iudma_initfunction iudma_uninitfunction bcm63xx_set_ctrl_irqsfunction bcm63xx_select_pullupfunction bcm63xx_select_pullupfunction bcm63xx_udc_stopfunction bcm63xx_init_udc_hwfunction bcm63xx_ep_enablefunction bcm63xx_ep_disablefunction bcm63xx_udc_free_requestfunction bcm63xx_udc_queuefunction bcm63xx_udc_dequeuefunction bcm63xx_update_wedgefunction bcm63xx_update_wedgefunction bcm63xx_ep0_setup_callbackfunction bcm63xx_ep0_spoof_set_cfgfunction bcm63xx_ep0_spoof_set_ifacefunction bcm63xx_ep0_map_writefunction bcm63xx_ep0_completefunction bcm63xx_ep0_nuke_replyfunction bcm63xx_ep0_read_complete
Annotated Snippet
struct iudma_ch_cfg {
int ep_num;
int n_bds;
int ep_type;
int dir;
int n_fifo_slots;
int max_pkt_hs;
int max_pkt_fs;
};
static const struct iudma_ch_cfg iudma_defaults[] = {
/* This controller was designed to support a CDC/RNDIS application.
It may be possible to reconfigure some of the endpoints, but
the hardware limitations (FIFO sizing and number of DMA channels)
may significantly impact flexibility and/or stability. Change
these values at your own risk.
ep_num ep_type n_fifo_slots max_pkt_fs
idx | n_bds | dir | max_pkt_hs |
| | | | | | | | */
[0] = { -1, 4, BCMEP_CTRL, BCMEP_OUT, 32, 64, 64 },
[1] = { 0, 4, BCMEP_CTRL, BCMEP_OUT, 32, 64, 64 },
[2] = { 2, 16, BCMEP_BULK, BCMEP_OUT, 128, 512, 64 },
[3] = { 1, 16, BCMEP_BULK, BCMEP_IN, 128, 512, 64 },
[4] = { 4, 4, BCMEP_INTR, BCMEP_OUT, 32, 64, 64 },
[5] = { 3, 4, BCMEP_INTR, BCMEP_IN, 32, 64, 64 },
};
struct bcm63xx_udc;
/**
* struct iudma_ch - Represents the current state of a single IUDMA channel.
* @ch_idx: IUDMA channel index (0 to BCM63XX_NUM_IUDMA-1).
* @ep_num: USB endpoint number. -1 for ep0 RX.
* @enabled: Whether bcm63xx_ep_enable() has been called.
* @max_pkt: "Chunk size" on the USB interface. Based on interface speed.
* @is_tx: true for TX, false for RX.
* @bep: Pointer to the associated endpoint. NULL for ep0 RX.
* @udc: Reference to the device controller.
* @read_bd: Next buffer descriptor to reap from the hardware.
* @write_bd: Next BD available for a new packet.
* @end_bd: Points to the final BD in the ring.
* @n_bds_used: Number of BD entries currently occupied.
* @bd_ring: Base pointer to the BD ring.
* @bd_ring_dma: Physical (DMA) address of bd_ring.
* @n_bds: Total number of BDs in the ring.
*
* ep0 has two IUDMA channels (IUDMA_EP0_RXCHAN and IUDMA_EP0_TXCHAN), as it is
* bidirectional. The "struct usb_ep" associated with ep0 is for TX (IN)
* only.
*
* Each bulk/intr endpoint has a single IUDMA channel and a single
* struct usb_ep.
*/
struct iudma_ch {
unsigned int ch_idx;
int ep_num;
bool enabled;
int max_pkt;
bool is_tx;
struct bcm63xx_ep *bep;
struct bcm63xx_udc *udc;
struct bcm_enet_desc *read_bd;
struct bcm_enet_desc *write_bd;
struct bcm_enet_desc *end_bd;
int n_bds_used;
struct bcm_enet_desc *bd_ring;
dma_addr_t bd_ring_dma;
unsigned int n_bds;
};
/**
* struct bcm63xx_ep - Internal (driver) state of a single endpoint.
* @ep_num: USB endpoint number.
* @iudma: Pointer to IUDMA channel state.
* @ep: USB gadget layer representation of the EP.
* @udc: Reference to the device controller.
* @queue: Linked list of outstanding requests for this EP.
* @halted: 1 if the EP is stalled; 0 otherwise.
*/
struct bcm63xx_ep {
unsigned int ep_num;
struct iudma_ch *iudma;
struct usb_ep ep;
struct bcm63xx_udc *udc;
struct list_head queue;
unsigned halted:1;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/bug.h`, `linux/clk.h`, `linux/compiler.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/device.h`, `linux/dma-mapping.h`.
- Detected declarations: `struct iudma_ch_cfg`, `struct bcm63xx_udc`, `struct iudma_ch`, `struct bcm63xx_ep`, `struct bcm63xx_req`, `struct bcm63xx_udc`, `enum bcm63xx_ep0_state`, `function usbd_readl`, `function usbd_writel`, `function usb_dma_readl`.
- 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.