dwc2: for esp32 force disconnect/connect using USB_WRAP otg pad override (DM=DP=0) in addition to dwc2's dctrl
This commit is contained in:
@@ -43,7 +43,7 @@
|
||||
|
||||
#if defined(TUP_USBIP_DWC2_STM32)
|
||||
#include "dwc2_stm32.h"
|
||||
#elif TU_CHECK_MCU(OPT_MCU_ESP32S2, OPT_MCU_ESP32S3)
|
||||
#elif defined(TUP_USBIP_DWC2_ESP32)
|
||||
#include "dwc2_esp32.h"
|
||||
#elif TU_CHECK_MCU(OPT_MCU_GD32VF103)
|
||||
#include "dwc2_gd32.h"
|
||||
@@ -667,12 +667,34 @@ void dcd_remote_wakeup(uint8_t rhport) {
|
||||
void dcd_connect(uint8_t rhport) {
|
||||
(void) rhport;
|
||||
dwc2_regs_t* dwc2 = DWC2_REG(rhport);
|
||||
|
||||
#ifdef TUP_USBIP_DWC2_ESP32
|
||||
usb_wrap_otg_conf_reg_t conf = USB_WRAP.otg_conf;
|
||||
conf.pad_pull_override = 0;
|
||||
conf.dp_pullup = 0;
|
||||
conf.dp_pulldown = 0;
|
||||
conf.dm_pullup = 0;
|
||||
conf.dm_pulldown = 0;
|
||||
USB_WRAP.otg_conf = conf;
|
||||
#endif
|
||||
|
||||
dwc2->dctl &= ~DCTL_SDIS;
|
||||
}
|
||||
|
||||
void dcd_disconnect(uint8_t rhport) {
|
||||
(void) rhport;
|
||||
dwc2_regs_t* dwc2 = DWC2_REG(rhport);
|
||||
|
||||
#ifdef TUP_USBIP_DWC2_ESP32
|
||||
usb_wrap_otg_conf_reg_t conf = USB_WRAP.otg_conf;
|
||||
conf.pad_pull_override = 1;
|
||||
conf.dp_pullup = 0;
|
||||
conf.dp_pulldown = 1;
|
||||
conf.dm_pullup = 0;
|
||||
conf.dm_pulldown = 1;
|
||||
USB_WRAP.otg_conf = conf;
|
||||
#endif
|
||||
|
||||
dwc2->dctl |= DCTL_SDIS;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user