STRUCT CDNS(9)
π¦ 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 themutexabove, do not mix them up πxhci_plat_dataβ xhci private data structure pointer.override_apb_timeoutβ hold value of APB timeout. For value0the 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
- 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