@@ -89,49 +89,19 @@ void tud_cdc_rx_cb(uint8_t itf) {
89
89
}
90
90
#endif // CIRCUITPY_USB_DEVICE
91
91
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
-
99
92
void init_usb_hardware (void ) {
100
93
#if CIRCUITPY_USB_DEVICE
101
94
// 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
-
122
95
usb_phy_config_t phy_conf = {
123
96
.controller = USB_PHY_CTRL_OTG ,
124
97
.target = USB_PHY_TARGET_INT ,
125
98
126
99
.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 ,
132
103
};
133
104
usb_new_phy (& phy_conf , & phy_hdl );
134
- #endif
135
105
136
106
// Pin the USB task to the same core as CircuitPython. This way we leave
137
107
// the other core for networking.
0 commit comments