STRUCT DWC2_CORE_PARAMS(9)
πΈ 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) β seestruct usb_otg_caps
phy_typeβ which PHY interface to use. left unspecified, the driver will auto-detect thephy_typefor you, main character energy.0β Full Speed Phy1β UTMI+ Phy2β 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 ofphy_type, so it's giving "it depends" but make it official.0β High Speed (default whenphy_typeis UTMI+ or ULPI)1β Full Speed (default whenphy_typeis Full Speed)
phy_utmi_widthβ the UTMI+ Data Width (in bits). this one is applicable for aphy_typeof UTMI+ or ULPI. (for a ULPIphy_type, it indicates the data width between the MAC and the ULPI Wrapper.) also it's applicable only if theOTG_HSPHY_WIDTHcC parameter was set to "8 and 16 bits" β meaning the core has been configured to work at either data path width.8or16(default16if 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 applicable1β eUSB2 PHY disconnect support flow applicable
phy_ulpi_ddrβ whether the ULPI operates at double or single data rate. only applicable ifphy_typeis 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 parameters1β 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 ifphy_typeis FS.0β No (default)1β Yes
acg_enableβ for enabling Active Clock Gating in the controller.0β No1β 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 theCONIDSTSCHNGcontroller interrupt in such case, fr fr.0β No (default)1β Yes
power_downβ whether the controller supportspower_down. if it's enabled, the controller will enterpower_downin both peripheral and host mode when needed.0β No (default)1β Partial power down2β 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β No1β Yes
lpm_clock_gatingβ enable core PHY clock gating.0β No1β Yes
beslβ enable LPM Errata support.0β No1β Yes
hird_threshold_enβ HIRD or HIRD Threshold enable.0β No1β Yes
service_intervalβ enable service interval based scheduling.0β No1β 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 detection1β 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,15to511. 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,2047to65,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 to0x06(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 ofref_clk, in pico seconds.62500β 16MHz58823β 17MHz52083β 19.2MHz50000β 20MHz41666β 24MHz33333β 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 DMA1β 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 DMA1β 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 ifhost_support_fs_ls_low_poweris enabled.0β 48 MHz (default whenphy_typeis UTMI+ or ULPI)1β 6 MHz (default whenphy_typeis Full Speed)
oc_disableβ flag to disable the overcurrent condition.0β Allow overcurrent condition to get detected1β Disable overcurrent condtion to get detected
host_channelsβ the number of host channel registers to use,1to16. 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,16to32768. 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,16to32768. 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,16to32768. 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 from16-32768(default:2048if possible, otherwise autodetect).g_np_tx_fifo_sizeβ the non-periodic tx fifo size for the device in DWORDS from16-32768(default:1024if 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 from16-32768(default:256, 256, 256, 256, 768, 768, 768, 768, 0, 0, 0, 0, 0, 0, 0).change_speed_quirkβ change the speed configuration toDWC2_SPEED_PARAM_FULLwhile a full/low speed device is connected. and change the speed back toDWC2_SPEED_PARAM_HIGHwhile 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
- 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