drivers/usb/gadget/udc/udc-xilinx.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/udc-xilinx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/udc-xilinx.c- Extension
.c- Size
- 61759 bytes
- Lines
- 2267
- 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/device.hlinux/dma-mapping.hlinux/interrupt.hlinux/io.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/prefetch.hlinux/usb/ch9.hlinux/usb/gadget.h
Detected Declarations
struct xusb_reqstruct xusb_epstruct xusb_udcfunction xudc_write32function xudc_read32function xudc_write32_befunction xudc_read32_befunction xudc_wrstatusfunction xudc_epconfigfunction xudc_start_dmafunction xudc_dma_sendfunction xudc_dma_receivefunction xudc_eptxrxfunction xudc_donefunction xudc_read_fifofunction xudc_write_fifofunction xudc_nukefunction xudc_ep_set_haltfunction __xudc_ep_enablefunction xudc_ep_enablefunction xudc_ep_disablefunction xudc_free_requestfunction __xudc_ep0_queuefunction xudc_ep0_queuefunction xudc_ep_queuefunction xudc_ep_dequeuefunction xudc_ep0_enablefunction xudc_ep0_disablefunction xudc_get_framefunction xudc_wakeupfunction xudc_pullupfunction xudc_eps_initfunction xudc_stop_activityfunction xudc_startfunction xudc_stopfunction xudc_clear_stall_all_epfunction xudc_startup_handlerfunction xudc_ep0_stallfunction xudc_setaddressfunction xudc_getstatusfunction xudc_set_clear_featurefunction xudc_handle_setupfunction xudc_ep0_outfunction xudc_ep0_infunction xudc_ctrl_ep_handlerfunction xudc_nonctrl_ep_handlerfunction xudc_irqfunction xudc_probe
Annotated Snippet
struct xusb_req {
struct usb_request usb_req;
struct list_head queue;
struct xusb_ep *ep;
};
/**
* struct xusb_ep - USB end point structure.
* @ep_usb: usb endpoint instance
* @queue: endpoint message queue
* @udc: xilinx usb peripheral driver instance pointer
* @desc: pointer to the usb endpoint descriptor
* @rambase: the endpoint buffer address
* @offset: the endpoint register offset value
* @name: name of the endpoint
* @epnumber: endpoint number
* @maxpacket: maximum packet size the endpoint can store
* @buffer0count: the size of the packet recieved in the first buffer
* @buffer1count: the size of the packet received in the second buffer
* @curbufnum: current buffer of endpoint that will be processed next
* @buffer0ready: the busy state of first buffer
* @buffer1ready: the busy state of second buffer
* @is_in: endpoint direction (IN or OUT)
* @is_iso: endpoint type(isochronous or non isochronous)
*/
struct xusb_ep {
struct usb_ep ep_usb;
struct list_head queue;
struct xusb_udc *udc;
const struct usb_endpoint_descriptor *desc;
u32 rambase;
u32 offset;
char name[4];
u16 epnumber;
u16 maxpacket;
u16 buffer0count;
u16 buffer1count;
u8 curbufnum;
bool buffer0ready;
bool buffer1ready;
bool is_in;
bool is_iso;
};
/**
* struct xusb_udc - USB peripheral driver structure
* @gadget: USB gadget driver instance
* @ep: an array of endpoint structures
* @driver: pointer to the usb gadget driver instance
* @setup: usb_ctrlrequest structure for control requests
* @req: pointer to dummy request for get status command
* @dev: pointer to device structure in gadget
* @usb_state: device in suspended state or not
* @remote_wkp: remote wakeup enabled by host
* @setupseqtx: tx status
* @setupseqrx: rx status
* @addr: the usb device base address
* @lock: instance of spinlock
* @dma_enabled: flag indicating whether the dma is included in the system
* @clk: pointer to struct clk
* @read_fn: function pointer to read device registers
* @write_fn: function pointer to write to device registers
*/
struct xusb_udc {
struct usb_gadget gadget;
struct xusb_ep ep[8];
struct usb_gadget_driver *driver;
struct usb_ctrlrequest setup;
struct xusb_req *req;
struct device *dev;
u32 usb_state;
u32 remote_wkp;
u32 setupseqtx;
u32 setupseqrx;
void __iomem *addr;
spinlock_t lock;
bool dma_enabled;
struct clk *clk;
unsigned int (*read_fn)(void __iomem *reg);
void (*write_fn)(void __iomem *, u32, u32);
};
/* Endpoint buffer start addresses in the core */
static u32 rambase[8] = { 0x22, 0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500,
0x1600 };
static const char driver_name[] = "xilinx-udc";
static const char ep0name[] = "ep0";
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/dma-mapping.h`, `linux/interrupt.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`.
- Detected declarations: `struct xusb_req`, `struct xusb_ep`, `struct xusb_udc`, `function xudc_write32`, `function xudc_read32`, `function xudc_write32_be`, `function xudc_read32_be`, `function xudc_wrstatus`, `function xudc_epconfig`, `function xudc_start_dma`.
- 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.