From 33eff72462954345d49fa07ea9e737aabcb5ff97 Mon Sep 17 00:00:00 2001 From: sakumisu <1203593632@qq.com> Date: Thu, 29 Jan 2026 14:18:22 +0800 Subject: [PATCH] fix(cherryusb): fix dwc2 host size check Signed-off-by: sakumisu <1203593632@qq.com> --- .../drivers/usb/cherryusb/port/dwc2/usb_glue_infineon.c | 3 ++- components/drivers/usb/cherryusb/port/dwc2/usb_hc_dwc2.c | 8 ++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/drivers/usb/cherryusb/port/dwc2/usb_glue_infineon.c b/components/drivers/usb/cherryusb/port/dwc2/usb_glue_infineon.c index c0956674c7d..485b36c269e 100644 --- a/components/drivers/usb/cherryusb/port/dwc2/usb_glue_infineon.c +++ b/components/drivers/usb/cherryusb/port/dwc2/usb_glue_infineon.c @@ -13,8 +13,9 @@ #if defined (COMPONENT_CM55) #if !defined(CONFIG_USB_DCACHE_ENABLE) -#error "Please enable CONFIG_USB_DCACHE_ENABLE and put USB_NOCACHE_RAM_SECTION to section ".cy_socmem_data" when using DMA" +#error "Please enable CONFIG_USB_DCACHE_ENABLE and put USB_NOCACHE_RAM_SECTION to section ".cy_socmem_data" for CM55" #endif + #else #define CONFIG_USB_DWC2_DMA_ENABLE #endif diff --git a/components/drivers/usb/cherryusb/port/dwc2/usb_hc_dwc2.c b/components/drivers/usb/cherryusb/port/dwc2/usb_hc_dwc2.c index bf0adae5719..92a7f3e0270 100644 --- a/components/drivers/usb/cherryusb/port/dwc2/usb_hc_dwc2.c +++ b/components/drivers/usb/cherryusb/port/dwc2/usb_hc_dwc2.c @@ -717,10 +717,10 @@ int usb_hc_init(struct usbh_bus *bus) USB_ASSERT_MSG((USB_OTG_GLB->GRXFSIZ & 0xffff) >= g_dwc2_hcd[bus->hcd.hcd_id].user_params.host_rx_fifo_size, "host_rx_fifo_size cannot be larger than power_on_value %u", (unsigned int)(USB_OTG_GLB->GRXFSIZ & 0xffff)); - USB_ASSERT_MSG((USB_OTG_GLB->DIEPTXF0_HNPTXFSIZ & 0xffff) >= g_dwc2_hcd[bus->hcd.hcd_id].user_params.host_nperio_tx_fifo_size, - "host_nperio_tx_fifo_size cannot be larger than power_on_value %u", (unsigned int)(USB_OTG_GLB->DIEPTXF0_HNPTXFSIZ & 0xffff)); - USB_ASSERT_MSG((USB_OTG_GLB->HPTXFSIZ & 0xffff) >= g_dwc2_hcd[bus->hcd.hcd_id].user_params.host_perio_tx_fifo_size, - "host_perio_tx_fifo_size cannot be larger than power_on_value %u", (unsigned int)(USB_OTG_GLB->HPTXFSIZ & 0xffff)); + USB_ASSERT_MSG(((USB_OTG_GLB->DIEPTXF0_HNPTXFSIZ >> 16) & 0xffff) >= g_dwc2_hcd[bus->hcd.hcd_id].user_params.host_nperio_tx_fifo_size, + "host_nperio_tx_fifo_size cannot be larger than power_on_value %u", (unsigned int)((USB_OTG_GLB->DIEPTXF0_HNPTXFSIZ >> 16) & 0xffff)); + USB_ASSERT_MSG(((USB_OTG_GLB->HPTXFSIZ >> 16) & 0xffff) >= g_dwc2_hcd[bus->hcd.hcd_id].user_params.host_perio_tx_fifo_size, + "host_perio_tx_fifo_size cannot be larger than power_on_value %u", (unsigned int)((USB_OTG_GLB->HPTXFSIZ >> 16) & 0xffff)); /* B-peripheral session valid override enable */ USB_OTG_GLB->GOTGCTL &= ~USB_OTG_GOTGCTL_BVALOEN;