fix(usb/hal/dwc): Correct host channel number calculation

The hardware field `ghwcfg2.numhstchnl` is zero-based, meaning the actual
number of available host channels is `numhstchnl + 1`. This off-by-one
error caused the USB Host controller to report N-1 channels instead of N,
leading to premature "No more HCD channels available" errors when
connecting multiple devices.

This issue affects ESP32-S2, ESP32-S3, and ESP32-P4.
This commit is contained in:
igor.masar
2025-02-20 13:41:34 +01:00
committed by BOT
parent 26ffbce8c2
commit c9c0e8b63e
3 changed files with 3 additions and 3 deletions

View File

@ -362,7 +362,7 @@ static inline unsigned usb_dwc_ll_ghwcfg_get_hsphy_type(usb_dwc_dev_t *hw)
static inline unsigned usb_dwc_ll_ghwcfg_get_channel_num(usb_dwc_dev_t *hw)
{
return hw->ghwcfg2_reg.numhstchnl;
return hw->ghwcfg2_reg.numhstchnl + 1;
}
// --------------------------- HPTXFSIZ Register -------------------------------

View File

@ -361,7 +361,7 @@ static inline unsigned usb_dwc_ll_ghwcfg_get_hsphy_type(usb_dwc_dev_t *hw)
static inline unsigned usb_dwc_ll_ghwcfg_get_channel_num(usb_dwc_dev_t *hw)
{
return hw->ghwcfg2_reg.numhstchnl;
return hw->ghwcfg2_reg.numhstchnl + 1;
}
// --------------------------- HPTXFSIZ Register -------------------------------

View File

@ -361,7 +361,7 @@ static inline unsigned usb_dwc_ll_ghwcfg_get_hsphy_type(usb_dwc_dev_t *hw)
static inline unsigned usb_dwc_ll_ghwcfg_get_channel_num(usb_dwc_dev_t *hw)
{
return hw->ghwcfg2_reg.numhstchnl;
return hw->ghwcfg2_reg.numhstchnl + 1;
}
// --------------------------- HPTXFSIZ Register -------------------------------