@@ -202,6 +202,36 @@ static void mtu3_intr_enable(struct mtu3 *mtu)
202
202
mtu3_writel (mbase , U3D_DEV_LINK_INTR_ENABLE , SSUSB_DEV_SPEED_CHG_INTR );
203
203
}
204
204
205
+ static void mtu3_set_speed (struct mtu3 * mtu );
206
+
207
+ /* CSR registers will be reset to default value if port is disabled */
208
+ static void mtu3_csr_init (struct mtu3 * mtu )
209
+ {
210
+ void __iomem * mbase = mtu -> mac_base ;
211
+
212
+ if (mtu -> is_u3_ip ) {
213
+ /* disable LGO_U1/U2 by default */
214
+ mtu3_clrbits (mbase , U3D_LINK_POWER_CONTROL ,
215
+ SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE );
216
+ /* enable accept LGO_U1/U2 link command from host */
217
+ mtu3_setbits (mbase , U3D_LINK_POWER_CONTROL ,
218
+ SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE );
219
+ /* device responses to u3_exit from host automatically */
220
+ mtu3_clrbits (mbase , U3D_LTSSM_CTRL , SOFT_U3_EXIT_EN );
221
+ /* automatically build U2 link when U3 detect fail */
222
+ mtu3_setbits (mbase , U3D_USB2_TEST_MODE , U2U3_AUTO_SWITCH );
223
+ /* auto clear SOFT_CONN when clear USB3_EN if work as HS */
224
+ mtu3_setbits (mbase , U3D_U3U2_SWITCH_CTRL , SOFTCON_CLR_AUTO_EN );
225
+ }
226
+
227
+ mtu3_set_speed (mtu );
228
+
229
+ /* delay about 0.1us from detecting reset to send chirp-K */
230
+ mtu3_clrbits (mbase , U3D_LINK_RESET_INFO , WTCHRP_MSK );
231
+ /* enable automatical HWRW from L1 */
232
+ mtu3_setbits (mbase , U3D_POWER_MANAGEMENT , LPM_HRWE );
233
+ }
234
+
205
235
/* reset: u2 - data toggle, u3 - SeqN, flow control status etc */
206
236
static void mtu3_ep_reset (struct mtu3_ep * mep )
207
237
{
@@ -267,13 +297,7 @@ void mtu3_start(struct mtu3 *mtu)
267
297
268
298
mtu3_clrbits (mtu -> ippc_base , U3D_SSUSB_IP_PW_CTRL2 , SSUSB_IP_DEV_PDN );
269
299
270
- /*
271
- * When disable U2 port, USB2_CSR's register will be reset to
272
- * default value after re-enable it again(HS is enabled by default).
273
- * So if force mac to work as FS, disable HS function.
274
- */
275
- if (mtu -> max_speed == USB_SPEED_FULL )
276
- mtu3_clrbits (mbase , U3D_POWER_MANAGEMENT , HS_ENABLE );
300
+ mtu3_csr_init (mtu );
277
301
278
302
/* Initialize the default interrupts */
279
303
mtu3_intr_enable (mtu );
@@ -572,39 +596,18 @@ static void mtu3_set_speed(struct mtu3 *mtu)
572
596
573
597
static void mtu3_regs_init (struct mtu3 * mtu )
574
598
{
575
-
576
599
void __iomem * mbase = mtu -> mac_base ;
577
600
578
601
/* be sure interrupts are disabled before registration of ISR */
579
602
mtu3_intr_disable (mtu );
580
603
mtu3_intr_status_clear (mtu );
581
604
582
- if (mtu -> is_u3_ip ) {
583
- /* disable LGO_U1/U2 by default */
584
- mtu3_clrbits (mbase , U3D_LINK_POWER_CONTROL ,
585
- SW_U1_REQUEST_ENABLE | SW_U2_REQUEST_ENABLE );
586
- /* enable accept LGO_U1/U2 link command from host */
587
- mtu3_setbits (mbase , U3D_LINK_POWER_CONTROL ,
588
- SW_U1_ACCEPT_ENABLE | SW_U2_ACCEPT_ENABLE );
589
- /* device responses to u3_exit from host automatically */
590
- mtu3_clrbits (mbase , U3D_LTSSM_CTRL , SOFT_U3_EXIT_EN );
591
- /* automatically build U2 link when U3 detect fail */
592
- mtu3_setbits (mbase , U3D_USB2_TEST_MODE , U2U3_AUTO_SWITCH );
593
- /* auto clear SOFT_CONN when clear USB3_EN if work as HS */
594
- mtu3_setbits (mbase , U3D_U3U2_SWITCH_CTRL , SOFTCON_CLR_AUTO_EN );
595
- }
596
-
597
- mtu3_set_speed (mtu );
605
+ mtu3_csr_init (mtu );
598
606
599
- /* delay about 0.1us from detecting reset to send chirp-K */
600
- mtu3_clrbits (mbase , U3D_LINK_RESET_INFO , WTCHRP_MSK );
601
607
/* U2/U3 detected by HW */
602
608
mtu3_writel (mbase , U3D_DEVICE_CONF , 0 );
603
609
/* vbus detected by HW */
604
610
mtu3_clrbits (mbase , U3D_MISC_CTRL , VBUS_FRC_EN | VBUS_ON );
605
- /* enable automatical HWRW from L1 */
606
- mtu3_setbits (mbase , U3D_POWER_MANAGEMENT , LPM_HRWE );
607
-
608
611
/* use new QMU format when HW version >= 0x1003 */
609
612
if (mtu -> gen2cp )
610
613
mtu3_writel (mbase , U3D_QFCR , ~0x0 );
0 commit comments