diff options
Diffstat (limited to 'drivers/net/e1000/e1000_hw.c')
-rw-r--r-- | drivers/net/e1000/e1000_hw.c | 328 |
1 files changed, 260 insertions, 68 deletions
diff --git a/drivers/net/e1000/e1000_hw.c b/drivers/net/e1000/e1000_hw.c index 77d08e697b74..aed223b1b897 100644 --- a/drivers/net/e1000/e1000_hw.c +++ b/drivers/net/e1000/e1000_hw.c | |||
@@ -130,10 +130,15 @@ static s32 e1000_set_phy_type(struct e1000_hw *hw) | |||
130 | if (hw->mac_type == e1000_82541 || | 130 | if (hw->mac_type == e1000_82541 || |
131 | hw->mac_type == e1000_82541_rev_2 || | 131 | hw->mac_type == e1000_82541_rev_2 || |
132 | hw->mac_type == e1000_82547 || | 132 | hw->mac_type == e1000_82547 || |
133 | hw->mac_type == e1000_82547_rev_2) { | 133 | hw->mac_type == e1000_82547_rev_2) |
134 | hw->phy_type = e1000_phy_igp; | 134 | hw->phy_type = e1000_phy_igp; |
135 | break; | 135 | break; |
136 | } | 136 | case RTL8211B_PHY_ID: |
137 | hw->phy_type = e1000_phy_8211; | ||
138 | break; | ||
139 | case RTL8201N_PHY_ID: | ||
140 | hw->phy_type = e1000_phy_8201; | ||
141 | break; | ||
137 | default: | 142 | default: |
138 | /* Should never have loaded on this device */ | 143 | /* Should never have loaded on this device */ |
139 | hw->phy_type = e1000_phy_undefined; | 144 | hw->phy_type = e1000_phy_undefined; |
@@ -318,6 +323,9 @@ s32 e1000_set_mac_type(struct e1000_hw *hw) | |||
318 | case E1000_DEV_ID_82547GI: | 323 | case E1000_DEV_ID_82547GI: |
319 | hw->mac_type = e1000_82547_rev_2; | 324 | hw->mac_type = e1000_82547_rev_2; |
320 | break; | 325 | break; |
326 | case E1000_DEV_ID_INTEL_CE4100_GBE: | ||
327 | hw->mac_type = e1000_ce4100; | ||
328 | break; | ||
321 | default: | 329 | default: |
322 | /* Should never have loaded on this device */ | 330 | /* Should never have loaded on this device */ |
323 | return -E1000_ERR_MAC_TYPE; | 331 | return -E1000_ERR_MAC_TYPE; |
@@ -372,6 +380,9 @@ void e1000_set_media_type(struct e1000_hw *hw) | |||
372 | case e1000_82542_rev2_1: | 380 | case e1000_82542_rev2_1: |
373 | hw->media_type = e1000_media_type_fiber; | 381 | hw->media_type = e1000_media_type_fiber; |
374 | break; | 382 | break; |
383 | case e1000_ce4100: | ||
384 | hw->media_type = e1000_media_type_copper; | ||
385 | break; | ||
375 | default: | 386 | default: |
376 | status = er32(STATUS); | 387 | status = er32(STATUS); |
377 | if (status & E1000_STATUS_TBIMODE) { | 388 | if (status & E1000_STATUS_TBIMODE) { |
@@ -460,6 +471,7 @@ s32 e1000_reset_hw(struct e1000_hw *hw) | |||
460 | /* Reset is performed on a shadow of the control register */ | 471 | /* Reset is performed on a shadow of the control register */ |
461 | ew32(CTRL_DUP, (ctrl | E1000_CTRL_RST)); | 472 | ew32(CTRL_DUP, (ctrl | E1000_CTRL_RST)); |
462 | break; | 473 | break; |
474 | case e1000_ce4100: | ||
463 | default: | 475 | default: |
464 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); | 476 | ew32(CTRL, (ctrl | E1000_CTRL_RST)); |
465 | break; | 477 | break; |
@@ -952,6 +964,67 @@ static s32 e1000_setup_fiber_serdes_link(struct e1000_hw *hw) | |||
952 | } | 964 | } |
953 | 965 | ||
954 | /** | 966 | /** |
967 | * e1000_copper_link_rtl_setup - Copper link setup for e1000_phy_rtl series. | ||
968 | * @hw: Struct containing variables accessed by shared code | ||
969 | * | ||
970 | * Commits changes to PHY configuration by calling e1000_phy_reset(). | ||
971 | */ | ||
972 | static s32 e1000_copper_link_rtl_setup(struct e1000_hw *hw) | ||
973 | { | ||
974 | s32 ret_val; | ||
975 | |||
976 | /* SW reset the PHY so all changes take effect */ | ||
977 | ret_val = e1000_phy_reset(hw); | ||
978 | if (ret_val) { | ||
979 | e_dbg("Error Resetting the PHY\n"); | ||
980 | return ret_val; | ||
981 | } | ||
982 | |||
983 | return E1000_SUCCESS; | ||
984 | } | ||
985 | |||
986 | static s32 gbe_dhg_phy_setup(struct e1000_hw *hw) | ||
987 | { | ||
988 | s32 ret_val; | ||
989 | u32 ctrl_aux; | ||
990 | |||
991 | switch (hw->phy_type) { | ||
992 | case e1000_phy_8211: | ||
993 | ret_val = e1000_copper_link_rtl_setup(hw); | ||
994 | if (ret_val) { | ||
995 | e_dbg("e1000_copper_link_rtl_setup failed!\n"); | ||
996 | return ret_val; | ||
997 | } | ||
998 | break; | ||
999 | case e1000_phy_8201: | ||
1000 | /* Set RMII mode */ | ||
1001 | ctrl_aux = er32(CTL_AUX); | ||
1002 | ctrl_aux |= E1000_CTL_AUX_RMII; | ||
1003 | ew32(CTL_AUX, ctrl_aux); | ||
1004 | E1000_WRITE_FLUSH(); | ||
1005 | |||
1006 | /* Disable the J/K bits required for receive */ | ||
1007 | ctrl_aux = er32(CTL_AUX); | ||
1008 | ctrl_aux |= 0x4; | ||
1009 | ctrl_aux &= ~0x2; | ||
1010 | ew32(CTL_AUX, ctrl_aux); | ||
1011 | E1000_WRITE_FLUSH(); | ||
1012 | ret_val = e1000_copper_link_rtl_setup(hw); | ||
1013 | |||
1014 | if (ret_val) { | ||
1015 | e_dbg("e1000_copper_link_rtl_setup failed!\n"); | ||
1016 | return ret_val; | ||
1017 | } | ||
1018 | break; | ||
1019 | default: | ||
1020 | e_dbg("Error Resetting the PHY\n"); | ||
1021 | return E1000_ERR_PHY_TYPE; | ||
1022 | } | ||
1023 | |||
1024 | return E1000_SUCCESS; | ||
1025 | } | ||
1026 | |||
1027 | /** | ||
955 | * e1000_copper_link_preconfig - early configuration for copper | 1028 | * e1000_copper_link_preconfig - early configuration for copper |
956 | * @hw: Struct containing variables accessed by shared code | 1029 | * @hw: Struct containing variables accessed by shared code |
957 | * | 1030 | * |
@@ -1286,6 +1359,10 @@ static s32 e1000_copper_link_autoneg(struct e1000_hw *hw) | |||
1286 | if (hw->autoneg_advertised == 0) | 1359 | if (hw->autoneg_advertised == 0) |
1287 | hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; | 1360 | hw->autoneg_advertised = AUTONEG_ADVERTISE_SPEED_DEFAULT; |
1288 | 1361 | ||
1362 | /* IFE/RTL8201N PHY only supports 10/100 */ | ||
1363 | if (hw->phy_type == e1000_phy_8201) | ||
1364 | hw->autoneg_advertised &= AUTONEG_ADVERTISE_10_100_ALL; | ||
1365 | |||
1289 | e_dbg("Reconfiguring auto-neg advertisement params\n"); | 1366 | e_dbg("Reconfiguring auto-neg advertisement params\n"); |
1290 | ret_val = e1000_phy_setup_autoneg(hw); | 1367 | ret_val = e1000_phy_setup_autoneg(hw); |
1291 | if (ret_val) { | 1368 | if (ret_val) { |
@@ -1341,7 +1418,7 @@ static s32 e1000_copper_link_postconfig(struct e1000_hw *hw) | |||
1341 | s32 ret_val; | 1418 | s32 ret_val; |
1342 | e_dbg("e1000_copper_link_postconfig"); | 1419 | e_dbg("e1000_copper_link_postconfig"); |
1343 | 1420 | ||
1344 | if (hw->mac_type >= e1000_82544) { | 1421 | if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) { |
1345 | e1000_config_collision_dist(hw); | 1422 | e1000_config_collision_dist(hw); |
1346 | } else { | 1423 | } else { |
1347 | ret_val = e1000_config_mac_to_phy(hw); | 1424 | ret_val = e1000_config_mac_to_phy(hw); |
@@ -1395,6 +1472,12 @@ static s32 e1000_setup_copper_link(struct e1000_hw *hw) | |||
1395 | ret_val = e1000_copper_link_mgp_setup(hw); | 1472 | ret_val = e1000_copper_link_mgp_setup(hw); |
1396 | if (ret_val) | 1473 | if (ret_val) |
1397 | return ret_val; | 1474 | return ret_val; |
1475 | } else { | ||
1476 | ret_val = gbe_dhg_phy_setup(hw); | ||
1477 | if (ret_val) { | ||
1478 | e_dbg("gbe_dhg_phy_setup failed!\n"); | ||
1479 | return ret_val; | ||
1480 | } | ||
1398 | } | 1481 | } |
1399 | 1482 | ||
1400 | if (hw->autoneg) { | 1483 | if (hw->autoneg) { |
@@ -1461,10 +1544,11 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
1461 | return ret_val; | 1544 | return ret_val; |
1462 | 1545 | ||
1463 | /* Read the MII 1000Base-T Control Register (Address 9). */ | 1546 | /* Read the MII 1000Base-T Control Register (Address 9). */ |
1464 | ret_val = | 1547 | ret_val = e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); |
1465 | e1000_read_phy_reg(hw, PHY_1000T_CTRL, &mii_1000t_ctrl_reg); | ||
1466 | if (ret_val) | 1548 | if (ret_val) |
1467 | return ret_val; | 1549 | return ret_val; |
1550 | else if (hw->phy_type == e1000_phy_8201) | ||
1551 | mii_1000t_ctrl_reg &= ~REG9_SPEED_MASK; | ||
1468 | 1552 | ||
1469 | /* Need to parse both autoneg_advertised and fc and set up | 1553 | /* Need to parse both autoneg_advertised and fc and set up |
1470 | * the appropriate PHY registers. First we will parse for | 1554 | * the appropriate PHY registers. First we will parse for |
@@ -1577,9 +1661,14 @@ s32 e1000_phy_setup_autoneg(struct e1000_hw *hw) | |||
1577 | 1661 | ||
1578 | e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); | 1662 | e_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg); |
1579 | 1663 | ||
1580 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, mii_1000t_ctrl_reg); | 1664 | if (hw->phy_type == e1000_phy_8201) { |
1581 | if (ret_val) | 1665 | mii_1000t_ctrl_reg = 0; |
1582 | return ret_val; | 1666 | } else { |
1667 | ret_val = e1000_write_phy_reg(hw, PHY_1000T_CTRL, | ||
1668 | mii_1000t_ctrl_reg); | ||
1669 | if (ret_val) | ||
1670 | return ret_val; | ||
1671 | } | ||
1583 | 1672 | ||
1584 | return E1000_SUCCESS; | 1673 | return E1000_SUCCESS; |
1585 | } | 1674 | } |
@@ -1860,7 +1949,7 @@ static s32 e1000_config_mac_to_phy(struct e1000_hw *hw) | |||
1860 | 1949 | ||
1861 | /* 82544 or newer MAC, Auto Speed Detection takes care of | 1950 | /* 82544 or newer MAC, Auto Speed Detection takes care of |
1862 | * MAC speed/duplex configuration.*/ | 1951 | * MAC speed/duplex configuration.*/ |
1863 | if (hw->mac_type >= e1000_82544) | 1952 | if ((hw->mac_type >= e1000_82544) && (hw->mac_type != e1000_ce4100)) |
1864 | return E1000_SUCCESS; | 1953 | return E1000_SUCCESS; |
1865 | 1954 | ||
1866 | /* Read the Device Control Register and set the bits to Force Speed | 1955 | /* Read the Device Control Register and set the bits to Force Speed |
@@ -1870,27 +1959,49 @@ static s32 e1000_config_mac_to_phy(struct e1000_hw *hw) | |||
1870 | ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); | 1959 | ctrl |= (E1000_CTRL_FRCSPD | E1000_CTRL_FRCDPX); |
1871 | ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS); | 1960 | ctrl &= ~(E1000_CTRL_SPD_SEL | E1000_CTRL_ILOS); |
1872 | 1961 | ||
1873 | /* Set up duplex in the Device Control and Transmit Control | 1962 | switch (hw->phy_type) { |
1874 | * registers depending on negotiated values. | 1963 | case e1000_phy_8201: |
1875 | */ | 1964 | ret_val = e1000_read_phy_reg(hw, PHY_CTRL, &phy_data); |
1876 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data); | 1965 | if (ret_val) |
1877 | if (ret_val) | 1966 | return ret_val; |
1878 | return ret_val; | ||
1879 | 1967 | ||
1880 | if (phy_data & M88E1000_PSSR_DPLX) | 1968 | if (phy_data & RTL_PHY_CTRL_FD) |
1881 | ctrl |= E1000_CTRL_FD; | 1969 | ctrl |= E1000_CTRL_FD; |
1882 | else | 1970 | else |
1883 | ctrl &= ~E1000_CTRL_FD; | 1971 | ctrl &= ~E1000_CTRL_FD; |
1884 | 1972 | ||
1885 | e1000_config_collision_dist(hw); | 1973 | if (phy_data & RTL_PHY_CTRL_SPD_100) |
1974 | ctrl |= E1000_CTRL_SPD_100; | ||
1975 | else | ||
1976 | ctrl |= E1000_CTRL_SPD_10; | ||
1886 | 1977 | ||
1887 | /* Set up speed in the Device Control register depending on | 1978 | e1000_config_collision_dist(hw); |
1888 | * negotiated values. | 1979 | break; |
1889 | */ | 1980 | default: |
1890 | if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) | 1981 | /* Set up duplex in the Device Control and Transmit Control |
1891 | ctrl |= E1000_CTRL_SPD_1000; | 1982 | * registers depending on negotiated values. |
1892 | else if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_100MBS) | 1983 | */ |
1893 | ctrl |= E1000_CTRL_SPD_100; | 1984 | ret_val = e1000_read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, |
1985 | &phy_data); | ||
1986 | if (ret_val) | ||
1987 | return ret_val; | ||
1988 | |||
1989 | if (phy_data & M88E1000_PSSR_DPLX) | ||
1990 | ctrl |= E1000_CTRL_FD; | ||
1991 | else | ||
1992 | ctrl &= ~E1000_CTRL_FD; | ||
1993 | |||
1994 | e1000_config_collision_dist(hw); | ||
1995 | |||
1996 | /* Set up speed in the Device Control register depending on | ||
1997 | * negotiated values. | ||
1998 | */ | ||
1999 | if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) | ||
2000 | ctrl |= E1000_CTRL_SPD_1000; | ||
2001 | else if ((phy_data & M88E1000_PSSR_SPEED) == | ||
2002 | M88E1000_PSSR_100MBS) | ||
2003 | ctrl |= E1000_CTRL_SPD_100; | ||
2004 | } | ||
1894 | 2005 | ||
1895 | /* Write the configured values back to the Device Control Reg. */ | 2006 | /* Write the configured values back to the Device Control Reg. */ |
1896 | ew32(CTRL, ctrl); | 2007 | ew32(CTRL, ctrl); |
@@ -2401,7 +2512,8 @@ s32 e1000_check_for_link(struct e1000_hw *hw) | |||
2401 | * speed/duplex on the MAC to the current PHY speed/duplex | 2512 | * speed/duplex on the MAC to the current PHY speed/duplex |
2402 | * settings. | 2513 | * settings. |
2403 | */ | 2514 | */ |
2404 | if (hw->mac_type >= e1000_82544) | 2515 | if ((hw->mac_type >= e1000_82544) && |
2516 | (hw->mac_type != e1000_ce4100)) | ||
2405 | e1000_config_collision_dist(hw); | 2517 | e1000_config_collision_dist(hw); |
2406 | else { | 2518 | else { |
2407 | ret_val = e1000_config_mac_to_phy(hw); | 2519 | ret_val = e1000_config_mac_to_phy(hw); |
@@ -2738,7 +2850,7 @@ static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, | |||
2738 | { | 2850 | { |
2739 | u32 i; | 2851 | u32 i; |
2740 | u32 mdic = 0; | 2852 | u32 mdic = 0; |
2741 | const u32 phy_addr = 1; | 2853 | const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; |
2742 | 2854 | ||
2743 | e_dbg("e1000_read_phy_reg_ex"); | 2855 | e_dbg("e1000_read_phy_reg_ex"); |
2744 | 2856 | ||
@@ -2752,28 +2864,61 @@ static s32 e1000_read_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, | |||
2752 | * Control register. The MAC will take care of interfacing with the | 2864 | * Control register. The MAC will take care of interfacing with the |
2753 | * PHY to retrieve the desired data. | 2865 | * PHY to retrieve the desired data. |
2754 | */ | 2866 | */ |
2755 | mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | | 2867 | if (hw->mac_type == e1000_ce4100) { |
2756 | (phy_addr << E1000_MDIC_PHY_SHIFT) | | 2868 | mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | |
2757 | (E1000_MDIC_OP_READ)); | 2869 | (phy_addr << E1000_MDIC_PHY_SHIFT) | |
2870 | (INTEL_CE_GBE_MDIC_OP_READ) | | ||
2871 | (INTEL_CE_GBE_MDIC_GO)); | ||
2758 | 2872 | ||
2759 | ew32(MDIC, mdic); | 2873 | writel(mdic, E1000_MDIO_CMD); |
2760 | 2874 | ||
2761 | /* Poll the ready bit to see if the MDI read completed */ | 2875 | /* Poll the ready bit to see if the MDI read |
2762 | for (i = 0; i < 64; i++) { | 2876 | * completed |
2763 | udelay(50); | 2877 | */ |
2764 | mdic = er32(MDIC); | 2878 | for (i = 0; i < 64; i++) { |
2765 | if (mdic & E1000_MDIC_READY) | 2879 | udelay(50); |
2766 | break; | 2880 | mdic = readl(E1000_MDIO_CMD); |
2767 | } | 2881 | if (!(mdic & INTEL_CE_GBE_MDIC_GO)) |
2768 | if (!(mdic & E1000_MDIC_READY)) { | 2882 | break; |
2769 | e_dbg("MDI Read did not complete\n"); | 2883 | } |
2770 | return -E1000_ERR_PHY; | 2884 | |
2771 | } | 2885 | if (mdic & INTEL_CE_GBE_MDIC_GO) { |
2772 | if (mdic & E1000_MDIC_ERROR) { | 2886 | e_dbg("MDI Read did not complete\n"); |
2773 | e_dbg("MDI Error\n"); | 2887 | return -E1000_ERR_PHY; |
2774 | return -E1000_ERR_PHY; | 2888 | } |
2889 | |||
2890 | mdic = readl(E1000_MDIO_STS); | ||
2891 | if (mdic & INTEL_CE_GBE_MDIC_READ_ERROR) { | ||
2892 | e_dbg("MDI Read Error\n"); | ||
2893 | return -E1000_ERR_PHY; | ||
2894 | } | ||
2895 | *phy_data = (u16) mdic; | ||
2896 | } else { | ||
2897 | mdic = ((reg_addr << E1000_MDIC_REG_SHIFT) | | ||
2898 | (phy_addr << E1000_MDIC_PHY_SHIFT) | | ||
2899 | (E1000_MDIC_OP_READ)); | ||
2900 | |||
2901 | ew32(MDIC, mdic); | ||
2902 | |||
2903 | /* Poll the ready bit to see if the MDI read | ||
2904 | * completed | ||
2905 | */ | ||
2906 | for (i = 0; i < 64; i++) { | ||
2907 | udelay(50); | ||
2908 | mdic = er32(MDIC); | ||
2909 | if (mdic & E1000_MDIC_READY) | ||
2910 | break; | ||
2911 | } | ||
2912 | if (!(mdic & E1000_MDIC_READY)) { | ||
2913 | e_dbg("MDI Read did not complete\n"); | ||
2914 | return -E1000_ERR_PHY; | ||
2915 | } | ||
2916 | if (mdic & E1000_MDIC_ERROR) { | ||
2917 | e_dbg("MDI Error\n"); | ||
2918 | return -E1000_ERR_PHY; | ||
2919 | } | ||
2920 | *phy_data = (u16) mdic; | ||
2775 | } | 2921 | } |
2776 | *phy_data = (u16) mdic; | ||
2777 | } else { | 2922 | } else { |
2778 | /* We must first send a preamble through the MDIO pin to signal the | 2923 | /* We must first send a preamble through the MDIO pin to signal the |
2779 | * beginning of an MII instruction. This is done by sending 32 | 2924 | * beginning of an MII instruction. This is done by sending 32 |
@@ -2840,7 +2985,7 @@ static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, | |||
2840 | { | 2985 | { |
2841 | u32 i; | 2986 | u32 i; |
2842 | u32 mdic = 0; | 2987 | u32 mdic = 0; |
2843 | const u32 phy_addr = 1; | 2988 | const u32 phy_addr = (hw->mac_type == e1000_ce4100) ? hw->phy_addr : 1; |
2844 | 2989 | ||
2845 | e_dbg("e1000_write_phy_reg_ex"); | 2990 | e_dbg("e1000_write_phy_reg_ex"); |
2846 | 2991 | ||
@@ -2850,27 +2995,54 @@ static s32 e1000_write_phy_reg_ex(struct e1000_hw *hw, u32 reg_addr, | |||
2850 | } | 2995 | } |
2851 | 2996 | ||
2852 | if (hw->mac_type > e1000_82543) { | 2997 | if (hw->mac_type > e1000_82543) { |
2853 | /* Set up Op-code, Phy Address, register address, and data intended | 2998 | /* Set up Op-code, Phy Address, register address, and data |
2854 | * for the PHY register in the MDI Control register. The MAC will take | 2999 | * intended for the PHY register in the MDI Control register. |
2855 | * care of interfacing with the PHY to send the desired data. | 3000 | * The MAC will take care of interfacing with the PHY to send |
3001 | * the desired data. | ||
2856 | */ | 3002 | */ |
2857 | mdic = (((u32) phy_data) | | 3003 | if (hw->mac_type == e1000_ce4100) { |
2858 | (reg_addr << E1000_MDIC_REG_SHIFT) | | 3004 | mdic = (((u32) phy_data) | |
2859 | (phy_addr << E1000_MDIC_PHY_SHIFT) | | 3005 | (reg_addr << E1000_MDIC_REG_SHIFT) | |
2860 | (E1000_MDIC_OP_WRITE)); | 3006 | (phy_addr << E1000_MDIC_PHY_SHIFT) | |
3007 | (INTEL_CE_GBE_MDIC_OP_WRITE) | | ||
3008 | (INTEL_CE_GBE_MDIC_GO)); | ||
2861 | 3009 | ||
2862 | ew32(MDIC, mdic); | 3010 | writel(mdic, E1000_MDIO_CMD); |
2863 | 3011 | ||
2864 | /* Poll the ready bit to see if the MDI read completed */ | 3012 | /* Poll the ready bit to see if the MDI read |
2865 | for (i = 0; i < 641; i++) { | 3013 | * completed |
2866 | udelay(5); | 3014 | */ |
2867 | mdic = er32(MDIC); | 3015 | for (i = 0; i < 640; i++) { |
2868 | if (mdic & E1000_MDIC_READY) | 3016 | udelay(5); |
2869 | break; | 3017 | mdic = readl(E1000_MDIO_CMD); |
2870 | } | 3018 | if (!(mdic & INTEL_CE_GBE_MDIC_GO)) |
2871 | if (!(mdic & E1000_MDIC_READY)) { | 3019 | break; |
2872 | e_dbg("MDI Write did not complete\n"); | 3020 | } |
2873 | return -E1000_ERR_PHY; | 3021 | if (mdic & INTEL_CE_GBE_MDIC_GO) { |
3022 | e_dbg("MDI Write did not complete\n"); | ||
3023 | return -E1000_ERR_PHY; | ||
3024 | } | ||
3025 | } else { | ||
3026 | mdic = (((u32) phy_data) | | ||
3027 | (reg_addr << E1000_MDIC_REG_SHIFT) | | ||
3028 | (phy_addr << E1000_MDIC_PHY_SHIFT) | | ||
3029 | (E1000_MDIC_OP_WRITE)); | ||
3030 | |||
3031 | ew32(MDIC, mdic); | ||
3032 | |||
3033 | /* Poll the ready bit to see if the MDI read | ||
3034 | * completed | ||
3035 | */ | ||
3036 | for (i = 0; i < 641; i++) { | ||
3037 | udelay(5); | ||
3038 | mdic = er32(MDIC); | ||
3039 | if (mdic & E1000_MDIC_READY) | ||
3040 | break; | ||
3041 | } | ||
3042 | if (!(mdic & E1000_MDIC_READY)) { | ||
3043 | e_dbg("MDI Write did not complete\n"); | ||
3044 | return -E1000_ERR_PHY; | ||
3045 | } | ||
2874 | } | 3046 | } |
2875 | } else { | 3047 | } else { |
2876 | /* We'll need to use the SW defined pins to shift the write command | 3048 | /* We'll need to use the SW defined pins to shift the write command |
@@ -3048,6 +3220,11 @@ static s32 e1000_detect_gig_phy(struct e1000_hw *hw) | |||
3048 | if (hw->phy_id == M88E1011_I_PHY_ID) | 3220 | if (hw->phy_id == M88E1011_I_PHY_ID) |
3049 | match = true; | 3221 | match = true; |
3050 | break; | 3222 | break; |
3223 | case e1000_ce4100: | ||
3224 | if ((hw->phy_id == RTL8211B_PHY_ID) || | ||
3225 | (hw->phy_id == RTL8201N_PHY_ID)) | ||
3226 | match = true; | ||
3227 | break; | ||
3051 | case e1000_82541: | 3228 | case e1000_82541: |
3052 | case e1000_82541_rev_2: | 3229 | case e1000_82541_rev_2: |
3053 | case e1000_82547: | 3230 | case e1000_82547: |
@@ -3291,6 +3468,9 @@ s32 e1000_phy_get_info(struct e1000_hw *hw, struct e1000_phy_info *phy_info) | |||
3291 | 3468 | ||
3292 | if (hw->phy_type == e1000_phy_igp) | 3469 | if (hw->phy_type == e1000_phy_igp) |
3293 | return e1000_phy_igp_get_info(hw, phy_info); | 3470 | return e1000_phy_igp_get_info(hw, phy_info); |
3471 | else if ((hw->phy_type == e1000_phy_8211) || | ||
3472 | (hw->phy_type == e1000_phy_8201)) | ||
3473 | return E1000_SUCCESS; | ||
3294 | else | 3474 | else |
3295 | return e1000_phy_m88_get_info(hw, phy_info); | 3475 | return e1000_phy_m88_get_info(hw, phy_info); |
3296 | } | 3476 | } |
@@ -3742,6 +3922,12 @@ static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, | |||
3742 | 3922 | ||
3743 | e_dbg("e1000_read_eeprom"); | 3923 | e_dbg("e1000_read_eeprom"); |
3744 | 3924 | ||
3925 | if (hw->mac_type == e1000_ce4100) { | ||
3926 | GBE_CONFIG_FLASH_READ(GBE_CONFIG_BASE_VIRT, offset, words, | ||
3927 | data); | ||
3928 | return E1000_SUCCESS; | ||
3929 | } | ||
3930 | |||
3745 | /* If eeprom is not yet detected, do so now */ | 3931 | /* If eeprom is not yet detected, do so now */ |
3746 | if (eeprom->word_size == 0) | 3932 | if (eeprom->word_size == 0) |
3747 | e1000_init_eeprom_params(hw); | 3933 | e1000_init_eeprom_params(hw); |
@@ -3904,6 +4090,12 @@ static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, | |||
3904 | 4090 | ||
3905 | e_dbg("e1000_write_eeprom"); | 4091 | e_dbg("e1000_write_eeprom"); |
3906 | 4092 | ||
4093 | if (hw->mac_type == e1000_ce4100) { | ||
4094 | GBE_CONFIG_FLASH_WRITE(GBE_CONFIG_BASE_VIRT, offset, words, | ||
4095 | data); | ||
4096 | return E1000_SUCCESS; | ||
4097 | } | ||
4098 | |||
3907 | /* If eeprom is not yet detected, do so now */ | 4099 | /* If eeprom is not yet detected, do so now */ |
3908 | if (eeprom->word_size == 0) | 4100 | if (eeprom->word_size == 0) |
3909 | e1000_init_eeprom_params(hw); | 4101 | e1000_init_eeprom_params(hw); |