@@ -105,32 +105,6 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
105105 return 0 ;
106106}
107107
108- void dwc3_enable_susphy (struct dwc3 * dwc , bool enable )
109- {
110- u32 reg ;
111- int i ;
112-
113- for (i = 0 ; i < dwc -> num_usb3_ports ; i ++ ) {
114- reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (i ));
115- if (enable && !dwc -> dis_u3_susphy_quirk )
116- reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
117- else
118- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
119-
120- dwc3_writel (dwc -> regs , DWC3_GUSB3PIPECTL (i ), reg );
121- }
122-
123- for (i = 0 ; i < dwc -> num_usb2_ports ; i ++ ) {
124- reg = dwc3_readl (dwc -> regs , DWC3_GUSB2PHYCFG (i ));
125- if (enable && !dwc -> dis_u2_susphy_quirk )
126- reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
127- else
128- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
129-
130- dwc3_writel (dwc -> regs , DWC3_GUSB2PHYCFG (i ), reg );
131- }
132- }
133-
134108void dwc3_set_prtcap (struct dwc3 * dwc , u32 mode )
135109{
136110 u32 reg ;
@@ -664,8 +638,11 @@ static int dwc3_core_ulpi_init(struct dwc3 *dwc)
664638
665639static int dwc3_ss_phy_setup (struct dwc3 * dwc , int index )
666640{
641+ unsigned int hw_mode ;
667642 u32 reg ;
668643
644+ hw_mode = DWC3_GHWPARAMS0_MODE (dwc -> hwparams .hwparams0 );
645+
669646 reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (index ));
670647
671648 /*
@@ -675,16 +652,21 @@ static int dwc3_ss_phy_setup(struct dwc3 *dwc, int index)
675652 reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX ;
676653
677654 /*
678- * Above DWC_usb3.0 1.94a, it is recommended to set
679- * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration.
680- * So default value will be '0' when the core is reset. Application
681- * needs to set it to '1' after the core initialization is completed.
682- *
683- * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be
684- * cleared after power-on reset, and it can be set after core
685- * initialization.
655+ * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY
656+ * to '0' during coreConsultant configuration. So default value
657+ * will be '0' when the core is reset. Application needs to set it
658+ * to '1' after the core initialization is completed.
659+ */
660+ if (!DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A ))
661+ reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
662+
663+ /*
664+ * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be cleared after
665+ * power-on reset, and it can be set after core initialization, which is
666+ * after device soft-reset during initialization.
686667 */
687- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
668+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD )
669+ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
688670
689671 if (dwc -> u2ss_inp3_quirk )
690672 reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK ;
@@ -710,6 +692,9 @@ static int dwc3_ss_phy_setup(struct dwc3 *dwc, int index)
710692 if (dwc -> tx_de_emphasis_quirk )
711693 reg |= DWC3_GUSB3PIPECTL_TX_DEEPH (dwc -> tx_de_emphasis );
712694
695+ if (dwc -> dis_u3_susphy_quirk )
696+ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
697+
713698 if (dwc -> dis_del_phy_power_chg_quirk )
714699 reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE ;
715700
@@ -764,15 +749,24 @@ static int dwc3_hs_phy_setup(struct dwc3 *dwc, int index)
764749 }
765750
766751 /*
767- * Above DWC_usb3.0 1.94a, it is recommended to set
768- * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration.
769- * So default value will be '0' when the core is reset. Application
770- * needs to set it to '1' after the core initialization is completed.
771- *
772- * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared
773- * after power-on reset, and it can be set after core initialization.
752+ * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to
753+ * '0' during coreConsultant configuration. So default value will
754+ * be '0' when the core is reset. Application needs to set it to
755+ * '1' after the core initialization is completed.
756+ */
757+ if (!DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A ))
758+ reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
759+
760+ /*
761+ * For DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared after
762+ * power-on reset, and it can be set after core initialization, which is
763+ * after device soft-reset during initialization.
774764 */
775- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
765+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD )
766+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
767+
768+ if (dwc -> dis_u2_susphy_quirk )
769+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
776770
777771 if (dwc -> dis_enblslpm_quirk )
778772 reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM ;
@@ -1371,6 +1365,21 @@ static int dwc3_core_init(struct dwc3 *dwc)
13711365 if (ret )
13721366 goto err_exit_phy ;
13731367
1368+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD &&
1369+ !DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A )) {
1370+ if (!dwc -> dis_u3_susphy_quirk ) {
1371+ reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (0 ));
1372+ reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
1373+ dwc3_writel (dwc -> regs , DWC3_GUSB3PIPECTL (0 ), reg );
1374+ }
1375+
1376+ if (!dwc -> dis_u2_susphy_quirk ) {
1377+ reg = dwc3_readl (dwc -> regs , DWC3_GUSB2PHYCFG (0 ));
1378+ reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
1379+ dwc3_writel (dwc -> regs , DWC3_GUSB2PHYCFG (0 ), reg );
1380+ }
1381+ }
1382+
13741383 dwc3_core_setup_global_control (dwc );
13751384 dwc3_core_num_eps (dwc );
13761385
0 commit comments