@@ -89,49 +89,19 @@ void tud_cdc_rx_cb(uint8_t itf) {
8989}
9090#endif // CIRCUITPY_USB_DEVICE
9191
92-
93- #if defined(CONFIG_IDF_TARGET_ESP32S3 )
94- // TEMPORARY WORKAROUND for https://github.com/hathach/tinyusb/issues/2943
95- #include "soc/rtc_cntl_struct.h"
96- #include "soc/usb_wrap_struct.h"
97- #endif
98-
9992void init_usb_hardware (void ) {
10093 #if CIRCUITPY_USB_DEVICE
10194 // Configure USB PHY
102-
103- // TEMPORARY WORKAROUND for https://github.com/hathach/tinyusb/issues/2943
104- #if defined(CONFIG_IDF_TARGET_ESP32S3 )
105-
106- (void )phy_hdl ;
107- periph_module_reset (PERIPH_USB_MODULE );
108- periph_module_enable (PERIPH_USB_MODULE );
109-
110- USB_WRAP .otg_conf .pad_enable = 1 ;
111- // USB_OTG use internal PHY
112- USB_WRAP .otg_conf .phy_sel = 0 ;
113- // phy_sel is controlled by the following register value
114- RTCCNTL .usb_conf .sw_hw_usb_phy_sel = 1 ;
115- // phy_sel=sw_usb_phy_sel=1, USB_OTG is connected with internal PHY
116- RTCCNTL .usb_conf .sw_usb_phy_sel = 1 ;
117-
118- gpio_set_drive_capability (USBPHY_DM_NUM , GPIO_DRIVE_CAP_3 );
119- gpio_set_drive_capability (USBPHY_DP_NUM , GPIO_DRIVE_CAP_3 );
120- #else
121-
12295 usb_phy_config_t phy_conf = {
12396 .controller = USB_PHY_CTRL_OTG ,
12497 .target = USB_PHY_TARGET_INT ,
12598
12699 .otg_mode = USB_OTG_MODE_DEVICE ,
127- #ifdef CONFIG_IDF_TARGET_ESP32P4
128- .otg_speed = USB_PHY_SPEED_HIGH ,
129- #else
130- .otg_speed = USB_PHY_SPEED_FULL ,
131- #endif
100+ // https://github.com/hathach/tinyusb/issues/2943#issuecomment-2601888322
101+ // Set speed to undefined (auto-detect) to avoid timing/race issue with S3 with host such as macOS
102+ .otg_speed = USB_PHY_SPEED_UNDEFINED ,
132103 };
133104 usb_new_phy (& phy_conf , & phy_hdl );
134- #endif
135105
136106 // Pin the USB task to the same core as CircuitPython. This way we leave
137107 // the other core for networking.
0 commit comments