@@ -384,12 +384,6 @@ enum rtl_registers {
384
384
FuncForceEvent = 0xfc ,
385
385
};
386
386
387
- enum rtl8110_registers {
388
- TBICSR = 0x64 ,
389
- TBI_ANAR = 0x68 ,
390
- TBI_LPAR = 0x6a ,
391
- };
392
-
393
387
enum rtl8168_8101_registers {
394
388
CSIDR = 0x64 ,
395
389
CSIAR = 0x68 ,
@@ -556,14 +550,6 @@ enum rtl_register_content {
556
550
PMEStatus = (1 << 0 ), /* PME status can be reset by PCI RST# */
557
551
ASPM_en = (1 << 0 ), /* ASPM enable */
558
552
559
- /* TBICSR p.28 */
560
- TBIReset = 0x80000000 ,
561
- TBILoopback = 0x40000000 ,
562
- TBINwEnable = 0x20000000 ,
563
- TBINwRestart = 0x10000000 ,
564
- TBILinkOk = 0x02000000 ,
565
- TBINwComplete = 0x01000000 ,
566
-
567
553
/* CPlusCmd p.31 */
568
554
EnableBist = (1 << 15 ), // 8168 8101
569
555
Mac_dbgo_oe = (1 << 14 ), // 8168 8101
@@ -761,14 +747,7 @@ struct rtl8169_private {
761
747
void (* disable )(struct rtl8169_private * );
762
748
} jumbo_ops ;
763
749
764
- int (* set_speed )(struct net_device * , u8 aneg , u16 sp , u8 dpx , u32 adv );
765
- int (* get_link_ksettings )(struct net_device * ,
766
- struct ethtool_link_ksettings * );
767
- void (* phy_reset_enable )(struct rtl8169_private * tp );
768
750
void (* hw_start )(struct rtl8169_private * tp );
769
- unsigned int (* phy_reset_pending )(struct rtl8169_private * tp );
770
- unsigned int (* link_ok )(struct rtl8169_private * tp );
771
- int (* do_ioctl )(struct rtl8169_private * tp , struct mii_ioctl_data * data , int cmd );
772
751
bool (* tso_csum )(struct rtl8169_private * , struct sk_buff * , u32 * );
773
752
774
753
struct {
@@ -1463,31 +1442,16 @@ static void rtl8169_irq_mask_and_ack(struct rtl8169_private *tp)
1463
1442
RTL_R8 (tp , ChipCmd );
1464
1443
}
1465
1444
1466
- static unsigned int rtl8169_tbi_reset_pending (struct rtl8169_private * tp )
1467
- {
1468
- return RTL_R32 (tp , TBICSR ) & TBIReset ;
1469
- }
1470
-
1471
1445
static unsigned int rtl8169_xmii_reset_pending (struct rtl8169_private * tp )
1472
1446
{
1473
1447
return rtl_readphy (tp , MII_BMCR ) & BMCR_RESET ;
1474
1448
}
1475
1449
1476
- static unsigned int rtl8169_tbi_link_ok (struct rtl8169_private * tp )
1477
- {
1478
- return RTL_R32 (tp , TBICSR ) & TBILinkOk ;
1479
- }
1480
-
1481
1450
static unsigned int rtl8169_xmii_link_ok (struct rtl8169_private * tp )
1482
1451
{
1483
1452
return RTL_R8 (tp , PHYstatus ) & LinkStatus ;
1484
1453
}
1485
1454
1486
- static void rtl8169_tbi_reset_enable (struct rtl8169_private * tp )
1487
- {
1488
- RTL_W32 (tp , TBICSR , RTL_R32 (tp , TBICSR ) | TBIReset );
1489
- }
1490
-
1491
1455
static void rtl8169_xmii_reset_enable (struct rtl8169_private * tp )
1492
1456
{
1493
1457
unsigned int val ;
@@ -1557,7 +1521,7 @@ static void rtl8169_check_link_status(struct net_device *dev,
1557
1521
{
1558
1522
struct device * d = tp_to_dev (tp );
1559
1523
1560
- if (tp -> link_ok (tp )) {
1524
+ if (rtl8169_xmii_link_ok (tp )) {
1561
1525
rtl_link_chg_patch (tp );
1562
1526
/* This is to cancel a scheduled suspend if there's one. */
1563
1527
pm_request_resume (d );
@@ -1744,28 +1708,6 @@ static int rtl8169_get_regs_len(struct net_device *dev)
1744
1708
return R8169_REGS_SIZE ;
1745
1709
}
1746
1710
1747
- static int rtl8169_set_speed_tbi (struct net_device * dev ,
1748
- u8 autoneg , u16 speed , u8 duplex , u32 ignored )
1749
- {
1750
- struct rtl8169_private * tp = netdev_priv (dev );
1751
- int ret = 0 ;
1752
- u32 reg ;
1753
-
1754
- reg = RTL_R32 (tp , TBICSR );
1755
- if ((autoneg == AUTONEG_DISABLE ) && (speed == SPEED_1000 ) &&
1756
- (duplex == DUPLEX_FULL )) {
1757
- RTL_W32 (tp , TBICSR , reg & ~(TBINwEnable | TBINwRestart ));
1758
- } else if (autoneg == AUTONEG_ENABLE )
1759
- RTL_W32 (tp , TBICSR , reg | TBINwEnable | TBINwRestart );
1760
- else {
1761
- netif_warn (tp , link , dev ,
1762
- "incorrect speed setting refused in TBI mode\n" );
1763
- ret = - EOPNOTSUPP ;
1764
- }
1765
-
1766
- return ret ;
1767
- }
1768
-
1769
1711
static int rtl8169_set_speed_xmii (struct net_device * dev ,
1770
1712
u8 autoneg , u16 speed , u8 duplex , u32 adv )
1771
1713
{
@@ -1849,7 +1791,7 @@ static int rtl8169_set_speed(struct net_device *dev,
1849
1791
struct rtl8169_private * tp = netdev_priv (dev );
1850
1792
int ret ;
1851
1793
1852
- ret = tp -> set_speed (dev , autoneg , speed , duplex , advertising );
1794
+ ret = rtl8169_set_speed_xmii (dev , autoneg , speed , duplex , advertising );
1853
1795
if (ret < 0 )
1854
1796
goto out ;
1855
1797
@@ -1925,53 +1867,14 @@ static void rtl8169_rx_vlan_tag(struct RxDesc *desc, struct sk_buff *skb)
1925
1867
__vlan_hwaccel_put_tag (skb , htons (ETH_P_8021Q ), swab16 (opts2 & 0xffff ));
1926
1868
}
1927
1869
1928
- static int rtl8169_get_link_ksettings_tbi (struct net_device * dev ,
1929
- struct ethtool_link_ksettings * cmd )
1930
- {
1931
- struct rtl8169_private * tp = netdev_priv (dev );
1932
- u32 status ;
1933
- u32 supported , advertising ;
1934
-
1935
- supported =
1936
- SUPPORTED_1000baseT_Full | SUPPORTED_Autoneg | SUPPORTED_FIBRE ;
1937
- cmd -> base .port = PORT_FIBRE ;
1938
-
1939
- status = RTL_R32 (tp , TBICSR );
1940
- advertising = (status & TBINwEnable ) ? ADVERTISED_Autoneg : 0 ;
1941
- cmd -> base .autoneg = !!(status & TBINwEnable );
1942
-
1943
- cmd -> base .speed = SPEED_1000 ;
1944
- cmd -> base .duplex = DUPLEX_FULL ; /* Always set */
1945
-
1946
- ethtool_convert_legacy_u32_to_link_mode (cmd -> link_modes .supported ,
1947
- supported );
1948
- ethtool_convert_legacy_u32_to_link_mode (cmd -> link_modes .advertising ,
1949
- advertising );
1950
-
1951
- return 0 ;
1952
- }
1953
-
1954
- static int rtl8169_get_link_ksettings_xmii (struct net_device * dev ,
1955
- struct ethtool_link_ksettings * cmd )
1956
- {
1957
- struct rtl8169_private * tp = netdev_priv (dev );
1958
-
1959
- mii_ethtool_get_link_ksettings (& tp -> mii , cmd );
1960
-
1961
- return 0 ;
1962
- }
1963
-
1964
1870
static int rtl8169_get_link_ksettings (struct net_device * dev ,
1965
1871
struct ethtool_link_ksettings * cmd )
1966
1872
{
1967
1873
struct rtl8169_private * tp = netdev_priv (dev );
1968
- int rc ;
1969
1874
1970
- rtl_lock_work (tp );
1971
- rc = tp -> get_link_ksettings (dev , cmd );
1972
- rtl_unlock_work (tp );
1875
+ mii_ethtool_get_link_ksettings (& tp -> mii , cmd );
1973
1876
1974
- return rc ;
1877
+ return 0 ;
1975
1878
}
1976
1879
1977
1880
static int rtl8169_set_link_ksettings (struct net_device * dev ,
@@ -4395,7 +4298,7 @@ static void rtl_phy_work(struct rtl8169_private *tp)
4395
4298
struct timer_list * timer = & tp -> timer ;
4396
4299
unsigned long timeout = RTL8169_PHY_TIMEOUT ;
4397
4300
4398
- if (tp -> phy_reset_pending (tp )) {
4301
+ if (rtl8169_xmii_reset_pending (tp )) {
4399
4302
/*
4400
4303
* A busy loop could burn quite a few cycles on nowadays CPU.
4401
4304
* Let's delay the execution of the timer for a few ticks.
@@ -4404,12 +4307,12 @@ static void rtl_phy_work(struct rtl8169_private *tp)
4404
4307
goto out_mod_timer ;
4405
4308
}
4406
4309
4407
- if (tp -> link_ok (tp ))
4310
+ if (rtl8169_xmii_link_ok (tp ))
4408
4311
return ;
4409
4312
4410
4313
netif_dbg (tp , link , tp -> dev , "PHY reset until link up\n" );
4411
4314
4412
- tp -> phy_reset_enable (tp );
4315
+ rtl8169_xmii_reset_enable (tp );
4413
4316
4414
4317
out_mod_timer :
4415
4318
mod_timer (timer , jiffies + timeout );
@@ -4430,20 +4333,20 @@ static void rtl8169_phy_timer(struct timer_list *t)
4430
4333
4431
4334
DECLARE_RTL_COND (rtl_phy_reset_cond )
4432
4335
{
4433
- return tp -> phy_reset_pending (tp );
4336
+ return rtl8169_xmii_reset_pending (tp );
4434
4337
}
4435
4338
4436
4339
static void rtl8169_phy_reset (struct net_device * dev ,
4437
4340
struct rtl8169_private * tp )
4438
4341
{
4439
- tp -> phy_reset_enable (tp );
4342
+ rtl8169_xmii_reset_enable (tp );
4440
4343
rtl_msleep_loop_wait_low (tp , & rtl_phy_reset_cond , 1 , 100 );
4441
4344
}
4442
4345
4443
4346
static bool rtl_tbi_enabled (struct rtl8169_private * tp )
4444
4347
{
4445
4348
return (tp -> mac_version == RTL_GIGA_MAC_VER_01 ) &&
4446
- (RTL_R8 (tp , PHYstatus ) & TBI_Enable );
4349
+ (RTL_R8 (tp , PHYstatus ) & TBI_Enable );
4447
4350
}
4448
4351
4449
4352
static void rtl8169_init_phy (struct net_device * dev , struct rtl8169_private * tp )
@@ -4478,9 +4381,6 @@ static void rtl8169_init_phy(struct net_device *dev, struct rtl8169_private *tp)
4478
4381
(tp -> mii .supports_gmii ?
4479
4382
ADVERTISED_1000baseT_Half |
4480
4383
ADVERTISED_1000baseT_Full : 0 ));
4481
-
4482
- if (rtl_tbi_enabled (tp ))
4483
- netif_info (tp , link , dev , "TBI auto-negotiating\n" );
4484
4384
}
4485
4385
4486
4386
static void rtl_rar_set (struct rtl8169_private * tp , u8 * addr )
@@ -4523,14 +4423,6 @@ static int rtl_set_mac_address(struct net_device *dev, void *p)
4523
4423
return 0 ;
4524
4424
}
4525
4425
4526
- static int rtl8169_ioctl (struct net_device * dev , struct ifreq * ifr , int cmd )
4527
- {
4528
- struct rtl8169_private * tp = netdev_priv (dev );
4529
- struct mii_ioctl_data * data = if_mii (ifr );
4530
-
4531
- return netif_running (dev ) ? tp -> do_ioctl (tp , data , cmd ) : - ENODEV ;
4532
- }
4533
-
4534
4426
static int rtl_xmii_ioctl (struct rtl8169_private * tp ,
4535
4427
struct mii_ioctl_data * data , int cmd )
4536
4428
{
@@ -4550,9 +4442,12 @@ static int rtl_xmii_ioctl(struct rtl8169_private *tp,
4550
4442
return - EOPNOTSUPP ;
4551
4443
}
4552
4444
4553
- static int rtl_tbi_ioctl (struct rtl8169_private * tp , struct mii_ioctl_data * data , int cmd )
4445
+ static int rtl8169_ioctl (struct net_device * dev , struct ifreq * ifr , int cmd )
4554
4446
{
4555
- return - EOPNOTSUPP ;
4447
+ struct rtl8169_private * tp = netdev_priv (dev );
4448
+ struct mii_ioctl_data * data = if_mii (ifr );
4449
+
4450
+ return netif_running (dev ) ? rtl_xmii_ioctl (tp , data , cmd ) : - ENODEV ;
4556
4451
}
4557
4452
4558
4453
static void rtl_init_mdio_ops (struct rtl8169_private * tp )
@@ -7676,6 +7571,11 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7676
7571
/* Identify chip attached to board */
7677
7572
rtl8169_get_mac_version (tp , cfg -> default_ver );
7678
7573
7574
+ if (rtl_tbi_enabled (tp )) {
7575
+ dev_err (& pdev -> dev , "TBI fiber mode not supported\n" );
7576
+ return - ENODEV ;
7577
+ }
7578
+
7679
7579
tp -> cp_cmd = RTL_R16 (tp , CPlusCmd );
7680
7580
7681
7581
if ((sizeof (dma_addr_t ) > 4 ) &&
@@ -7724,22 +7624,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
7724
7624
/* override BIOS settings, use userspace tools to enable WOL */
7725
7625
__rtl8169_set_wol (tp , 0 );
7726
7626
7727
- if (rtl_tbi_enabled (tp )) {
7728
- tp -> set_speed = rtl8169_set_speed_tbi ;
7729
- tp -> get_link_ksettings = rtl8169_get_link_ksettings_tbi ;
7730
- tp -> phy_reset_enable = rtl8169_tbi_reset_enable ;
7731
- tp -> phy_reset_pending = rtl8169_tbi_reset_pending ;
7732
- tp -> link_ok = rtl8169_tbi_link_ok ;
7733
- tp -> do_ioctl = rtl_tbi_ioctl ;
7734
- } else {
7735
- tp -> set_speed = rtl8169_set_speed_xmii ;
7736
- tp -> get_link_ksettings = rtl8169_get_link_ksettings_xmii ;
7737
- tp -> phy_reset_enable = rtl8169_xmii_reset_enable ;
7738
- tp -> phy_reset_pending = rtl8169_xmii_reset_pending ;
7739
- tp -> link_ok = rtl8169_xmii_link_ok ;
7740
- tp -> do_ioctl = rtl_xmii_ioctl ;
7741
- }
7742
-
7743
7627
mutex_init (& tp -> wk .mutex );
7744
7628
u64_stats_init (& tp -> rx_stats .syncp );
7745
7629
u64_stats_init (& tp -> tx_stats .syncp );
0 commit comments