hathach 4 năm trước cách đây
mục cha
commit
301d6b4133
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      src/portable/synopsys/dwc2/dcd_dwc2.c

+ 6 - 2
src/portable/synopsys/dwc2/dcd_dwc2.c

@@ -443,11 +443,15 @@ static void phy_hs_init(dwc2_regs_t * dwc2)
   dwc2_phy_update(dwc2, dwc2->ghwcfg2_bm.hs_phy_type);
 
   // Set max speed
-  dwc2->dcfg = (dwc2->dcfg & ~DCFG_DSPD_Msk) | (DCFG_DSPD_HS << DCFG_DSPD_Pos);
+  uint32_t dcfg = dwc2->dcfg;
+  dcfg &= ~DCFG_DSPD_Msk;
+  dcfg |= DCFG_DSPD_HS << DCFG_DSPD_Pos;
 
   // XCVRDLY: transceiver delay between xcvr_sel and txvalid during device chirp is required
   // when using with some PHYs such as USB334x (USB3341, USB3343, USB3346, USB3347)
-  if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) dwc2->dcfg |= DCFG_XCVRDLY;
+  if (dwc2->ghwcfg2_bm.hs_phy_type == HS_PHY_TYPE_ULPI) dcfg |= DCFG_XCVRDLY;
+
+  dwc2->dcfg = dcfg;
 }
 
 static bool check_dwc2(dwc2_regs_t * dwc2)