@@ -429,15 +429,6 @@ static const struct phy_reg rtl8168d_1_phy_reg_init_0[] = {
429
429
{ 0x0d , 0xf880 }
430
430
};
431
431
432
- static const struct phy_reg rtl8168d_1_phy_reg_init_1 [] = {
433
- { 0x1f , 0x0002 },
434
- { 0x05 , 0x669a },
435
- { 0x1f , 0x0005 },
436
- { 0x05 , 0x8330 },
437
- { 0x06 , 0x669a },
438
- { 0x1f , 0x0002 }
439
- };
440
-
441
432
static void rtl8168d_apply_firmware_cond (struct rtl8169_private * tp ,
442
433
struct phy_device * phydev ,
443
434
u16 val )
@@ -455,6 +446,29 @@ static void rtl8168d_apply_firmware_cond(struct rtl8169_private *tp,
455
446
r8169_apply_firmware (tp );
456
447
}
457
448
449
+ static void rtl8168d_1_common (struct phy_device * phydev )
450
+ {
451
+ u16 val ;
452
+
453
+ phy_write_paged (phydev , 0x0002 , 0x05 , 0x669a );
454
+ r8168d_phy_param (phydev , 0x8330 , 0xffff , 0x669a );
455
+ phy_write (phydev , 0x1f , 0x0002 );
456
+
457
+ val = phy_read (phydev , 0x0d );
458
+
459
+ if ((val & 0x00ff ) != 0x006c ) {
460
+ static const u16 set [] = {
461
+ 0x0065 , 0x0066 , 0x0067 , 0x0068 ,
462
+ 0x0069 , 0x006a , 0x006b , 0x006c
463
+ };
464
+ int i ;
465
+
466
+ val &= 0xff00 ;
467
+ for (i = 0 ; i < ARRAY_SIZE (set ); i ++ )
468
+ phy_write (phydev , 0x0d , val | set [i ]);
469
+ }
470
+ }
471
+
458
472
static void rtl8168d_1_hw_phy_config (struct rtl8169_private * tp ,
459
473
struct phy_device * phydev )
460
474
{
@@ -469,25 +483,7 @@ static void rtl8168d_1_hw_phy_config(struct rtl8169_private *tp,
469
483
phy_modify (phydev , 0x0c , 0x5d00 , 0xa200 );
470
484
471
485
if (rtl8168d_efuse_read (tp , 0x01 ) == 0xb1 ) {
472
- int val ;
473
-
474
- rtl_writephy_batch (phydev , rtl8168d_1_phy_reg_init_1 );
475
-
476
- val = phy_read (phydev , 0x0d );
477
-
478
- if ((val & 0x00ff ) != 0x006c ) {
479
- static const u32 set [] = {
480
- 0x0065 , 0x0066 , 0x0067 , 0x0068 ,
481
- 0x0069 , 0x006a , 0x006b , 0x006c
482
- };
483
- int i ;
484
-
485
- phy_write (phydev , 0x1f , 0x0002 );
486
-
487
- val &= 0xff00 ;
488
- for (i = 0 ; i < ARRAY_SIZE (set ); i ++ )
489
- phy_write (phydev , 0x0d , val | set [i ]);
490
- }
486
+ rtl8168d_1_common (phydev );
491
487
} else {
492
488
phy_write_paged (phydev , 0x0002 , 0x05 , 0x6662 );
493
489
r8168d_phy_param (phydev , 0x8330 , 0xffff , 0x6662 );
@@ -513,24 +509,7 @@ static void rtl8168d_2_hw_phy_config(struct rtl8169_private *tp,
513
509
rtl_writephy_batch (phydev , rtl8168d_1_phy_reg_init_0 );
514
510
515
511
if (rtl8168d_efuse_read (tp , 0x01 ) == 0xb1 ) {
516
- int val ;
517
-
518
- rtl_writephy_batch (phydev , rtl8168d_1_phy_reg_init_1 );
519
-
520
- val = phy_read (phydev , 0x0d );
521
- if ((val & 0x00ff ) != 0x006c ) {
522
- static const u32 set [] = {
523
- 0x0065 , 0x0066 , 0x0067 , 0x0068 ,
524
- 0x0069 , 0x006a , 0x006b , 0x006c
525
- };
526
- int i ;
527
-
528
- phy_write (phydev , 0x1f , 0x0002 );
529
-
530
- val &= 0xff00 ;
531
- for (i = 0 ; i < ARRAY_SIZE (set ); i ++ )
532
- phy_write (phydev , 0x0d , val | set [i ]);
533
- }
512
+ rtl8168d_1_common (phydev );
534
513
} else {
535
514
phy_write_paged (phydev , 0x0002 , 0x05 , 0x2642 );
536
515
r8168d_phy_param (phydev , 0x8330 , 0xffff , 0x2642 );
0 commit comments