STRUCT CDNS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ struct cdns(9) β€” the Kernel API Manual glow-up πŸ¦‹

okay so bestie, welcome to the struct cdns page, aka the Representation of Cadence USB3 DRD controller πŸ’… this is a Kernel API Manual entry and honestly? it's giving "big struct energy". let's get into it ✨


🌸 NAME 🌸

struct cdns β€” Representation of Cadence USB3 DRD controller. that's it, that's the whole vibe πŸŽ€


✨ SYNOPSIS ✨

here's the whole struct, copied exactly, no cap β€” every field, every alignment, every trailing semicolon on those #defines:

struct cdns {
    struct device                   *dev;
    void __iomem                    *xhci_regs;
    struct resource                 xhci_res[CDNS_XHCI_RESOURCES_NUM];
    struct cdns3_usb_regs __iomem   *dev_regs;
    struct resource                         otg_res;
    struct cdns3_otg_legacy_regs __iomem    *otg_v0_regs;
    struct cdns3_otg_regs __iomem           *otg_v1_regs;
    struct cdnsp_otg_regs __iomem           *otg_cdnsp_regs;
    struct cdns_otg_common_regs __iomem     *otg_regs;
    struct cdns_otg_irq_regs __iomem        *otg_irq_regs;
  #define CDNS3_CONTROLLER_V0     0;
  #define CDNS3_CONTROLLER_V1     1;
  #define CDNSP_CONTROLLER_V2     2;
    u32 version;
    bool phyrst_a_enable;
    int otg_irq;
    int dev_irq;
    int wakeup_irq;
    struct cdns_role_driver *roles[USB_ROLE_DEVICE + 1];
    enum usb_role                   role;
    struct platform_device          *host_dev;
    void *gadget_dev;
    struct phy                      *usb2_phy;
    struct phy                      *usb3_phy;
    struct mutex                    mutex;
    enum usb_dr_mode                dr_mode;
    struct usb_role_switch          *role_sw;
    bool in_lpm;
    bool wakeup_pending;
    struct cdns3_platform_data      *pdata;
    spinlock_t lock;
    struct xhci_plat_priv           *xhci_plat_data;
    u32 override_apb_timeout;
    int (*gadget_init)(struct cdns *cdns);
    int (*host_init)(struct cdns *cdns);
    bool no_drd;
};

like, look at her. main character struct fr fr πŸ”₯


πŸ‘‘ Members πŸ‘‘

okay so quick heads-up before we dive in: version and phyrst_a_enable are definitely sitting up there in the struct, but this page doesn't give them their own little Members writeup β€” so we're not gonna pretend otherwise πŸ™ˆ everything else, though? we got you πŸ’–

  • dev β€” pointer to Cadence device struct. the anchor of the whole situation 🫢
  • xhci_regs β€” pointer to base of xhci registers.
  • xhci_res β€” the resource for xhci.
  • dev_regs β€” pointer to base of dev registers.
  • otg_res β€” the resource for otg.
  • otg_v0_regs β€” pointer to base of v0 otg registers.
  • otg_v1_regs β€” pointer to base of v1 otg registers.
  • otg_cdnsp_regs β€” pointer to base of CDNSP otg registers. yes, CDNSP is its own whole thing, slay 🌈
  • otg_regs β€” pointer to base of otg registers.
  • otg_irq_regs β€” pointer to interrupt registers.
  • otg_irq β€” irq number for otg controller.
  • dev_irq β€” irq number for device controller.
  • wakeup_irq β€” irq number for wakeup event, it is optional. optional bestie, don't panic if it's not there 🌸
  • roles β€” array of supported roles for this controller.
  • role β€” current role. the moment, the era, the current chapter πŸ’…
  • host_dev β€” the child host device pointer for cdns core.
  • gadget_dev β€” the child gadget device pointer.
  • usb2_phy β€” pointer to USB2 PHY.
  • usb3_phy β€” pointer to USB3 PHY. two PHYs, double the icon energy ✨
  • mutex β€” the mutex for concurrent code at driver. concurrency said "let's be civil" πŸŽ€
  • dr_mode β€” supported mode of operation it can be only Host, only Device or OTG mode that allow to switch between Device and Host mode. This field based on firmware setting, kernel configuration and hardware configuration. so like, three settings decided by three different forces, iykyk 😭
  • role_sw β€” pointer to role switch object.
  • in_lpm β€” indicate the controller is in low power mode.
  • wakeup_pending β€” wakeup interrupt pending.
  • pdata β€” platform data from glue layer.
  • lock β€” spinlock structure. spinlock is a different beast from the mutex above, do not mix them up πŸ™ˆ
  • xhci_plat_data β€” xhci private data structure pointer.
  • override_apb_timeout β€” hold value of APB timeout. For value 0 the default value in CHICKEN_BITS_3 will be preserved. yes it's literally called CHICKEN_BITS_3, and honestly? iconic name, no notes πŸ“
  • gadget_init β€” pointer to gadget initialization function.
  • host_init β€” pointer to host initialization function.
  • no_drd β€” DRD register block is inaccessible. The controller is hardwired to single role (host or device) or the logic for role switching is missing.
⚠️ okay real talk about no_drd: when this is set, that DRD register block is inaccessible β€” the controller is hardwired to a single role (host or device), or the role-switching logic just isn't there. so don't go poking registers that aren't gonna answer 😭

πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./drivers/usb/cdns3/core.h
  • struct cdns_role_driver(9) β€” go read it, bestie, it's the sequel πŸ¦‹

🌸 and that's the page!! this whole thing lives in ./drivers/usb/cdns3, and it's dated October 2026 πŸ’– bye, love u, go read your structs πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from