summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2026-03-02 22:20:44 +0700
committerGitHub <[email protected]>2026-03-02 22:20:44 +0700
commita8a4db3721cccd32c8e998a7aa816719294d7a66 (patch)
tree1d146b02685bfb4493dc6ef5c67c2109140aa91a
parentbf76bb88e0486d05c5ab368b97653f27ea09fe41 (diff)
parent4fa4d39883a6328d4628525cfc163516fd919aba (diff)
Merge pull request #3518 from espressif/fix/dcd_esp32p4_phy
fix(dcd/dwc2): Do not modify FS PHY registers on HS PHY ESP32-P4
-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;