STRUCT MUSB_PLATFORM_OPS(9)
struct musb_platform_ops(9) π
okay so this is the Kernel API Manual page for struct musb_platform_ops, and bestie, it's literally the handshake between the MUSB core and whatever hardware glue layer you're dealing with. Think of it as the group chat where musb_core and your platform-specific code agree on how things get done. π«Ά
β¨ NAME β¨
struct musb_platform_ops β Operations passed to musb_core by the HW glue layer. that's the whole vibe. the core gets handed this struct and goes "cool, this is how I talk to your weird little hardware." π
πΈ SYNOPSIS πΈ
struct musb_platform_ops {
#define MUSB_G_NO_SKB_RESERVE BIT(9);
#define MUSB_DA8XX BIT(8);
#define MUSB_PRESERVE_SESSION BIT(7);
#define MUSB_DMA_UX500 BIT(6);
#define MUSB_DMA_CPPI41 BIT(5);
#define MUSB_DMA_CPPI BIT(4);
#define MUSB_DMA_TUSB_OMAP BIT(3);
#define MUSB_DMA_INVENTRA BIT(2);
#define MUSB_IN_TUSB BIT(1);
#define MUSB_INDEXED_EP BIT(0);
u32 quirks;
int (*init)(struct musb *musb);
int (*exit)(struct musb *musb);
void (*enable)(struct musb *musb);
void (*disable)(struct musb *musb);
u32 (*ep_offset)(u8 epnum, u16 offset);
void (*ep_select)(void __iomem *mbase, u8 epnum);
u16 fifo_mode;
u32 (*fifo_offset)(u8 epnum);
u32 (*busctl_offset)(u8 epnum, u16 offset);
u8 (*readb)(void __iomem *addr, u32 offset);
void (*writeb)(void __iomem *addr, u32 offset, u8 data);
u8 (*clearb)(void __iomem *addr, u32 offset);
u16 (*readw)(void __iomem *addr, u32 offset);
void (*writew)(void __iomem *addr, u32 offset, u16 data);
u16 (*clearw)(void __iomem *addr, u32 offset);
void (*read_fifo)(struct musb_hw_ep *hw_ep, u16 len, u8 *buf);
void (*write_fifo)(struct musb_hw_ep *hw_ep, u16 len, const u8 *buf);
u16 (*get_toggle)(struct musb_qh *qh, int is_out);
u16 (*set_toggle)(struct musb_qh *qh, int is_out, struct urb *urb);
struct dma_controller * (*dma_init) (struct musb *musb, void __iomem *base);
void (*dma_exit)(struct dma_controller *c);
int (*set_mode)(struct musb *musb, u8 mode);
void (*try_idle)(struct musb *musb, unsigned long timeout);
int (*recover)(struct musb *musb);
int (*vbus_status)(struct musb *musb);
void (*set_vbus)(struct musb *musb, int on);
void (*pre_root_reset_end)(struct musb *musb);
void (*post_root_reset_end)(struct musb *musb);
int (*phy_callback)(enum musb_vbus_id_status status);
void (*clear_ep_rxintr)(struct musb *musb, int epnum);
};
like, that's a lot of function pointers, and every single one is about to get explained. buckle up. π
π Members π
okay so these are all the members, and I'm giving you the tea on each one, in order, no skipping:
quirksβ flags for platform specific quirks. yes, the field is literally called "quirks." iconic. π₯initβ turns on clocks, sets up platform-specific registers, etc. the "wake up babe we're going in" function.exitβ undoesinit. the "ok we're done here, put it all back" function. π¦enableβ enable device.disableβ disable device. (they're a matching set, your honor.)ep_offsetβ returns the end point offset.ep_selectβ selects the specified end point.fifo_modeβ sets the fifo mode.fifo_offsetβ returns the fifo offset. no cap, it does exactly what it says.busctl_offsetβ ngl, this one is in the struct but the original page doesn't describe it. mystery member energy π it's betweenfifo_offsetandreadband that's all we're told.readbβ read 8 bits.writebβ write 8 bits.clearbβ could be clear-on-readb or W1C.readwβ read 16 bits.writewβ write 16 bits.clearwβ could be clear-on-readw or W1C. (notice the pattern? yes, the b/w pair does the same thing at different widths. slay.)read_fifoβ reads the fifo.write_fifoβ writes to fifo.get_toggleβ platform specific get toggle function.set_toggleβ platform specific set toggle function.dma_initβ platform specific dma init function.dma_exitβ platform specific dma exit function.set_modeβ forcefully changes operating mode. forcefully, bestie. it's not asking. πtry_idleβ tries to idle the IP. "tries" is doing a lot of work in that sentence, but that's what it says.recoverβ platform-specific babble recovery. babble!! as in the USB babble condition. this is the "ok calm down" function. πvbus_statusβ returns vbus status if possible. if possible. conditional queen.set_vbusβ forces vbus status.pre_root_reset_endβ called before the root usb port reset flag gets cleared.post_root_reset_endβ called after the root usb port reset flag gets cleared. (before/after duo, we love a matched pair π«Ά)phy_callbackβ optional callback function for the phy to call. optional! so if you don't need it, don't stress.clear_ep_rxintrβ this one's also in the struct with no description on this page. another mystery member, but at least the name is self-explanatory-ish. π
π SEE ALSO π
- Kernel file
./drivers/usb/musb/musb_core.hβ go read it, it's the whole context, iykyk π
and that's the page, bestie! this one came out of ./drivers/usb/musb and it's dated October 2026, so mark your calendar ποΈβ¨ go forth and implement your platform ops, you're gonna ate π
π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms