drivers/usb/gadget/udc/tegra-xudc.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/tegra-xudc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/tegra-xudc.c- Extension
.c- Size
- 105426 bytes
- Lines
- 4096
- 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/completion.hlinux/delay.hlinux/dma-mapping.hlinux/dmapool.hlinux/interrupt.hlinux/iopoll.hlinux/kernel.hlinux/module.hlinux/of.hlinux/phy/phy.hlinux/phy/tegra/xusb.hlinux/pm_domain.hlinux/platform_device.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/reset.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/usb/otg.hlinux/usb/role.hlinux/usb/phy.hlinux/workqueue.h
Detected Declarations
struct tegra_xudc_ep_contextstruct tegra_xudc_trbstruct tegra_xudc_requeststruct tegra_xudc_epstruct tegra_xudc_sel_timingstruct tegra_xudc_setup_packetstruct tegra_xudc_save_regsstruct tegra_xudcstruct tegra_xudc_socenum tegra_xudc_setup_statefunction ep_ctx_read_deq_ptrfunction ep_ctx_write_deq_ptrfunction trb_read_data_ptrfunction trb_write_data_ptrfunction fpci_readlfunction fpci_writelfunction ipfs_readlfunction ipfs_writelfunction xudc_readlfunction xudc_writelfunction xudc_readl_pollfunction dump_trbfunction tegra_xudc_limit_port_speedfunction tegra_xudc_restore_port_speedfunction tegra_xudc_device_mode_onfunction tegra_xudc_device_mode_offfunction tegra_xudc_usb_role_sw_workfunction tegra_xudc_get_phy_indexfunction tegra_xudc_update_data_rolefunction tegra_xudc_vbus_notifyfunction tegra_xudc_plc_reset_workfunction tegra_xudc_port_reset_war_workfunction trb_virt_to_physfunction ep_reloadfunction ep_pausefunction ep_unpausefunction ep_unpause_allfunction ep_haltfunction ep_unhaltfunction ep_unhalt_allfunction ep_wait_for_stoppedfunction ep_wait_for_inactivefunction tegra_xudc_req_donefunction tegra_xudc_ep_nukefunction ep_available_trbsfunction tegra_xudc_queue_one_trbfunction tegra_xudc_queue_trbsfunction tegra_xudc_ep_ring_doorbell
Annotated Snippet
struct tegra_xudc_ep_context {
__le32 info0;
__le32 info1;
__le32 deq_lo;
__le32 deq_hi;
__le32 tx_info;
__le32 rsvd[11];
};
#define EP_STATE_DISABLED 0
#define EP_STATE_RUNNING 1
#define EP_STATE_HALTED 2
#define EP_STATE_STOPPED 3
#define EP_STATE_ERROR 4
#define EP_TYPE_INVALID 0
#define EP_TYPE_ISOCH_OUT 1
#define EP_TYPE_BULK_OUT 2
#define EP_TYPE_INTERRUPT_OUT 3
#define EP_TYPE_CONTROL 4
#define EP_TYPE_ISCOH_IN 5
#define EP_TYPE_BULK_IN 6
#define EP_TYPE_INTERRUPT_IN 7
#define BUILD_EP_CONTEXT_RW(name, member, shift, mask) \
static inline u32 ep_ctx_read_##name(struct tegra_xudc_ep_context *ctx) \
{ \
return (le32_to_cpu(ctx->member) >> (shift)) & (mask); \
} \
static inline void \
ep_ctx_write_##name(struct tegra_xudc_ep_context *ctx, u32 val) \
{ \
u32 tmp; \
\
tmp = le32_to_cpu(ctx->member) & ~((mask) << (shift)); \
tmp |= (val & (mask)) << (shift); \
ctx->member = cpu_to_le32(tmp); \
}
BUILD_EP_CONTEXT_RW(state, info0, 0, 0x7)
BUILD_EP_CONTEXT_RW(mult, info0, 8, 0x3)
BUILD_EP_CONTEXT_RW(max_pstreams, info0, 10, 0x1f)
BUILD_EP_CONTEXT_RW(lsa, info0, 15, 0x1)
BUILD_EP_CONTEXT_RW(interval, info0, 16, 0xff)
BUILD_EP_CONTEXT_RW(cerr, info1, 1, 0x3)
BUILD_EP_CONTEXT_RW(type, info1, 3, 0x7)
BUILD_EP_CONTEXT_RW(hid, info1, 7, 0x1)
BUILD_EP_CONTEXT_RW(max_burst_size, info1, 8, 0xff)
BUILD_EP_CONTEXT_RW(max_packet_size, info1, 16, 0xffff)
BUILD_EP_CONTEXT_RW(dcs, deq_lo, 0, 0x1)
BUILD_EP_CONTEXT_RW(deq_lo, deq_lo, 4, 0xfffffff)
BUILD_EP_CONTEXT_RW(deq_hi, deq_hi, 0, 0xffffffff)
BUILD_EP_CONTEXT_RW(avg_trb_len, tx_info, 0, 0xffff)
BUILD_EP_CONTEXT_RW(max_esit_payload, tx_info, 16, 0xffff)
BUILD_EP_CONTEXT_RW(edtla, rsvd[0], 0, 0xffffff)
BUILD_EP_CONTEXT_RW(rsvd, rsvd[0], 24, 0x1)
BUILD_EP_CONTEXT_RW(partial_td, rsvd[0], 25, 0x1)
BUILD_EP_CONTEXT_RW(splitxstate, rsvd[0], 26, 0x1)
BUILD_EP_CONTEXT_RW(seq_num, rsvd[0], 27, 0x1f)
BUILD_EP_CONTEXT_RW(cerrcnt, rsvd[1], 18, 0x3)
BUILD_EP_CONTEXT_RW(data_offset, rsvd[2], 0, 0x1ffff)
BUILD_EP_CONTEXT_RW(numtrbs, rsvd[2], 22, 0x1f)
BUILD_EP_CONTEXT_RW(devaddr, rsvd[6], 0, 0x7f)
static inline u64 ep_ctx_read_deq_ptr(struct tegra_xudc_ep_context *ctx)
{
return ((u64)ep_ctx_read_deq_hi(ctx) << 32) |
(ep_ctx_read_deq_lo(ctx) << 4);
}
static inline void
ep_ctx_write_deq_ptr(struct tegra_xudc_ep_context *ctx, u64 addr)
{
ep_ctx_write_deq_lo(ctx, lower_32_bits(addr) >> 4);
ep_ctx_write_deq_hi(ctx, upper_32_bits(addr));
}
struct tegra_xudc_trb {
__le32 data_lo;
__le32 data_hi;
__le32 status;
__le32 control;
};
#define TRB_TYPE_RSVD 0
#define TRB_TYPE_NORMAL 1
#define TRB_TYPE_SETUP_STAGE 2
#define TRB_TYPE_DATA_STAGE 3
#define TRB_TYPE_STATUS_STAGE 4
#define TRB_TYPE_ISOCH 5
Annotation
- Immediate include surface: `linux/clk.h`, `linux/completion.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dmapool.h`, `linux/interrupt.h`, `linux/iopoll.h`, `linux/kernel.h`.
- Detected declarations: `struct tegra_xudc_ep_context`, `struct tegra_xudc_trb`, `struct tegra_xudc_request`, `struct tegra_xudc_ep`, `struct tegra_xudc_sel_timing`, `struct tegra_xudc_setup_packet`, `struct tegra_xudc_save_regs`, `struct tegra_xudc`, `struct tegra_xudc_soc`, `enum tegra_xudc_setup_state`.
- 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.