STRUCT DWC2_CORE_PARAMS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

🌸 NAME 🌸

hii bestie πŸ’– this is the manual page for struct dwc2_core_params(9) from the Kernel API Manual, and it is literally the config blueprint for the core β€” no cap. The official name vibe is struct dwc2_core_params β€” Parameters for configuring the core. It’s giving β€œone struct to hold all the knobs” energy, and we are obsessed πŸŽ€


✨ SYNOPSIS ✨

okay so the synopsis is this entire struct, and yes every field and every #define matters, so here it is exactly β€” character for character, bestie 🫢

       struct dwc2_core_params {
           struct usb_otg_caps otg_caps;
           u8 phy_type;
         #define DWC2_PHY_TYPE_PARAM_FS          0;
         #define DWC2_PHY_TYPE_PARAM_UTMI        1;
         #define DWC2_PHY_TYPE_PARAM_ULPI        2;
           u8 speed;
         #define DWC2_SPEED_PARAM_HIGH   0;
         #define DWC2_SPEED_PARAM_FULL   1;
         #define DWC2_SPEED_PARAM_LOW    2;
           u8 phy_utmi_width;
           bool eusb2_disc;
           bool phy_ulpi_ddr;
           bool phy_ulpi_ext_vbus;
           bool enable_dynamic_fifo;
           bool en_multiple_tx_fifo;
           bool i2c_enable;
           bool acg_enable;
           bool ulpi_fs_ls;
           bool ts_dline;
           bool reload_ctl;
           bool uframe_sched;
           bool external_id_pin_ctl;
           int power_down;
         #define DWC2_POWER_DOWN_PARAM_NONE              0;
         #define DWC2_POWER_DOWN_PARAM_PARTIAL           1;
         #define DWC2_POWER_DOWN_PARAM_HIBERNATION       2;
           bool no_clock_gating;
           bool lpm;
           bool lpm_clock_gating;
           bool besl;
           bool hird_threshold_en;
           bool service_interval;
           u8 hird_threshold;
           bool activate_stm_fs_transceiver;
           bool activate_stm_id_vb_detection;
           bool activate_ingenic_overcurrent_detection;
           bool ipg_isoc_en;
           u16 max_packet_count;
           u32 max_transfer_size;
           u32 ahbcfg;
           u32 ref_clk_per;
           u16 sof_cnt_wkup_alert;
           bool host_dma;
           bool dma_desc_enable;
           bool dma_desc_fs_enable;
           bool host_support_fs_ls_low_power;
           bool host_ls_low_power_phy_clk;
           bool oc_disable;
           u8 host_channels;
           u16 host_rx_fifo_size;
           u16 host_nperio_tx_fifo_size;
           u16 host_perio_tx_fifo_size;
           bool g_dma;
           bool g_dma_desc;
           u32 g_rx_fifo_size;
           u32 g_np_tx_fifo_size;
           u32 g_tx_fifo_size[MAX_EPS_CHANNELS];
           bool change_speed_quirk;
        };

🧚 MEMBERS 🧚

okay bestie, this is the part everyone actually scrolls to β€” literally every single knob on this struct, one by one, no skipping. there are a LOT. hydrate first. πŸ“

  • otg_caps β€” tells the world what OTG stuff your hardware actually has. these are the OTG caps pulled from the platform parameters, and they're used to set up:
    • HNP and SRP capable
    • SRP Only capable
    • No HNP/SRP capable (always available) β€” defaults to the best available option
    • the OTG revision number the device is compliant with, in binary-coded decimal (so like, 2.0 is 0200H) β€” see struct usb_otg_caps
  • phy_type β€” which PHY interface to use. left unspecified, the driver will auto-detect the phy_type for you, main character energy.
    • 0 β€” Full Speed Phy
    • 1 β€” UTMI+ Phy
    • 2 β€” ULPI Phy

