drivers/usb/dwc2/core.h
Source file repositories/reference/linux-study-clean/drivers/usb/dwc2/core.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/dwc2/core.h- Extension
.h- Size
- 64921 bytes
- Lines
- 1571
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/phy/phy.hlinux/regulator/consumer.hlinux/usb/gadget.hlinux/usb/otg.hlinux/usb/phy.hhw.h
Detected Declarations
struct dwc2_hsotgstruct dwc2_hsotg_reqstruct dwc2_hsotg_epstruct dwc2_hsotg_reqstruct dwc2_hsotgstruct dwc2_host_chanstruct dwc2_core_paramsstruct dwc2_hw_paramsstruct dwc2_gregs_backupstruct dwc2_dregs_backupstruct dwc2_hregs_backupstruct dwc2_hsotgenum dwc2_lx_stateenum dwc2_ep0_stateenum dwc2_halt_statusfunction dwc2_readlfunction dwc2_writelfunction dwc2_readl_repfunction dwc2_writel_repfunction dwc2_is_iotfunction dwc2_is_fs_iotfunction dwc2_is_hs_iotfunction dwc2_is_host_modefunction dwc2_is_device_modefunction dwc2_clear_fifo_mapfunction dwc2_hsotg_removefunction dwc2_hsotg_suspendfunction dwc2_hsotg_resumefunction dwc2_gadget_initfunction dwc2_hsotg_core_init_disconnectedfunction dwc2_backup_device_registersfunction dwc2_restore_device_registersfunction dwc2_gadget_enter_hibernationfunction dwc2_gadget_exit_hibernationfunction dwc2_gadget_enter_partial_power_downfunction dwc2_gadget_exit_partial_power_downfunction dwc2_gadget_enter_clock_gatingfunction dwc2_hsotg_tx_fifo_total_depthfunction dwc2_hsotg_tx_fifo_average_depthfunction dwc2_gadget_init_lpmfunction dwc2_gadget_restore_critical_registersfunction dwc2_clear_fifo_mapfunction dwc2_host_schedule_phy_resetfunction dwc2_hcd_get_frame_numberfunction dwc2_hcd_get_future_frame_numberfunction dwc2_hcd_connectfunction dwc2_port_suspendfunction dwc2_port_resume
Annotated Snippet
struct dwc2_hsotg_ep {
struct usb_ep ep;
struct list_head queue;
struct dwc2_hsotg *parent;
struct dwc2_hsotg_req *req;
struct dentry *debugfs;
unsigned long total_data;
unsigned int size_loaded;
unsigned int last_load;
unsigned int fifo_load;
unsigned short fifo_size;
unsigned short fifo_index;
unsigned char dir_in;
unsigned char map_dir;
unsigned char index;
unsigned char mc;
u16 interval;
unsigned int halted:1;
unsigned int periodic:1;
unsigned int isochronous:1;
unsigned int send_zlp:1;
unsigned int wedged:1;
unsigned int target_frame;
#define TARGET_FRAME_INITIAL 0xFFFFFFFF
bool frame_overrun;
dma_addr_t desc_list_dma;
struct dwc2_dma_desc *desc_list;
u8 desc_count;
unsigned int next_desc;
unsigned int compl_desc;
char name[10];
};
/**
* struct dwc2_hsotg_req - data transfer request
* @req: The USB gadget request
* @queue: The list of requests for the endpoint this is queued for.
* @saved_req_buf: variable to save req.buf when bounce buffers are used.
*/
struct dwc2_hsotg_req {
struct usb_request req;
struct list_head queue;
void *saved_req_buf;
};
#if IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL) || \
IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
#define call_gadget(_hs, _entry) \
do { \
if ((_hs)->gadget.speed != USB_SPEED_UNKNOWN && \
(_hs)->driver && (_hs)->driver->_entry) { \
spin_unlock(&_hs->lock); \
(_hs)->driver->_entry(&(_hs)->gadget); \
spin_lock(&_hs->lock); \
} \
} while (0)
#else
#define call_gadget(_hs, _entry) do {} while (0)
#endif
struct dwc2_hsotg;
struct dwc2_host_chan;
/* Device States */
enum dwc2_lx_state {
DWC2_L0, /* On state */
DWC2_L1, /* LPM sleep state */
DWC2_L2, /* USB suspend state */
DWC2_L3, /* Off state */
};
/* Gadget ep0 states */
enum dwc2_ep0_state {
DWC2_EP0_SETUP,
DWC2_EP0_DATA_IN,
DWC2_EP0_DATA_OUT,
DWC2_EP0_STATUS_IN,
DWC2_EP0_STATUS_OUT,
};
/**
* struct dwc2_core_params - Parameters for configuring the core
*
* @otg_caps: Specifies the OTG capabilities. OTG caps from the platform parameters,
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/phy/phy.h`, `linux/regulator/consumer.h`, `linux/usb/gadget.h`, `linux/usb/otg.h`, `linux/usb/phy.h`, `hw.h`.
- Detected declarations: `struct dwc2_hsotg`, `struct dwc2_hsotg_req`, `struct dwc2_hsotg_ep`, `struct dwc2_hsotg_req`, `struct dwc2_hsotg`, `struct dwc2_host_chan`, `struct dwc2_core_params`, `struct dwc2_hw_params`, `struct dwc2_gregs_backup`, `struct dwc2_dregs_backup`.
- 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.