diff options
author | Francois Romieu <romieu@fr.zoreil.com> | 2008-06-28 05:58:39 -0400 |
---|---|---|
committer | Francois Romieu <romieu@fr.zoreil.com> | 2008-10-10 17:08:34 -0400 |
commit | 219a1e9d46dcc21f279c428941ded2328f1a5ee5 (patch) | |
tree | 8e3ced1d53ec82f1ab468e12dce67e596c401d5f /drivers/net | |
parent | b8363901596f64ef74db906df0c4a95daea47464 (diff) |
r8169: make room for more specific 8168 hardware start procedure
Broadly speaking the 8168c* share some common code which will
be factored in __rtl_hw_start_8168cp. The 8168b* share some
code too but it will be a bit different.
Any change of behavior should be confined to the currently
unidentified 8168 chipsets. They will not be applied the Tx
performance tweak and will emit a warning instead.
Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
Cc: Edward Hsu <edward_hsu@realtek.com.tw>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/r8169.c | 66 |
1 files changed, 61 insertions, 5 deletions
diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c index 273afb561707..60d2ded55712 100644 --- a/drivers/net/r8169.c +++ b/drivers/net/r8169.c | |||
@@ -1387,7 +1387,7 @@ static void rtl8168cp_hw_phy_config(void __iomem *ioaddr) | |||
1387 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); | 1387 | rtl_phy_write(ioaddr, phy_reg_init, ARRAY_SIZE(phy_reg_init)); |
1388 | } | 1388 | } |
1389 | 1389 | ||
1390 | static void rtl8168c_hw_phy_config(void __iomem *ioaddr) | 1390 | static void rtl8168c_1_hw_phy_config(void __iomem *ioaddr) |
1391 | { | 1391 | { |
1392 | struct phy_reg phy_reg_init[] = { | 1392 | struct phy_reg phy_reg_init[] = { |
1393 | { 0x1f, 0x0001 }, | 1393 | { 0x1f, 0x0001 }, |
@@ -1416,7 +1416,7 @@ static void rtl8168c_hw_phy_config(void __iomem *ioaddr) | |||
1416 | mdio_write(ioaddr, 0x1f, 0x0000); | 1416 | mdio_write(ioaddr, 0x1f, 0x0000); |
1417 | } | 1417 | } |
1418 | 1418 | ||
1419 | static void rtl8168cx_hw_phy_config(void __iomem *ioaddr) | 1419 | static void rtl8168c_2_hw_phy_config(void __iomem *ioaddr) |
1420 | { | 1420 | { |
1421 | struct phy_reg phy_reg_init[] = { | 1421 | struct phy_reg phy_reg_init[] = { |
1422 | { 0x1f, 0x0001 }, | 1422 | { 0x1f, 0x0001 }, |
@@ -1495,10 +1495,10 @@ static void rtl_hw_phy_config(struct net_device *dev) | |||
1495 | rtl8168cp_hw_phy_config(ioaddr); | 1495 | rtl8168cp_hw_phy_config(ioaddr); |
1496 | break; | 1496 | break; |
1497 | case RTL_GIGA_MAC_VER_19: | 1497 | case RTL_GIGA_MAC_VER_19: |
1498 | rtl8168c_hw_phy_config(ioaddr); | 1498 | rtl8168c_1_hw_phy_config(ioaddr); |
1499 | break; | 1499 | break; |
1500 | case RTL_GIGA_MAC_VER_20: | 1500 | case RTL_GIGA_MAC_VER_20: |
1501 | rtl8168cx_hw_phy_config(ioaddr); | 1501 | rtl8168c_2_hw_phy_config(ioaddr); |
1502 | break; | 1502 | break; |
1503 | default: | 1503 | default: |
1504 | break; | 1504 | break; |
@@ -2384,6 +2384,36 @@ static void rtl_ephy_init(void __iomem *ioaddr, struct ephy_info *e, int len) | |||
2384 | } | 2384 | } |
2385 | } | 2385 | } |
2386 | 2386 | ||
2387 | static void rtl_hw_start_8168bb(void __iomem *ioaddr, struct pci_dev *pdev) | ||
2388 | { | ||
2389 | rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); | ||
2390 | } | ||
2391 | |||
2392 | static void rtl_hw_start_8168bef(void __iomem *ioaddr, struct pci_dev *pdev) | ||
2393 | { | ||
2394 | rtl_hw_start_8168bb(ioaddr, pdev); | ||
2395 | } | ||
2396 | |||
2397 | static void __rtl_hw_start_8168cp(void __iomem *ioaddr, struct pci_dev *pdev) | ||
2398 | { | ||
2399 | rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); | ||
2400 | } | ||
2401 | |||
2402 | static void rtl_hw_start_8168cp(void __iomem *ioaddr, struct pci_dev *pdev) | ||
2403 | { | ||
2404 | __rtl_hw_start_8168cp(ioaddr, pdev); | ||
2405 | } | ||
2406 | |||
2407 | static void rtl_hw_start_8168c_1(void __iomem *ioaddr, struct pci_dev *pdev) | ||
2408 | { | ||
2409 | __rtl_hw_start_8168cp(ioaddr, pdev); | ||
2410 | } | ||
2411 | |||
2412 | static void rtl_hw_start_8168c_2(void __iomem *ioaddr, struct pci_dev *pdev) | ||
2413 | { | ||
2414 | __rtl_hw_start_8168cp(ioaddr, pdev); | ||
2415 | } | ||
2416 | |||
2387 | static void rtl_hw_start_8168(struct net_device *dev) | 2417 | static void rtl_hw_start_8168(struct net_device *dev) |
2388 | { | 2418 | { |
2389 | struct rtl8169_private *tp = netdev_priv(dev); | 2419 | struct rtl8169_private *tp = netdev_priv(dev); |
@@ -2417,7 +2447,33 @@ static void rtl_hw_start_8168(struct net_device *dev) | |||
2417 | 2447 | ||
2418 | RTL_R8(IntrMask); | 2448 | RTL_R8(IntrMask); |
2419 | 2449 | ||
2420 | rtl_tx_performance_tweak(pdev, 0x5 << MAX_READ_REQUEST_SHIFT); | 2450 | switch (tp->mac_version) { |
2451 | case RTL_GIGA_MAC_VER_11: | ||
2452 | rtl_hw_start_8168bb(ioaddr, pdev); | ||
2453 | break; | ||
2454 | |||
2455 | case RTL_GIGA_MAC_VER_12: | ||
2456 | case RTL_GIGA_MAC_VER_17: | ||
2457 | rtl_hw_start_8168bef(ioaddr, pdev); | ||
2458 | break; | ||
2459 | |||
2460 | case RTL_GIGA_MAC_VER_18: | ||
2461 | rtl_hw_start_8168cp(ioaddr, pdev); | ||
2462 | break; | ||
2463 | |||
2464 | case RTL_GIGA_MAC_VER_19: | ||
2465 | rtl_hw_start_8168c_1(ioaddr, pdev); | ||
2466 | break; | ||
2467 | |||
2468 | case RTL_GIGA_MAC_VER_20: | ||
2469 | rtl_hw_start_8168c_2(ioaddr, pdev); | ||
2470 | break; | ||
2471 | |||
2472 | default: | ||
2473 | printk(KERN_ERR PFX "%s: unknown chipset (mac_version = %d).\n", | ||
2474 | dev->name, tp->mac_version); | ||
2475 | break; | ||
2476 | } | ||
2421 | 2477 | ||
2422 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); | 2478 | RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb); |
2423 | 2479 | ||