defaults to the best available option (2, then 1, then 0).

  • speed β€” the maximum speed of operation in host and device mode. the actual speed depends on the speed of the attached device and on the value of phy_type, so it's giving "it depends" but make it official.
    • 0 β€” High Speed (default when phy_type is UTMI+ or ULPI)
    • 1 β€” Full Speed (default when phy_type is Full Speed)
  • phy_utmi_width β€” the UTMI+ Data Width (in bits). this one is applicable for a phy_type of UTMI+ or ULPI. (for a ULPI phy_type, it indicates the data width between the MAC and the ULPI Wrapper.) also it's applicable only if the OTG_HSPHY_WIDTH cC parameter was set to "8 and 16 bits" β€” meaning the core has been configured to work at either data path width.
    • 8 or 16 (default 16 if available)
  • eusb2_disc β€” whether the eUSB2 PHY disconnect support flow is applicable or not. only applicable in device mode of HSOTG and HS IOT cores v5.00 or higher, so check your core's birth year first. πŸ‘‘
    • 0 β€” eUSB2 PHY disconnect support flow not applicable
    • 1 β€” eUSB2 PHY disconnect support flow applicable
  • phy_ulpi_ddr β€” whether the ULPI operates at double or single data rate. only applicable if phy_type is ULPI, no exceptions.
    • 0 β€” single data rate ULPI interface with 8 bit wide data bus (default)
    • 1 β€” double data rate ULPI interface with 4 bit wide data bus
  • phy_ulpi_ext_vbus β€” for a ULPI phy, whether to use the internal or external supply to drive the VBus.
    • 0 β€” Internal supply (default)
    • 1 β€” External supply
  • enable_dynamic_fifo β€” do we let the FIFOs get flexible or not.
    • 0 β€” Use coreConsultant-specified FIFO size parameters
    • 1 β€” Allow dynamic FIFO sizing (default, if available)
  • en_multiple_tx_fifo β€” specifies whether dedicated per-endpoint transmit FIFOs are enabled for non-periodic IN endpoints in device mode. that's it, that's the whole vibe.
  • i2c_enable β€” whether to use the I2C interface for a full speed PHY. only applicable if phy_type is FS.
    • 0 β€” No (default)
    • 1 β€” Yes
  • acg_enable β€” for enabling Active Clock Gating in the controller.
    • 0 β€” No
    • 1 β€” Yes
  • ulpi_fs_ls β€” make the ULPI phy operate in FS/LS mode only.
    • 0 β€” No (default)
    • 1 β€” Yes
  • ts_dline β€” enable Term Select Dline pulsing.
    • 0 β€” No (default)
    • 1 β€” Yes
  • reload_ctl β€” allow dynamic reloading of the HFIR register during runtime. yes, at runtime. iconic.
    • 0 β€” No (default for core < 2.92a)
    • 1 β€” Yes (default for core >= 2.92a)
  • uframe_sched β€” true to enable the microframe scheduler. short and sweet, love that for us.
  • external_id_pin_ctl β€” specifies whether the ID pin is handled externally. disable the CONIDSTSCHNG controller interrupt in such case, fr fr.
    • 0 β€” No (default)
    • 1 β€” Yes
  • power_down β€” whether the controller supports power_down. if it's enabled, the controller will enter power_down in both peripheral and host mode when needed.
    • 0 β€” No (default)
    • 1 β€” Partial power down
    • 2 β€” Hibernation
  • no_clock_gating β€” whether to avoid the clock gating feature.
    • 0 β€” No (use clock gating)
    • 1 β€” Yes (avoid it)
  • lpm β€” enable LPM support.
    • 0 β€” No
    • 1 β€” Yes
  • lpm_clock_gating β€” enable core PHY clock gating.
    • 0 β€” No
    • 1 β€” Yes
  • besl β€” enable LPM Errata support.
    • 0 β€” No
    • 1 β€” Yes
  • hird_threshold_en β€” HIRD or HIRD Threshold enable.
    • 0 β€” No
    • 1 β€” Yes
  • service_interval β€” enable service interval based scheduling.
    • 0 β€” No
    • 1 β€” Yes
  • hird_threshold β€” value of BESL or HIRD Threshold. literally just the value. πŸ’…
  • activate_stm_fs_transceiver β€” activate the internal transceiver using the GGPIO register.
    • 0 β€” Deactivate the transceiver (default)
    • 1 β€” Activate the transceiver
  • activate_stm_id_vb_detection β€” activate external ID pin and Vbus level detection using the GGPIO register.
    • 0 β€” Deactivate the external level detection (default)
    • 1 β€” Activate the external level detection
  • activate_ingenic_overcurrent_detection β€” activate Ingenic overcurrent detection.
    • 0 β€” Deactivate the overcurrent detection
    • 1 β€” Activate the overcurrent detection (default)
  • ipg_isoc_en β€” indicates whether the IPG supports is enabled or disabled.
    • 0 β€” Disable (default)
    • 1 β€” Enable
  • max_packet_count β€” the maximum number of packets in a transfer, 15 to 511. the actual maximum value is autodetected and is also the default, so it kinda handles itself.
  • max_transfer_size β€” the maximum transfer size supported, in bytes, 2047 to 65,535. actual maximum value is autodetected and also the default. same deal.
  • ahbcfg β€” this field lets you override the default value of the GAHBCFG register.
    • -1 β€” GAHBCFG value will be set to 0x06 (INCR, default)
    • all others β€” GAHBCFG value will be overridden with this value

