drivers/usb/gadget/udc/m66592-udc.c
Source file repositories/reference/linux-study-clean/drivers/usb/gadget/udc/m66592-udc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/gadget/udc/m66592-udc.c- Extension
.c- Size
- 42100 bytes
- Lines
- 1698
- 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/interrupt.hlinux/delay.hlinux/io.hlinux/platform_device.hlinux/slab.hlinux/err.hlinux/usb/ch9.hlinux/usb/gadget.hm66592-udc.h
Detected Declarations
function get_usb_speedfunction enable_pipe_irqfunction disable_pipe_irqfunction m66592_usb_connectfunction m66592_usb_disconnectfunction control_reg_get_pidfunction control_reg_set_pidfunction pipe_startfunction pipe_stopfunction pipe_stallfunction control_reg_getfunction control_reg_sqclrfunction get_buffer_sizefunction pipe_changefunction pipe_buffer_settingfunction pipe_buffer_releasefunction pipe_initializefunction m66592_ep_settingfunction m66592_ep_releasefunction alloc_pipe_configfunction free_pipe_configfunction pipe_irq_enablefunction pipe_irq_disablefunction control_endfunction start_ep0_writefunction start_packet_writefunction start_packet_readfunction start_packetfunction start_ep0function init_controllerfunction disable_controllerfunction m66592_start_xclockfunction transfer_completefunction irq_ep0_writefunction irq_packet_writefunction irq_packet_readfunction irq_pipe_readyfunction irq_pipe_emptyfunction get_statusfunction clear_featurefunction set_featurefunction setup_packetfunction m66592_update_usb_speedfunction irq_device_statefunction irq_control_stagefunction m66592_irqfunction m66592_timerfunction m66592_enable
Annotated Snippet
else if (pipenum < M66592_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
pid = m66592_read(m66592, offset) & M66592_PID;
} else
pr_err("unexpect pipe num (%d)\n", pipenum);
return pid;
}
static inline void control_reg_set_pid(struct m66592 *m66592, u16 pipenum,
u16 pid)
{
unsigned long offset;
if (pipenum == 0)
m66592_mdfy(m66592, pid, M66592_PID, M66592_DCPCTR);
else if (pipenum < M66592_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
m66592_mdfy(m66592, pid, M66592_PID, offset);
} else
pr_err("unexpect pipe num (%d)\n", pipenum);
}
static inline void pipe_start(struct m66592 *m66592, u16 pipenum)
{
control_reg_set_pid(m66592, pipenum, M66592_PID_BUF);
}
static inline void pipe_stop(struct m66592 *m66592, u16 pipenum)
{
control_reg_set_pid(m66592, pipenum, M66592_PID_NAK);
}
static inline void pipe_stall(struct m66592 *m66592, u16 pipenum)
{
control_reg_set_pid(m66592, pipenum, M66592_PID_STALL);
}
static inline u16 control_reg_get(struct m66592 *m66592, u16 pipenum)
{
u16 ret = 0;
unsigned long offset;
if (pipenum == 0)
ret = m66592_read(m66592, M66592_DCPCTR);
else if (pipenum < M66592_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
ret = m66592_read(m66592, offset);
} else
pr_err("unexpect pipe num (%d)\n", pipenum);
return ret;
}
static inline void control_reg_sqclr(struct m66592 *m66592, u16 pipenum)
{
unsigned long offset;
pipe_stop(m66592, pipenum);
if (pipenum == 0)
m66592_bset(m66592, M66592_SQCLR, M66592_DCPCTR);
else if (pipenum < M66592_MAX_NUM_PIPE) {
offset = get_pipectr_addr(pipenum);
m66592_bset(m66592, M66592_SQCLR, offset);
} else
pr_err("unexpect pipe num(%d)\n", pipenum);
}
static inline int get_buffer_size(struct m66592 *m66592, u16 pipenum)
{
u16 tmp;
int size;
if (pipenum == 0) {
tmp = m66592_read(m66592, M66592_DCPCFG);
if ((tmp & M66592_CNTMD) != 0)
size = 256;
else {
tmp = m66592_read(m66592, M66592_DCPMAXP);
size = tmp & M66592_MAXP;
}
} else {
m66592_write(m66592, pipenum, M66592_PIPESEL);
tmp = m66592_read(m66592, M66592_PIPECFG);
if ((tmp & M66592_CNTMD) != 0) {
tmp = m66592_read(m66592, M66592_PIPEBUF);
size = ((tmp >> 10) + 1) * 64;
} else {
tmp = m66592_read(m66592, M66592_PIPEMAXP);
Annotation
- Immediate include surface: `linux/module.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/io.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/err.h`, `linux/usb/ch9.h`.
- Detected declarations: `function get_usb_speed`, `function enable_pipe_irq`, `function disable_pipe_irq`, `function m66592_usb_connect`, `function m66592_usb_disconnect`, `function control_reg_get_pid`, `function control_reg_set_pid`, `function pipe_start`, `function pipe_stop`, `function pipe_stall`.
- 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.