@@ -104,27 +104,6 @@ static int dwc3_get_dr_mode(struct dwc3 *dwc)
104104 return 0 ;
105105}
106106
107- void dwc3_enable_susphy (struct dwc3 * dwc , bool enable )
108- {
109- u32 reg ;
110-
111- reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (0 ));
112- if (enable && !dwc -> dis_u3_susphy_quirk )
113- reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
114- else
115- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
116-
117- dwc3_writel (dwc -> regs , DWC3_GUSB3PIPECTL (0 ), reg );
118-
119- reg = dwc3_readl (dwc -> regs , DWC3_GUSB2PHYCFG (0 ));
120- if (enable && !dwc -> dis_u2_susphy_quirk )
121- reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
122- else
123- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
124-
125- dwc3_writel (dwc -> regs , DWC3_GUSB2PHYCFG (0 ), reg );
126- }
127-
128107void dwc3_set_prtcap (struct dwc3 * dwc , u32 mode )
129108{
130109 u32 reg ;
@@ -628,8 +607,11 @@ static int dwc3_core_ulpi_init(struct dwc3 *dwc)
628607 */
629608static int dwc3_phy_setup (struct dwc3 * dwc )
630609{
610+ unsigned int hw_mode ;
631611 u32 reg ;
632612
613+ hw_mode = DWC3_GHWPARAMS0_MODE (dwc -> hwparams .hwparams0 );
614+
633615 reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (0 ));
634616
635617 /*
@@ -639,16 +621,21 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
639621 reg &= ~DWC3_GUSB3PIPECTL_UX_EXIT_PX ;
640622
641623 /*
642- * Above DWC_usb3.0 1.94a, it is recommended to set
643- * DWC3_GUSB3PIPECTL_SUSPHY to '0' during coreConsultant configuration.
644- * So default value will be '0' when the core is reset. Application
645- * needs to set it to '1' after the core initialization is completed.
646- *
647- * Similarly for DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be
648- * cleared after power-on reset, and it can be set after core
649- * initialization.
624+ * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY
625+ * to '0' during coreConsultant configuration. So default value
626+ * will be '0' when the core is reset. Application needs to set it
627+ * to '1' after the core initialization is completed.
650628 */
651- reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
629+ if (!DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A ))
630+ reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
631+
632+ /*
633+ * For DRD controllers, GUSB3PIPECTL.SUSPENDENABLE must be cleared after
634+ * power-on reset, and it can be set after core initialization, which is
635+ * after device soft-reset during initialization.
636+ */
637+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD )
638+ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
652639
653640 if (dwc -> u2ss_inp3_quirk )
654641 reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK ;
@@ -674,6 +661,9 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
674661 if (dwc -> tx_de_emphasis_quirk )
675662 reg |= DWC3_GUSB3PIPECTL_TX_DEEPH (dwc -> tx_de_emphasis );
676663
664+ if (dwc -> dis_u3_susphy_quirk )
665+ reg &= ~DWC3_GUSB3PIPECTL_SUSPHY ;
666+
677667 if (dwc -> dis_del_phy_power_chg_quirk )
678668 reg &= ~DWC3_GUSB3PIPECTL_DEPOCHANGE ;
679669
@@ -721,15 +711,24 @@ static int dwc3_phy_setup(struct dwc3 *dwc)
721711 }
722712
723713 /*
724- * Above DWC_usb3.0 1.94a, it is recommended to set
725- * DWC3_GUSB2PHYCFG_SUSPHY to '0' during coreConsultant configuration.
726- * So default value will be '0' when the core is reset. Application
727- * needs to set it to '1' after the core initialization is completed.
728- *
729- * Similarly for DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared
730- * after power-on reset, and it can be set after core initialization.
714+ * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to
715+ * '0' during coreConsultant configuration. So default value will
716+ * be '0' when the core is reset. Application needs to set it to
717+ * '1' after the core initialization is completed.
718+ */
719+ if (!DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A ))
720+ reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
721+
722+ /*
723+ * For DRD controllers, GUSB2PHYCFG.SUSPHY must be cleared after
724+ * power-on reset, and it can be set after core initialization, which is
725+ * after device soft-reset during initialization.
731726 */
732- reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
727+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD )
728+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
729+
730+ if (dwc -> dis_u2_susphy_quirk )
731+ reg &= ~DWC3_GUSB2PHYCFG_SUSPHY ;
733732
734733 if (dwc -> dis_enblslpm_quirk )
735734 reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM ;
@@ -1250,6 +1249,21 @@ static int dwc3_core_init(struct dwc3 *dwc)
12501249 if (ret )
12511250 goto err_exit_phy ;
12521251
1252+ if (hw_mode == DWC3_GHWPARAMS0_MODE_DRD &&
1253+ !DWC3_VER_IS_WITHIN (DWC3 , ANY , 194 A )) {
1254+ if (!dwc -> dis_u3_susphy_quirk ) {
1255+ reg = dwc3_readl (dwc -> regs , DWC3_GUSB3PIPECTL (0 ));
1256+ reg |= DWC3_GUSB3PIPECTL_SUSPHY ;
1257+ dwc3_writel (dwc -> regs , DWC3_GUSB3PIPECTL (0 ), reg );
1258+ }
1259+
1260+ if (!dwc -> dis_u2_susphy_quirk ) {
1261+ reg = dwc3_readl (dwc -> regs , DWC3_GUSB2PHYCFG (0 ));
1262+ reg |= DWC3_GUSB2PHYCFG_SUSPHY ;
1263+ dwc3_writel (dwc -> regs , DWC3_GUSB2PHYCFG (0 ), reg );
1264+ }
1265+ }
1266+
12531267 dwc3_core_setup_global_control (dwc );
12541268 dwc3_core_num_eps (dwc );
12551269
0 commit comments