not all bits can be controlled like this, bestie β€” the bits defined by GAHBCFG_CTRL_MASK are controlled by the driver and are ignored in this configuration value. don't fight the driver, you will lose.

  • ref_clk_per β€” the period of ref_clk, in pico seconds.
    • 62500 β€” 16MHz
    • 58823 β€” 17MHz
    • 52083 β€” 19.2MHz
    • 50000 β€” 20MHz
    • 41666 β€” 24MHz
    • 33333 β€” 30MHz (default)
    • 25000 β€” 40MHz
  • sof_cnt_wkup_alert β€” the number of SOF's after which the controller should generate an interrupt if the device had been in L1 state until that period. this is used by SW to initiate Remote WakeUp in the controller so as to sync to the uF number from the host. big "wake up bestie, the host is calling" energy. ⭐
  • host_dma β€” whether to use slave or DMA mode for accessing the data FIFOs. the driver will automatically detect the value for this parameter if none is specified.
    • 0 β€” Slave (always available)
    • 1 β€” DMA (default, if available)
  • dma_desc_enable β€” when DMA mode is enabled, whether to use address DMA mode or descriptor DMA mode for accessing the data FIFOs. the driver auto-detects this too if you say nothing.
    • 0 β€” Address DMA
    • 1 β€” Descriptor DMA (default, if available)
  • dma_desc_fs_enable β€” same question as above but for Full Speed mode only: address DMA or descriptor DMA for accessing the data FIFOs. auto-detected if unspecified.
    • 0 β€” Address DMA
    • 1 β€” Descriptor DMA in FS (default, if available)
  • host_support_fs_ls_low_power β€” whether low power mode is supported when attached to a Full Speed or Low Speed device in host mode.
    • 0 β€” Don't support low power mode (default)
    • 1 β€” Support low power mode
  • host_ls_low_power_phy_clk β€” the PHY clock rate in low power mode when connected to a Low Speed device in host mode. only applicable if host_support_fs_ls_low_power is enabled.
    • 0 β€” 48 MHz (default when phy_type is UTMI+ or ULPI)
    • 1 β€” 6 MHz (default when phy_type is Full Speed)
  • oc_disable β€” flag to disable the overcurrent condition.
    • 0 β€” Allow overcurrent condition to get detected
    • 1 β€” Disable overcurrent condtion to get detected
  • host_channels β€” the number of host channel registers to use, 1 to 16. actual maximum value is autodetected and also the default. yes, again.
  • host_rx_fifo_size β€” number of 4-byte words in the Rx FIFO in host mode when dynamic FIFO sizing is enabled, 16 to 32768. actual maximum value is autodetected and also the default.
  • host_nperio_tx_fifo_size β€” number of 4-byte words in the non-periodic Tx FIFO in host mode when dynamic FIFO sizing is enabled, 16 to 32768. actual maximum value is autodetected and also the default.
  • host_perio_tx_fifo_size β€” number of 4-byte words in the periodic Tx FIFO in host mode when dynamic FIFO sizing is enabled, 16 to 32768. actual maximum value is autodetected and also the default.
  • g_dma β€” enables gadget dma usage (default: autodetect).
  • g_dma_desc β€” enables gadget descriptor DMA (default: autodetect).
  • g_rx_fifo_size β€” the periodic rx fifo size for the device, in DWORDS from 16-32768 (default: 2048 if possible, otherwise autodetect).
  • g_np_tx_fifo_size β€” the non-periodic tx fifo size for the device in DWORDS from 16-32768 (default: 1024 if possible, otherwise autodetect).
  • g_tx_fifo_size β€” an array of TX fifo sizes in dedicated fifo mode. each value corresponds to one EP starting from EP1 (max 15 values). sizes are in DWORDS with possible values from 16-32768 (default: 256, 256, 256, 256, 768, 768, 768, 768, 0, 0, 0, 0, 0, 0, 0).
  • change_speed_quirk β€” change the speed configuration to DWC2_SPEED_PARAM_FULL while a full/low speed device is connected. and change the speed back to DWC2_SPEED_PARAM_HIGH while the device is gone.
    • 0 β€” No (default)
    • 1 β€” Yes

🌈 DESCRIPTION 🌈

so here's the tea: the parameters above can all be specified when starting the module, and they define how the DWC_otg controller should be configured. 🫢

and here's the safety net β€” a value of -1 (or any other out of range value) for any parameter means "read the value from hardware (if possible), or just use the builtin default described above." so if you're not sure, you can absolutely just vibe with -1 and let the hardware speak for itself. no cap.


πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./drivers/usb/dwc2/core.h
  • struct dwc2_hsotg_ep(9)
  • struct dwc2_hsotg_req(9)
  • struct dwc2_hw_params(9)
  • struct dwc2_gregs_backup(9)
  • struct dwc2_dregs_backup(9)
  • struct dwc2_hregs_backup(9)
  • struct dwc2_hsotg(9)

and that's the whole page bestie, you made it to the end πŸŽ€ this little gem lives in ./drivers/usb/dwc2, it's dated October 2026, and you're reading page 9 β€” struct dwc2_core_params(9). go forth and configure responsibly. πŸ’–βœ¨

πŸ“¦ where this page comes from