drivers/usb/gadget/udc/fsl_udc_core.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/fsl_udc_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/fsl_udc_core.c- Extension
.c- Size
- 74266 bytes
- Lines
- 2709
- 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/ioport.hlinux/types.hlinux/errno.hlinux/err.hlinux/slab.hlinux/string_choices.hlinux/init.hlinux/list.hlinux/interrupt.hlinux/proc_fs.hlinux/mm.hlinux/moduleparam.hlinux/device.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/usb/otg.hlinux/dma-mapping.hlinux/platform_device.hlinux/fsl_devices.hlinux/dmapool.hasm/byteorder.hasm/io.hlinux/unaligned.hasm/dma.hfsl_usb2_udc.hlinux/seq_file.h
Detected Declarations
function readlfunction _fsl_readl_lefunction _fsl_writel_befunction _fsl_writel_lefunction fsl_set_accessorsfunction cpu_to_hc32function hc32_to_cpufunction fsl_set_accessorsfunction donefunction nukefunction dr_controller_setupfunction dr_controller_runfunction dr_controller_stopfunction dr_ep_setupfunction dr_ep_change_stallfunction dr_ep_get_stallfunction struct_ep_qh_setupfunction ep0_setupfunction do_set_interfacefunction statusfunction fsl_alloc_requestfunction fsl_free_requestfunction fsl_prime_epfunction fsl_queue_tdfunction fsl_req_to_dtdfunction fsl_ep_queuefunction fsl_ep_dequeuefunction fsl_ep_set_haltfunction fsl_ep_fifo_statusfunction fsl_ep_fifo_flushfunction numberfunction fsl_wakeupfunction can_pullupfunction fsl_vbus_sessionfunction fsl_vbus_drawfunction fsl_pullupfunction fsl_noop_completefunction ep0_prime_statusfunction udc_reset_ep_queuefunction ch9setaddressfunction ch9getstatusfunction setup_received_irqfunction ep0_req_completefunction tripwire_handlerfunction process_ep_reqfunction dtd_complete_irqfunction list_for_each_entry_safefunction portscx_device_speed
Annotated Snippet
static inline void fsl_set_accessors(struct fsl_usb2_platform_data *pdata) {}
#define fsl_readl(addr) readl(addr)
#define fsl_writel(val32, addr) writel(val32, addr)
#define cpu_to_hc32(x) cpu_to_le32(x)
#define hc32_to_cpu(x) le32_to_cpu(x)
#endif /* CONFIG_PPC32 */
/********************************************************************
* Internal Used Function
********************************************************************/
/*-----------------------------------------------------------------
* done() - retire a request; caller blocked irqs
* @status : request status to be set, only works when
* request is still in progress.
*--------------------------------------------------------------*/
static void done(struct fsl_ep *ep, struct fsl_req *req, int status)
__releases(ep->udc->lock)
__acquires(ep->udc->lock)
{
struct fsl_udc *udc = NULL;
unsigned char stopped = ep->stopped;
struct ep_td_struct *curr_td, *next_td;
int j;
udc = (struct fsl_udc *)ep->udc;
/* Removed the req from fsl_ep->queue */
list_del_init(&req->queue);
/* req.status should be set as -EINPROGRESS in ep_queue() */
if (req->req.status == -EINPROGRESS)
req->req.status = status;
else
status = req->req.status;
/* Free dtd for the request */
next_td = req->head;
for (j = 0; j < req->dtd_count; j++) {
curr_td = next_td;
if (j != req->dtd_count - 1) {
next_td = curr_td->next_td_virt;
}
dma_pool_free(udc->td_pool, curr_td, curr_td->td_dma);
}
usb_gadget_unmap_request(&ep->udc->gadget, &req->req, ep_is_in(ep));
if (status && (status != -ESHUTDOWN))
dev_vdbg(&udc->gadget.dev, "complete %s req %p stat %d len %u/%u\n",
ep->ep.name, &req->req, status,
req->req.actual, req->req.length);
ep->stopped = 1;
spin_unlock(&ep->udc->lock);
usb_gadget_giveback_request(&ep->ep, &req->req);
spin_lock(&ep->udc->lock);
ep->stopped = stopped;
}
/*-----------------------------------------------------------------
* nuke(): delete all requests related to this ep
* called with spinlock held
*--------------------------------------------------------------*/
static void nuke(struct fsl_ep *ep, int status)
{
ep->stopped = 1;
/* Flush fifo */
fsl_ep_fifo_flush(&ep->ep);
/* Whether this eq has request linked */
while (!list_empty(&ep->queue)) {
struct fsl_req *req = NULL;
req = list_entry(ep->queue.next, struct fsl_req, queue);
done(ep, req, status);
}
}
/*------------------------------------------------------------------
Internal Hardware related function
------------------------------------------------------------------*/
static int dr_controller_setup(struct fsl_udc *udc)
{
unsigned int tmp, portctrl, ep_num;
unsigned int max_no_of_ep;
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/ioport.h`, `linux/types.h`, `linux/errno.h`, `linux/err.h`, `linux/slab.h`, `linux/string_choices.h`.
- Detected declarations: `function readl`, `function _fsl_readl_le`, `function _fsl_writel_be`, `function _fsl_writel_le`, `function fsl_set_accessors`, `function cpu_to_hc32`, `function hc32_to_cpu`, `function fsl_set_accessors`, `function done`, `function nuke`.
- 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.