aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDirk Brandewie <dirk.j.brandewie@intel.com>2011-01-06 09:29:54 -0500
committerDavid S. Miller <davem@davemloft.net>2011-01-10 02:44:10 -0500
commit5377a4160bb65ee4dd11b4b1d081d86d56d92bff (patch)
tree977dc6639906ff8d7b27a8c5e569cb8ab91f5625 /drivers
parent77996d1d4c1cf0059f5c2d1cea9d5135ac1b8c91 (diff)
e1000: Add support for the CE4100 reference platform
This patch adds support for the gigabit phys present on the CE4100 reference platforms. Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com> Tested-by: Jeff Pieper <jeffrey.e.pieper@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/e1000/e1000_hw.c328
-rw-r--r--drivers/net/e1000/e1000_hw.h59
-rw-r--r--drivers/net/e1000/e1000_main.c35
-rw-r--r--drivers/net/e1000/e1000_osdep.h19
4 files changed, 365 insertions, 76 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 */
972static 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
986static 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);
diff --git a/drivers/net/e1000/e1000_hw.h b/drivers/net/e1000/e1000_hw.h
index ecd9f6c6bcd5..f5514a0d5be6 100644
--- a/drivers/net/e1000/e1000_hw.h
+++ b/drivers/net/e1000/e1000_hw.h
@@ -52,6 +52,7 @@ typedef enum {
52 e1000_82545, 52 e1000_82545,
53 e1000_82545_rev_3, 53 e1000_82545_rev_3,
54 e1000_82546, 54 e1000_82546,
55 e1000_ce4100,
55 e1000_82546_rev_3, 56 e1000_82546_rev_3,
56 e1000_82541, 57 e1000_82541,
57 e1000_82541_rev_2, 58 e1000_82541_rev_2,
@@ -209,9 +210,11 @@ typedef enum {
209} e1000_1000t_rx_status; 210} e1000_1000t_rx_status;
210 211
211typedef enum { 212typedef enum {
212 e1000_phy_m88 = 0, 213 e1000_phy_m88 = 0,
213 e1000_phy_igp, 214 e1000_phy_igp,
214 e1000_phy_undefined = 0xFF 215 e1000_phy_8211,
216 e1000_phy_8201,
217 e1000_phy_undefined = 0xFF
215} e1000_phy_type; 218} e1000_phy_type;
216 219
217typedef enum { 220typedef enum {
@@ -442,6 +445,7 @@ void e1000_io_write(struct e1000_hw *hw, unsigned long port, u32 value);
442#define E1000_DEV_ID_82547EI 0x1019 445#define E1000_DEV_ID_82547EI 0x1019
443#define E1000_DEV_ID_82547EI_MOBILE 0x101A 446#define E1000_DEV_ID_82547EI_MOBILE 0x101A
444#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5 447#define E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3 0x10B5
448#define E1000_DEV_ID_INTEL_CE4100_GBE 0x2E6E
445 449
446#define NODE_ADDRESS_SIZE 6 450#define NODE_ADDRESS_SIZE 6
447#define ETH_LENGTH_OF_ADDRESS 6 451#define ETH_LENGTH_OF_ADDRESS 6
@@ -808,6 +812,16 @@ struct e1000_ffvt_entry {
808#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */ 812#define E1000_CTRL_EXT 0x00018 /* Extended Device Control - RW */
809#define E1000_FLA 0x0001C /* Flash Access - RW */ 813#define E1000_FLA 0x0001C /* Flash Access - RW */
810#define E1000_MDIC 0x00020 /* MDI Control - RW */ 814#define E1000_MDIC 0x00020 /* MDI Control - RW */
815
816extern void __iomem *ce4100_gbe_mdio_base_virt;
817#define INTEL_CE_GBE_MDIO_RCOMP_BASE (ce4100_gbe_mdio_base_virt)
818#define E1000_MDIO_STS (INTEL_CE_GBE_MDIO_RCOMP_BASE + 0)
819#define E1000_MDIO_CMD (INTEL_CE_GBE_MDIO_RCOMP_BASE + 4)
820#define E1000_MDIO_DRV (INTEL_CE_GBE_MDIO_RCOMP_BASE + 8)
821#define E1000_MDC_CMD (INTEL_CE_GBE_MDIO_RCOMP_BASE + 0xC)
822#define E1000_RCOMP_CTL (INTEL_CE_GBE_MDIO_RCOMP_BASE + 0x20)
823#define E1000_RCOMP_STS (INTEL_CE_GBE_MDIO_RCOMP_BASE + 0x24)
824
811#define E1000_SCTL 0x00024 /* SerDes Control - RW */ 825#define E1000_SCTL 0x00024 /* SerDes Control - RW */
812#define E1000_FEXTNVM 0x00028 /* Future Extended NVM register */ 826#define E1000_FEXTNVM 0x00028 /* Future Extended NVM register */
813#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */ 827#define E1000_FCAL 0x00028 /* Flow Control Address Low - RW */
@@ -820,6 +834,34 @@ struct e1000_ffvt_entry {
820#define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */ 834#define E1000_IMS 0x000D0 /* Interrupt Mask Set - RW */
821#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */ 835#define E1000_IMC 0x000D8 /* Interrupt Mask Clear - WO */
822#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */ 836#define E1000_IAM 0x000E0 /* Interrupt Acknowledge Auto Mask */
837
838/* Auxiliary Control Register. This register is CE4100 specific,
839 * RMII/RGMII function is switched by this register - RW
840 * Following are bits definitions of the Auxiliary Control Register
841 */
842#define E1000_CTL_AUX 0x000E0
843#define E1000_CTL_AUX_END_SEL_SHIFT 10
844#define E1000_CTL_AUX_ENDIANESS_SHIFT 8
845#define E1000_CTL_AUX_RGMII_RMII_SHIFT 0
846
847/* descriptor and packet transfer use CTL_AUX.ENDIANESS */
848#define E1000_CTL_AUX_DES_PKT (0x0 << E1000_CTL_AUX_END_SEL_SHIFT)
849/* descriptor use CTL_AUX.ENDIANESS, packet use default */
850#define E1000_CTL_AUX_DES (0x1 << E1000_CTL_AUX_END_SEL_SHIFT)
851/* descriptor use default, packet use CTL_AUX.ENDIANESS */
852#define E1000_CTL_AUX_PKT (0x2 << E1000_CTL_AUX_END_SEL_SHIFT)
853/* all use CTL_AUX.ENDIANESS */
854#define E1000_CTL_AUX_ALL (0x3 << E1000_CTL_AUX_END_SEL_SHIFT)
855
856#define E1000_CTL_AUX_RGMII (0x0 << E1000_CTL_AUX_RGMII_RMII_SHIFT)
857#define E1000_CTL_AUX_RMII (0x1 << E1000_CTL_AUX_RGMII_RMII_SHIFT)
858
859/* LW little endian, Byte big endian */
860#define E1000_CTL_AUX_LWLE_BBE (0x0 << E1000_CTL_AUX_ENDIANESS_SHIFT)
861#define E1000_CTL_AUX_LWLE_BLE (0x1 << E1000_CTL_AUX_ENDIANESS_SHIFT)
862#define E1000_CTL_AUX_LWBE_BBE (0x2 << E1000_CTL_AUX_ENDIANESS_SHIFT)
863#define E1000_CTL_AUX_LWBE_BLE (0x3 << E1000_CTL_AUX_ENDIANESS_SHIFT)
864
823#define E1000_RCTL 0x00100 /* RX Control - RW */ 865#define E1000_RCTL 0x00100 /* RX Control - RW */
824#define E1000_RDTR1 0x02820 /* RX Delay Timer (1) - RW */ 866#define E1000_RDTR1 0x02820 /* RX Delay Timer (1) - RW */
825#define E1000_RDBAL1 0x02900 /* RX Descriptor Base Address Low (1) - RW */ 867#define E1000_RDBAL1 0x02900 /* RX Descriptor Base Address Low (1) - RW */
@@ -1011,6 +1053,7 @@ struct e1000_ffvt_entry {
1011 * in more current versions of the 8254x. Despite the difference in location, 1053 * in more current versions of the 8254x. Despite the difference in location,
1012 * the registers function in the same manner. 1054 * the registers function in the same manner.
1013 */ 1055 */
1056#define E1000_82542_CTL_AUX E1000_CTL_AUX
1014#define E1000_82542_CTRL E1000_CTRL 1057#define E1000_82542_CTRL E1000_CTRL
1015#define E1000_82542_CTRL_DUP E1000_CTRL_DUP 1058#define E1000_82542_CTRL_DUP E1000_CTRL_DUP
1016#define E1000_82542_STATUS E1000_STATUS 1059#define E1000_82542_STATUS E1000_STATUS
@@ -1571,6 +1614,11 @@ struct e1000_hw {
1571#define E1000_MDIC_INT_EN 0x20000000 1614#define E1000_MDIC_INT_EN 0x20000000
1572#define E1000_MDIC_ERROR 0x40000000 1615#define E1000_MDIC_ERROR 0x40000000
1573 1616
1617#define INTEL_CE_GBE_MDIC_OP_WRITE 0x04000000
1618#define INTEL_CE_GBE_MDIC_OP_READ 0x00000000
1619#define INTEL_CE_GBE_MDIC_GO 0x80000000
1620#define INTEL_CE_GBE_MDIC_READ_ERROR 0x80000000
1621
1574#define E1000_KUMCTRLSTA_MASK 0x0000FFFF 1622#define E1000_KUMCTRLSTA_MASK 0x0000FFFF
1575#define E1000_KUMCTRLSTA_OFFSET 0x001F0000 1623#define E1000_KUMCTRLSTA_OFFSET 0x001F0000
1576#define E1000_KUMCTRLSTA_OFFSET_SHIFT 16 1624#define E1000_KUMCTRLSTA_OFFSET_SHIFT 16
@@ -2871,6 +2919,11 @@ struct e1000_host_command_info {
2871#define M88E1111_I_PHY_ID 0x01410CC0 2919#define M88E1111_I_PHY_ID 0x01410CC0
2872#define L1LXT971A_PHY_ID 0x001378E0 2920#define L1LXT971A_PHY_ID 0x001378E0
2873 2921
2922#define RTL8211B_PHY_ID 0x001CC910
2923#define RTL8201N_PHY_ID 0x8200
2924#define RTL_PHY_CTRL_FD 0x0100 /* Full duplex.0=half; 1=full */
2925#define RTL_PHY_CTRL_SPD_100 0x200000 /* Force 100Mb */
2926
2874/* Bits... 2927/* Bits...
2875 * 15-5: page 2928 * 15-5: page
2876 * 4-0: register offset 2929 * 4-0: register offset
diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c
index 340e12d2e4a9..4ff88a683f61 100644
--- a/drivers/net/e1000/e1000_main.c
+++ b/drivers/net/e1000/e1000_main.c
@@ -28,6 +28,12 @@
28 28
29#include "e1000.h" 29#include "e1000.h"
30#include <net/ip6_checksum.h> 30#include <net/ip6_checksum.h>
31#include <linux/io.h>
32
33/* Intel Media SOC GbE MDIO physical base address */
34static unsigned long ce4100_gbe_mdio_base_phy;
35/* Intel Media SOC GbE MDIO virtual base address */
36void __iomem *ce4100_gbe_mdio_base_virt;
31 37
32char e1000_driver_name[] = "e1000"; 38char e1000_driver_name[] = "e1000";
33static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver"; 39static char e1000_driver_string[] = "Intel(R) PRO/1000 Network Driver";
@@ -79,6 +85,7 @@ static DEFINE_PCI_DEVICE_TABLE(e1000_pci_tbl) = {
79 INTEL_E1000_ETHERNET_DEVICE(0x108A), 85 INTEL_E1000_ETHERNET_DEVICE(0x108A),
80 INTEL_E1000_ETHERNET_DEVICE(0x1099), 86 INTEL_E1000_ETHERNET_DEVICE(0x1099),
81 INTEL_E1000_ETHERNET_DEVICE(0x10B5), 87 INTEL_E1000_ETHERNET_DEVICE(0x10B5),
88 INTEL_E1000_ETHERNET_DEVICE(0x2E6E),
82 /* required last entry */ 89 /* required last entry */
83 {0,} 90 {0,}
84}; 91};
@@ -459,6 +466,7 @@ static void e1000_power_down_phy(struct e1000_adapter *adapter)
459 case e1000_82545: 466 case e1000_82545:
460 case e1000_82545_rev_3: 467 case e1000_82545_rev_3:
461 case e1000_82546: 468 case e1000_82546:
469 case e1000_ce4100:
462 case e1000_82546_rev_3: 470 case e1000_82546_rev_3:
463 case e1000_82541: 471 case e1000_82541:
464 case e1000_82541_rev_2: 472 case e1000_82541_rev_2:
@@ -573,6 +581,7 @@ void e1000_reset(struct e1000_adapter *adapter)
573 case e1000_82545: 581 case e1000_82545:
574 case e1000_82545_rev_3: 582 case e1000_82545_rev_3:
575 case e1000_82546: 583 case e1000_82546:
584 case e1000_ce4100:
576 case e1000_82546_rev_3: 585 case e1000_82546_rev_3:
577 pba = E1000_PBA_48K; 586 pba = E1000_PBA_48K;
578 break; 587 break;
@@ -894,6 +903,7 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
894 static int global_quad_port_a = 0; /* global ksp3 port a indication */ 903 static int global_quad_port_a = 0; /* global ksp3 port a indication */
895 int i, err, pci_using_dac; 904 int i, err, pci_using_dac;
896 u16 eeprom_data = 0; 905 u16 eeprom_data = 0;
906 u16 tmp = 0;
897 u16 eeprom_apme_mask = E1000_EEPROM_APME; 907 u16 eeprom_apme_mask = E1000_EEPROM_APME;
898 int bars, need_ioport; 908 int bars, need_ioport;
899 909
@@ -996,6 +1006,14 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
996 goto err_sw_init; 1006 goto err_sw_init;
997 1007
998 err = -EIO; 1008 err = -EIO;
1009 if (hw->mac_type == e1000_ce4100) {
1010 ce4100_gbe_mdio_base_phy = pci_resource_start(pdev, BAR_1);
1011 ce4100_gbe_mdio_base_virt = ioremap(ce4100_gbe_mdio_base_phy,
1012 pci_resource_len(pdev, BAR_1));
1013
1014 if (!ce4100_gbe_mdio_base_virt)
1015 goto err_mdio_ioremap;
1016 }
999 1017
1000 if (hw->mac_type >= e1000_82543) { 1018 if (hw->mac_type >= e1000_82543) {
1001 netdev->features = NETIF_F_SG | 1019 netdev->features = NETIF_F_SG |
@@ -1135,6 +1153,20 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
1135 adapter->wol = adapter->eeprom_wol; 1153 adapter->wol = adapter->eeprom_wol;
1136 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol); 1154 device_set_wakeup_enable(&adapter->pdev->dev, adapter->wol);
1137 1155
1156 /* Auto detect PHY address */
1157 if (hw->mac_type == e1000_ce4100) {
1158 for (i = 0; i < 32; i++) {
1159 hw->phy_addr = i;
1160 e1000_read_phy_reg(hw, PHY_ID2, &tmp);
1161 if (tmp == 0 || tmp == 0xFF) {
1162 if (i == 31)
1163 goto err_eeprom;
1164 continue;
1165 } else
1166 break;
1167 }
1168 }
1169
1138 /* reset the hardware with the new settings */ 1170 /* reset the hardware with the new settings */
1139 e1000_reset(adapter); 1171 e1000_reset(adapter);
1140 1172
@@ -1171,6 +1203,8 @@ err_eeprom:
1171 kfree(adapter->rx_ring); 1203 kfree(adapter->rx_ring);
1172err_dma: 1204err_dma:
1173err_sw_init: 1205err_sw_init:
1206err_mdio_ioremap:
1207 iounmap(ce4100_gbe_mdio_base_virt);
1174 iounmap(hw->hw_addr); 1208 iounmap(hw->hw_addr);
1175err_ioremap: 1209err_ioremap:
1176 free_netdev(netdev); 1210 free_netdev(netdev);
@@ -1409,6 +1443,7 @@ static bool e1000_check_64k_bound(struct e1000_adapter *adapter, void *start,
1409 /* First rev 82545 and 82546 need to not allow any memory 1443 /* First rev 82545 and 82546 need to not allow any memory
1410 * write location to cross 64k boundary due to errata 23 */ 1444 * write location to cross 64k boundary due to errata 23 */
1411 if (hw->mac_type == e1000_82545 || 1445 if (hw->mac_type == e1000_82545 ||
1446 hw->mac_type == e1000_ce4100 ||
1412 hw->mac_type == e1000_82546) { 1447 hw->mac_type == e1000_82546) {
1413 return ((begin ^ (end - 1)) >> 16) != 0 ? false : true; 1448 return ((begin ^ (end - 1)) >> 16) != 0 ? false : true;
1414 } 1449 }
diff --git a/drivers/net/e1000/e1000_osdep.h b/drivers/net/e1000/e1000_osdep.h
index edd1c75aa895..55c1711f1688 100644
--- a/drivers/net/e1000/e1000_osdep.h
+++ b/drivers/net/e1000/e1000_osdep.h
@@ -34,12 +34,21 @@
34#ifndef _E1000_OSDEP_H_ 34#ifndef _E1000_OSDEP_H_
35#define _E1000_OSDEP_H_ 35#define _E1000_OSDEP_H_
36 36
37#include <linux/types.h>
38#include <linux/pci.h>
39#include <linux/delay.h>
40#include <asm/io.h> 37#include <asm/io.h>
41#include <linux/interrupt.h> 38
42#include <linux/sched.h> 39#define CONFIG_RAM_BASE 0x60000
40#define GBE_CONFIG_OFFSET 0x0
41
42#define GBE_CONFIG_RAM_BASE \
43 ((unsigned int)(CONFIG_RAM_BASE + GBE_CONFIG_OFFSET))
44
45#define GBE_CONFIG_BASE_VIRT phys_to_virt(GBE_CONFIG_RAM_BASE)
46
47#define GBE_CONFIG_FLASH_WRITE(base, offset, count, data) \
48 (iowrite16_rep(base + offset, data, count))
49
50#define GBE_CONFIG_FLASH_READ(base, offset, count, data) \
51 (ioread16_rep(base + (offset << 1), data, count))
43 52
44#define er32(reg) \ 53#define er32(reg) \
45 (readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \ 54 (readl(hw->hw_addr + ((hw->mac_type >= e1000_82543) \