@@ -105,27 +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-
112- reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (0 ));
113- if (enable && !dwc -> dis_u3_susphy_quirk )
114- reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
115- else
116- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
117-
118- dwc3_writel (dwc -> regs , DWC3_GUSB3PIPECTL (0 ), reg );
119-
120- reg = dwc3_readl (dwc -> regs , DWC3_GUSB2PHYCFG (0 ));
121- if (enable && !dwc -> dis_u2_susphy_quirk )
122- reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
123- else
124- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
125-
126- dwc3_writel (dwc -> regs , DWC3_GUSB2PHYCFG (0 ), reg );
127- }
128-
129108void dwc3_set_prtcap (struct dwc3 * dwc , u32 mode )
130109{
131110 u32 reg ;
@@ -639,8 +618,11 @@ static int dwc3_core_ulpi_init(struct dwc3 *dwc)
639618
640619static int dwc3_ss_phy_setup (struct dwc3 * dwc , int index )
641620{
621+ unsigned int hw_mode ;
642622 u32 reg ;
643623
624+ hw_mode = DWC3_GHWPARAMS0_MODE (dwc -> hwparams .hwparams0 );
625+
644626 reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (index ));
645627
646628 /*
@@ -650,16 +632,21 @@ static int dwc3_ss_phy_setup(struct dwc3 *dwc, int index)
650632 reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX ;
651633
652634 /*
653- * Above DWC_usb3.0 1.94a, it is recommended to set
654- * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration.
655- * So default value will be '0' when the core is reset. Application
656- * needs to set it to '1' after the core initialization is completed.
657- *
658- * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be
659- * cleared after power-on reset, and it can be set after core
660- * initialization.
635+ * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY
636+ * to '0' during coreConsultant configuration. So default value
637+ * will be '0' when the core is reset. Application needs to set it
638+ * to '1' after the core initialization is completed.
639+ */
640+ if (!DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A ))
641+ reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
642+
643+ /*
644+ * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be cleared after
645+ * power-on reset, and it can be set after core initialization, which is
646+ * after device soft-reset during initialization.
661647 */
662- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
648+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD )
649+ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
663650
664651 if (dwc -> u2ss_inp3_quirk )
665652 reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK ;
@@ -685,6 +672,9 @@ static int dwc3_ss_phy_setup(struct dwc3 *dwc, int index)
685672 if (dwc -> tx_de_emphasis_quirk )
686673 reg |= DWC3_GUSB3PIPECTL_TX_DEEPH (dwc -> tx_de_emphasis );
687674
675+ if (dwc -> dis_u3_susphy_quirk )
676+ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
677+
688678 if (dwc -> dis_del_phy_power_chg_quirk )
689679 reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE ;
690680
@@ -739,15 +729,24 @@ static int dwc3_hs_phy_setup(struct dwc3 *dwc, int index)
739729 }
740730
741731 /*
742- * Above DWC_usb3.0 1.94a, it is recommended to set
743- * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration.
744- * So default value will be '0' when the core is reset. Application
745- * needs to set it to '1' after the core initialization is completed.
746- *
747- * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared
748- * after power-on reset, and it can be set after core initialization.
732+ * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to
733+ * '0' during coreConsultant configuration. So default value will
734+ * be '0' when the core is reset. Application needs to set it to
735+ * '1' after the core initialization is completed.
749736 */
750- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
737+ if (!DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A ))
738+ reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
739+
740+ /*
741+ * For DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared after
742+ * power-on reset, and it can be set after core initialization, which is
743+ * after device soft-reset during initialization.
744+ */
745+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD )
746+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
747+
748+ if (dwc -> dis_u2_susphy_quirk )
749+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
751750
752751 if (dwc -> dis_enblslpm_quirk )
753752 reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM ;
@@ -1346,6 +1345,21 @@ static int dwc3_core_init(struct dwc3 *dwc)
13461345 if (ret )
13471346 goto err_exit_phy ;
13481347
1348+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD &&
1349+ !DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A )) {
1350+ if (!dwc -> dis_u3_susphy_quirk ) {
1351+ reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (0 ));
1352+ reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
1353+ dwc3_writel (dwc -> regs , DWC3_GUSB3PIPECTL (0 ), reg );
1354+ }
1355+
1356+ if (!dwc -> dis_u2_susphy_quirk ) {
1357+ reg = dwc3_readl (dwc -> regs , DWC3_GUSB2PHYCFG (0 ));
1358+ reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
1359+ dwc3_writel (dwc -> regs , DWC3_GUSB2PHYCFG (0 ), reg );
1360+ }
1361+ }
1362+
13491363 dwc3_core_setup_global_control (dwc );
13501364 dwc3_core_num_eps (dwc );
13511365
0 commit comments