@@ -2019,7 +2019,7 @@ static int rtl8153_enable(struct r8152 *tp)
2019
2019
return rtl_enable (tp );
2020
2020
}
2021
2021
2022
- static void rtl8152_disable (struct r8152 * tp )
2022
+ static void rtl_disable (struct r8152 * tp )
2023
2023
{
2024
2024
u32 ocp_data ;
2025
2025
int i ;
@@ -2232,6 +2232,13 @@ static inline void r8152b_enable_aldps(struct r8152 *tp)
2232
2232
LINKENA | DIS_SDSAVE );
2233
2233
}
2234
2234
2235
+ static void rtl8152_disable (struct r8152 * tp )
2236
+ {
2237
+ r8152b_disable_aldps (tp );
2238
+ rtl_disable (tp );
2239
+ r8152b_enable_aldps (tp );
2240
+ }
2241
+
2235
2242
static void r8152b_hw_phy_cfg (struct r8152 * tp )
2236
2243
{
2237
2244
u16 data ;
@@ -2242,11 +2249,8 @@ static void r8152b_hw_phy_cfg(struct r8152 *tp)
2242
2249
r8152_mdio_write (tp , MII_BMCR , data );
2243
2250
}
2244
2251
2245
- r8152b_disable_aldps (tp );
2246
-
2247
2252
rtl_clear_bp (tp );
2248
2253
2249
- r8152b_enable_aldps (tp );
2250
2254
set_bit (PHY_RESET , & tp -> flags );
2251
2255
}
2252
2256
@@ -2255,9 +2259,6 @@ static void r8152b_exit_oob(struct r8152 *tp)
2255
2259
u32 ocp_data ;
2256
2260
int i ;
2257
2261
2258
- if (test_bit (RTL8152_UNPLUG , & tp -> flags ))
2259
- return ;
2260
-
2261
2262
ocp_data = ocp_read_dword (tp , MCU_TYPE_PLA , PLA_RCR );
2262
2263
ocp_data &= ~RCR_ACPT_ALL ;
2263
2264
ocp_write_dword (tp , MCU_TYPE_PLA , PLA_RCR , ocp_data );
@@ -2347,7 +2348,7 @@ static void r8152b_enter_oob(struct r8152 *tp)
2347
2348
ocp_write_dword (tp , MCU_TYPE_PLA , PLA_RXFIFO_CTRL1 , RXFIFO_THR2_OOB );
2348
2349
ocp_write_dword (tp , MCU_TYPE_PLA , PLA_RXFIFO_CTRL2 , RXFIFO_THR3_OOB );
2349
2350
2350
- rtl8152_disable (tp );
2351
+ rtl_disable (tp );
2351
2352
2352
2353
for (i = 0 ; i < 1000 ; i ++ ) {
2353
2354
ocp_data = ocp_read_byte (tp , MCU_TYPE_PLA , PLA_OOB_CTRL );
@@ -2485,9 +2486,6 @@ static void r8153_first_init(struct r8152 *tp)
2485
2486
u32 ocp_data ;
2486
2487
int i ;
2487
2488
2488
- if (test_bit (RTL8152_UNPLUG , & tp -> flags ))
2489
- return ;
2490
-
2491
2489
rxdy_gated_en (tp , true);
2492
2490
r8153_teredo_off (tp );
2493
2491
@@ -2560,7 +2558,7 @@ static void r8153_enter_oob(struct r8152 *tp)
2560
2558
ocp_data &= ~NOW_IS_OOB ;
2561
2559
ocp_write_byte (tp , MCU_TYPE_PLA , PLA_OOB_CTRL , ocp_data );
2562
2560
2563
- rtl8152_disable (tp );
2561
+ rtl_disable (tp );
2564
2562
2565
2563
for (i = 0 ; i < 1000 ; i ++ ) {
2566
2564
ocp_data = ocp_read_byte (tp , MCU_TYPE_PLA , PLA_OOB_CTRL );
@@ -2624,6 +2622,13 @@ static void r8153_enable_aldps(struct r8152 *tp)
2624
2622
ocp_reg_write (tp , OCP_POWER_CFG , data );
2625
2623
}
2626
2624
2625
+ static void rtl8153_disable (struct r8152 * tp )
2626
+ {
2627
+ r8153_disable_aldps (tp );
2628
+ rtl_disable (tp );
2629
+ r8153_enable_aldps (tp );
2630
+ }
2631
+
2627
2632
static int rtl8152_set_speed (struct r8152 * tp , u8 autoneg , u16 speed , u8 duplex )
2628
2633
{
2629
2634
u16 bmcr , anar , gbcr ;
@@ -2714,6 +2719,16 @@ static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex)
2714
2719
return ret ;
2715
2720
}
2716
2721
2722
+ static void rtl8152_up (struct r8152 * tp )
2723
+ {
2724
+ if (test_bit (RTL8152_UNPLUG , & tp -> flags ))
2725
+ return ;
2726
+
2727
+ r8152b_disable_aldps (tp );
2728
+ r8152b_exit_oob (tp );
2729
+ r8152b_enable_aldps (tp );
2730
+ }
2731
+
2717
2732
static void rtl8152_down (struct r8152 * tp )
2718
2733
{
2719
2734
if (test_bit (RTL8152_UNPLUG , & tp -> flags )) {
@@ -2727,6 +2742,16 @@ static void rtl8152_down(struct r8152 *tp)
2727
2742
r8152b_enable_aldps (tp );
2728
2743
}
2729
2744
2745
+ static void rtl8153_up (struct r8152 * tp )
2746
+ {
2747
+ if (test_bit (RTL8152_UNPLUG , & tp -> flags ))
2748
+ return ;
2749
+
2750
+ r8153_disable_aldps (tp );
2751
+ r8153_first_init (tp );
2752
+ r8153_enable_aldps (tp );
2753
+ }
2754
+
2730
2755
static void rtl8153_down (struct r8152 * tp )
2731
2756
{
2732
2757
if (test_bit (RTL8152_UNPLUG , & tp -> flags )) {
@@ -2946,6 +2971,8 @@ static void r8152b_init(struct r8152 *tp)
2946
2971
if (test_bit (RTL8152_UNPLUG , & tp -> flags ))
2947
2972
return ;
2948
2973
2974
+ r8152b_disable_aldps (tp );
2975
+
2949
2976
if (tp -> version == RTL_VER_01 ) {
2950
2977
ocp_data = ocp_read_word (tp , MCU_TYPE_PLA , PLA_LED_FEATURE );
2951
2978
ocp_data &= ~LED_MODE_MASK ;
@@ -2984,6 +3011,7 @@ static void r8153_init(struct r8152 *tp)
2984
3011
if (test_bit (RTL8152_UNPLUG , & tp -> flags ))
2985
3012
return ;
2986
3013
3014
+ r8153_disable_aldps (tp );
2987
3015
r8153_u1u2en (tp , false);
2988
3016
2989
3017
for (i = 0 ; i < 500 ; i ++ ) {
@@ -3392,16 +3420,16 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
3392
3420
ops -> init = r8152b_init ;
3393
3421
ops -> enable = rtl8152_enable ;
3394
3422
ops -> disable = rtl8152_disable ;
3395
- ops -> up = r8152b_exit_oob ;
3423
+ ops -> up = rtl8152_up ;
3396
3424
ops -> down = rtl8152_down ;
3397
3425
ops -> unload = rtl8152_unload ;
3398
3426
ret = 0 ;
3399
3427
break ;
3400
3428
case PRODUCT_ID_RTL8153 :
3401
3429
ops -> init = r8153_init ;
3402
3430
ops -> enable = rtl8153_enable ;
3403
- ops -> disable = rtl8152_disable ;
3404
- ops -> up = r8153_first_init ;
3431
+ ops -> disable = rtl8153_disable ;
3432
+ ops -> up = rtl8153_up ;
3405
3433
ops -> down = rtl8153_down ;
3406
3434
ops -> unload = rtl8153_unload ;
3407
3435
ret = 0 ;
@@ -3416,8 +3444,8 @@ static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
3416
3444
case PRODUCT_ID_SAMSUNG :
3417
3445
ops -> init = r8153_init ;
3418
3446
ops -> enable = rtl8153_enable ;
3419
- ops -> disable = rtl8152_disable ;
3420
- ops -> up = r8153_first_init ;
3447
+ ops -> disable = rtl8153_disable ;
3448
+ ops -> up = rtl8153_up ;
3421
3449
ops -> down = rtl8153_down ;
3422
3450
ops -> unload = rtl8153_unload ;
3423
3451
ret = 0 ;
0 commit comments