summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/portable/synopsys/dwc2/dcd_dwc2.c36
1 files changed, 20 insertions, 16 deletions
diff --git a/src/portable/synopsys/dwc2/dcd_dwc2.c b/src/portable/synopsys/dwc2/dcd_dwc2.c
index 2e2b050bc..b52646a5d 100644
--- a/src/portable/synopsys/dwc2/dcd_dwc2.c
+++ b/src/portable/synopsys/dwc2/dcd_dwc2.c
@@ -527,34 +527,38 @@ 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;
+ // On ESP32-P4 HS PHY, do not write to USB_WRAP register which belongs to FS PHY
+ if (rhport == 0) {
+ 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;
+ // On ESP32-P4 HS PHY, do not write to USB_WRAP register which belongs to FS PHY
+ if (rhport == 0) {
+ 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;