STRUCT CDNSP_DEVICE(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’ซ NAME ๐Ÿ’ซ

okay so this is the struct cdnsp_device(9) page from the Kernel API Manual, bestie โ€” and itโ€™s literally the whole USB device vibe in one struct.

struct cdnsp_device โ€” represent USB device. periodt ๐Ÿ’…

๐ŸŒธ SYNOPSIS ๐ŸŒธ

       struct cdnsp_device {
           struct device *dev;
           struct usb_gadget gadget;
           struct usb_gadget_driver *gadget_driver;
           unsigned int irq;
           void __iomem *regs;
           struct cdnsp_cap_regs __iomem *cap_regs;
           struct cdnsp_op_regs __iomem *op_regs;
           struct cdnsp_run_regs __iomem *run_regs;
           struct cdnsp_doorbell_array __iomem *dba;
           struct cdnsp_intr_reg __iomem *ir_set;
           struct cdnsp_20port_cap __iomem *port20_regs;
           struct cdnsp_3xport_cap __iomem *port3x_regs;
           struct cdnsp_rev_cap __iomem *rev_cap;
           __u32 hcs_params1;
           __u32 hcs_params3;
           __u32 hcc_params;
         #define RTL_REVISION_NEW_LPM 0x2700;
           __u32 rtl_revision;
           spinlock_t lock;
           struct usb_ctrlrequest setup;
           struct cdnsp_request ep0_preq;
           enum cdnsp_ep0_stage ep0_stage;
           u8 three_stage_setup;
           u8 ep0_expect_in;
           u8 setup_id;
           u8 setup_speed;
           void *setup_buf;
           u8 device_address;
           int may_wakeup;
           u16 hci_version;
           struct cdnsp_device_context_array *dcbaa;
           struct cdnsp_ring *cmd_ring;
           struct cdnsp_command cmd;
           struct cdnsp_ring *event_ring;
           struct cdnsp_erst erst;
           int slot_id;
           struct cdnsp_container_ctx out_ctx;
           struct cdnsp_container_ctx in_ctx;
           struct cdnsp_ep eps[CDNSP_ENDPOINTS_NUM];
           u8 usb2_hw_lpm_capable:1;
           u8 u1_allowed:1;
           u8 u2_allowed:1;
           struct dma_pool *device_pool;
           struct dma_pool *segment_pool;
         #define CDNSP_STATE_HALTED              BIT(1);
         #define CDNSP_STATE_DYING               BIT(2);
         #define CDNSP_STATE_DISCONNECT_PENDING  BIT(3);
         #define CDNSP_WAKEUP_PENDING            BIT(4);
           unsigned int cdnsp_state;
           unsigned int link_state;
           struct cdnsp_port usb2_port;
           struct cdnsp_port eusb_port;
           struct cdnsp_port usb3_port;
           struct cdnsp_port *active_port;
           u16 test_mode;
        };
no cap, this is a big struct โ€” but every field is a little puzzle piece and weโ€™re gonna go through all of them ๐Ÿ’–

โœจ Members โœจ

  • dev โ€” pointer to the device structure associated with this controller.
  • gadget โ€” device side representation of the peripheral controller.
  • gadget_driver โ€” pointer to the gadget driver.
  • irq โ€” IRQ line number used by device side.
  • regs โ€” IO device memory.
  • cap_regs โ€” capability registers.
  • op_regs โ€” operational registers.
  • run_regs โ€” runtime registers.
  • dba โ€” device base address register.
  • ir_set โ€” current interrupter register set.
  • port20_regs โ€” Port 2.0 Peripheral Configuration Registers.
  • port3x_regs โ€” USB3.x Port Peripheral Configuration Registers.
  • rev_cap โ€” Controller Capabilities Registers.
  • hcs_params1 โ€” cached register copies of read-only HCSPARAMS1.
  • hcc_params โ€” cached register copies of read-only HCCPARAMS1.
  • rtl_revision โ€” cached controller rtl revision.
  • lock โ€” lock used in interrupt thread context.
  • setup โ€” temporary buffer for setup packet.
  • ep0_preq โ€” internal allocated request used during enumeration.
  • ep0_stage โ€” ep0 stage during enumeration process.
  • three_stage_setup โ€” three state or two state setup.
  • ep0_expect_in โ€” data IN expected for control transfer.
  • setup_id โ€” setup identifier. setup_speed โ€” speed detected for current SETUP packet.
  • setup_buf โ€” buffer for SETUP packet.
  • device_address โ€” current device address.
  • may_wakeup โ€” remote wakeup enabled/disabled.
  • hci_version โ€” device controller version.
  • dcbaa โ€” Device context base address array.
  • cmd_ring โ€” Command ring.
  • cmd โ€” represent all what is needed to issue command on Command Ring.
  • event_ring โ€” Event ring.
  • erst โ€” Event Ring Segment table.
  • slot_id โ€” current Slot ID. Should be 0 or 1.
  • out_ctx โ€” output context.
  • in_ctx โ€” input context.
  • eps โ€” array of endpoints object associated with device.
  • usb2_hw_lpm_capable โ€” hardware lpm is enabled; ๐Ÿ‘€
  • u1_allowed โ€” allow device transition to U1 state.
  • u2_allowed โ€” allow device transition to U2 state.
  • device_pool โ€” DMA pool for allocating input and output context.
  • segment_pool โ€” DMA pool for allocating new segments.
  • cdnsp_state โ€” current state of controller.
  • link_state โ€” current link state. usb2_port โ€” Port USB 2.0. usb3_port โ€” Port USB 3.0. active_port โ€” current selected Port.
  • test_mode โ€” selected Test Mode.

๐Ÿ”ฎ SEE ALSO ๐Ÿ”ฎ

Kernel file ./drivers/usb/cdns3/cdnsp-gadget.h has the whole squad, bestie:

  • struct cdnsp_cap_regs(9)
  • struct cdnsp_op_regs(9)
  • struct cdnsp_port_regs(9)
  • struct cdnsp_intr_reg(9)
  • struct cdnsp_run_regs(9)
  • struct cdnsp_rev_cap(9)
  • struct cdnsp_doorbell_array(9)
  • struct cdnsp_container_ctx(9)
  • struct cdnsp_slot_ctx(9)
  • struct cdnsp_ep_ctx(9)
  • struct cdnsp_stream_info(9)
  • struct cdnsp_ep(9)
  • struct cdnsp_device_context_array(9)
  • struct cdnsp_transfer_event(9)
  • struct cdnsp_link_trb(9)
  • struct cdnsp_event_cmd(9)
  • struct cdnsp_segment(9)
  • struct cdnsp_td(9)
  • struct cdnsp_dequeue_state(9)
  • struct cdnsp_ring(9)
  • struct cdnsp_erst_entry(9)
  • struct cdnsp_erst(9)
  • struct cdnsp_request(9)
  • struct cdnsp_port(9)
  • next_request(9)

and thatโ€™s the whole page, bestie ๐Ÿซถ source vibe is ./drivers/usb/cdns3, dated October 2026 โ€” mwah ๐Ÿ’‹โœจ

๐Ÿ“ฆ where this page comes from