drivers/usb/mtu3/mtu3.h
Source file repositories/reference/linux-study-clean/drivers/usb/mtu3/mtu3.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/mtu3/mtu3.h- Extension
.h- Size
- 13231 bytes
- Lines
- 450
- 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.
- 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/clk.hlinux/device.hlinux/dmapool.hlinux/extcon.hlinux/interrupt.hlinux/list.hlinux/of.hlinux/phy/phy.hlinux/regulator/consumer.hlinux/usb.hlinux/usb/ch9.hlinux/usb/gadget.hlinux/usb/otg.hlinux/usb/role.hmtu3_hw_regs.hmtu3_qmu.h
Detected Declarations
struct mtu3struct mtu3_epstruct mtu3_requeststruct mtu3_fifo_infostruct qmu_gpdstruct mtu3_gpd_ringstruct otg_switch_mtkstruct ssusb_mtkstruct mtu3_epstruct mtu3_requeststruct mtu3enum mtu3_speedenum mtu3_g_ep0_stateenum mtu3_dr_force_modefunction mtu3_writelfunction mtu3_readlfunction mtu3_setbitsfunction mtu3_clrbits
Annotated Snippet
struct mtu3_fifo_info {
u32 base;
u32 limit;
DECLARE_BITMAP(bitmap, MTU3_FIFO_BIT_SIZE);
};
/**
* struct qmu_gpd - General Purpose Descriptor (GPD):
* The format of TX GPD is a little different from RX one.
* And the size of GPD is 16 bytes.
*
* @dw0_info:
* bit0: Hardware Own (HWO)
* bit1: Buffer Descriptor Present (BDP), always 0, BD is not supported
* bit2: Bypass (BPS), 1: HW skips this GPD if HWO = 1
* bit6: [EL] Zero Length Packet (ZLP), moved from @dw3_info[29]
* bit7: Interrupt On Completion (IOC)
* bit[31:16]: ([EL] bit[31:12]) allow data buffer length (RX ONLY),
* the buffer length of the data to receive
* bit[23:16]: ([EL] bit[31:24]) extension address (TX ONLY),
* lower 4 bits are extension bits of @buffer,
* upper 4 bits are extension bits of @next_gpd
* @next_gpd: Physical address of the next GPD
* @buffer: Physical address of the data buffer
* @dw3_info:
* bit[15:0]: ([EL] bit[19:0]) data buffer length,
* (TX): the buffer length of the data to transmit
* (RX): The total length of data received
* bit[23:16]: ([EL] bit[31:24]) extension address (RX ONLY),
* lower 4 bits are extension bits of @buffer,
* upper 4 bits are extension bits of @next_gpd
* bit29: ([EL] abandoned) Zero Length Packet (ZLP) (TX ONLY)
*/
struct qmu_gpd {
__le32 dw0_info;
__le32 next_gpd;
__le32 buffer;
__le32 dw3_info;
} __packed;
/**
* struct mtu3_gpd_ring - GPD ring descriptor
* @dma: physical base address of GPD segment
* @start: virtual base address of GPD segment
* @end: the last GPD element
* @enqueue: the first empty GPD to use
* @dequeue: the first completed GPD serviced by ISR
*
* NOTE: the size of GPD ring should be >= 2
*/
struct mtu3_gpd_ring {
dma_addr_t dma;
struct qmu_gpd *start;
struct qmu_gpd *end;
struct qmu_gpd *enqueue;
struct qmu_gpd *dequeue;
};
/**
* struct otg_switch_mtk - OTG/dual-role switch management
* @vbus: vbus 5V used by host mode
* @edev: external connector used to detect vbus and iddig changes
* @id_nb : notifier for iddig(idpin) detection
* @dr_work : work for drd mode switch, used to avoid sleep in atomic context
* @desired_role : role desired to switch
* @default_role : default mode while usb role is USB_ROLE_NONE
* @role_sw : use USB Role Switch to support dual-role switch, can't use
* extcon at the same time, and extcon is deprecated.
* @role_sw_used : true when the USB Role Switch is used.
* @is_u3_drd: whether port0 supports usb3.0 dual-role device or not
* @manual_drd_enabled: it's true when supports dual-role device by debugfs
* to switch host/device modes depending on user input.
*/
struct otg_switch_mtk {
struct regulator *vbus;
struct extcon_dev *edev;
struct notifier_block id_nb;
struct work_struct dr_work;
enum usb_role desired_role;
enum usb_role default_role;
struct usb_role_switch *role_sw;
bool role_sw_used;
bool is_u3_drd;
bool manual_drd_enabled;
};
/**
* struct ssusb_mtk - SuperSpeed USB descriptor (MTK)
* @mac_base: register base address of device MAC, exclude xHCI's
* @ippc_base: register base address of IP Power and Clock interface (IPPC)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/dmapool.h`, `linux/extcon.h`, `linux/interrupt.h`, `linux/list.h`, `linux/of.h`, `linux/phy/phy.h`.
- Detected declarations: `struct mtu3`, `struct mtu3_ep`, `struct mtu3_request`, `struct mtu3_fifo_info`, `struct qmu_gpd`, `struct mtu3_gpd_ring`, `struct otg_switch_mtk`, `struct ssusb_mtk`, `struct mtu3_ep`, `struct mtu3_request`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- 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.