aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb/ixgb_hw.c
diff options
context:
space:
mode:
authorMatheos Worku <matheos.worku@sun.com>2007-12-14 14:48:36 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:07:17 -0500
commit8b32e63d48d43f3843222ca66fecd45ff2a74147 (patch)
tree4ae452cf63f066fe839e3d6eb3f222f315163509 /drivers/net/ixgb/ixgb_hw.c
parent67cefcbafc16d01f9d64be8c62cccfd30b3b07c2 (diff)
ixgb: enable sun hardware support for broadcom phy
Implement support for a SUN-specific PHY. SUN provides a modified 82597-based board with their own PHY that works with very little modification to the code. This patch implements this new PHY which is identified by the subvendor device ID. The device ID of the adapter remains the same. Signed-off-by: Matheos Worku <matheos.worku@sun.com> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ixgb/ixgb_hw.c')
-rw-r--r--drivers/net/ixgb/ixgb_hw.c82
1 files changed, 80 insertions, 2 deletions
diff --git a/drivers/net/ixgb/ixgb_hw.c b/drivers/net/ixgb/ixgb_hw.c
index 2c6367ace3cd..80a8b9888225 100644
--- a/drivers/net/ixgb/ixgb_hw.c
+++ b/drivers/net/ixgb/ixgb_hw.c
@@ -45,6 +45,8 @@ static boolean_t ixgb_link_reset(struct ixgb_hw *hw);
45 45
46static void ixgb_optics_reset(struct ixgb_hw *hw); 46static void ixgb_optics_reset(struct ixgb_hw *hw);
47 47
48static void ixgb_optics_reset_bcm(struct ixgb_hw *hw);
49
48static ixgb_phy_type ixgb_identify_phy(struct ixgb_hw *hw); 50static ixgb_phy_type ixgb_identify_phy(struct ixgb_hw *hw);
49 51
50static void ixgb_clear_hw_cntrs(struct ixgb_hw *hw); 52static void ixgb_clear_hw_cntrs(struct ixgb_hw *hw);
@@ -90,10 +92,20 @@ static uint32_t ixgb_mac_reset(struct ixgb_hw *hw)
90 ASSERT(!(ctrl_reg & IXGB_CTRL0_RST)); 92 ASSERT(!(ctrl_reg & IXGB_CTRL0_RST));
91#endif 93#endif
92 94
93 if (hw->phy_type == ixgb_phy_type_txn17401) { 95 if (hw->subsystem_vendor_id == SUN_SUBVENDOR_ID) {
94 ixgb_optics_reset(hw); 96 ctrl_reg = /* Enable interrupt from XFP and SerDes */
97 IXGB_CTRL1_GPI0_EN |
98 IXGB_CTRL1_SDP6_DIR |
99 IXGB_CTRL1_SDP7_DIR |
100 IXGB_CTRL1_SDP6 |
101 IXGB_CTRL1_SDP7;
102 IXGB_WRITE_REG(hw, CTRL1, ctrl_reg);
103 ixgb_optics_reset_bcm(hw);
95 } 104 }
96 105
106 if (hw->phy_type == ixgb_phy_type_txn17401)
107 ixgb_optics_reset(hw);
108
97 return ctrl_reg; 109 return ctrl_reg;
98} 110}
99 111
@@ -253,6 +265,10 @@ ixgb_identify_phy(struct ixgb_hw *hw)
253 break; 265 break;
254 } 266 }
255 267
268 /* update phy type for sun specific board */
269 if (hw->subsystem_vendor_id == SUN_SUBVENDOR_ID)
270 phy_type = ixgb_phy_type_bcm;
271
256 return (phy_type); 272 return (phy_type);
257} 273}
258 274
@@ -1225,3 +1241,65 @@ ixgb_optics_reset(struct ixgb_hw *hw)
1225 1241
1226 return; 1242 return;
1227} 1243}
1244
1245/******************************************************************************
1246 * Resets the 10GbE optics module for Sun variant NIC.
1247 *
1248 * hw - Struct containing variables accessed by shared code
1249 *****************************************************************************/
1250
1251#define IXGB_BCM8704_USER_PMD_TX_CTRL_REG 0xC803
1252#define IXGB_BCM8704_USER_PMD_TX_CTRL_REG_VAL 0x0164
1253#define IXGB_BCM8704_USER_CTRL_REG 0xC800
1254#define IXGB_BCM8704_USER_CTRL_REG_VAL 0x7FBF
1255#define IXGB_BCM8704_USER_DEV3_ADDR 0x0003
1256#define IXGB_SUN_PHY_ADDRESS 0x0000
1257#define IXGB_SUN_PHY_RESET_DELAY 305
1258
1259static void
1260ixgb_optics_reset_bcm(struct ixgb_hw *hw)
1261{
1262 u32 ctrl = IXGB_READ_REG(hw, CTRL0);
1263 ctrl &= ~IXGB_CTRL0_SDP2;
1264 ctrl |= IXGB_CTRL0_SDP3;
1265 IXGB_WRITE_REG(hw, CTRL0, ctrl);
1266
1267 /* SerDes needs extra delay */
1268 msleep(IXGB_SUN_PHY_RESET_DELAY);
1269
1270 /* Broadcom 7408L configuration */
1271 /* Reference clock config */
1272 ixgb_write_phy_reg(hw,
1273 IXGB_BCM8704_USER_PMD_TX_CTRL_REG,
1274 IXGB_SUN_PHY_ADDRESS,
1275 IXGB_BCM8704_USER_DEV3_ADDR,
1276 IXGB_BCM8704_USER_PMD_TX_CTRL_REG_VAL);
1277 /* we must read the registers twice */
1278 ixgb_read_phy_reg(hw,
1279 IXGB_BCM8704_USER_PMD_TX_CTRL_REG,
1280 IXGB_SUN_PHY_ADDRESS,
1281 IXGB_BCM8704_USER_DEV3_ADDR);
1282 ixgb_read_phy_reg(hw,
1283 IXGB_BCM8704_USER_PMD_TX_CTRL_REG,
1284 IXGB_SUN_PHY_ADDRESS,
1285 IXGB_BCM8704_USER_DEV3_ADDR);
1286
1287 ixgb_write_phy_reg(hw,
1288 IXGB_BCM8704_USER_CTRL_REG,
1289 IXGB_SUN_PHY_ADDRESS,
1290 IXGB_BCM8704_USER_DEV3_ADDR,
1291 IXGB_BCM8704_USER_CTRL_REG_VAL);
1292 ixgb_read_phy_reg(hw,
1293 IXGB_BCM8704_USER_CTRL_REG,
1294 IXGB_SUN_PHY_ADDRESS,
1295 IXGB_BCM8704_USER_DEV3_ADDR);
1296 ixgb_read_phy_reg(hw,
1297 IXGB_BCM8704_USER_CTRL_REG,
1298 IXGB_SUN_PHY_ADDRESS,
1299 IXGB_BCM8704_USER_DEV3_ADDR);
1300
1301 /* SerDes needs extra delay */
1302 msleep(IXGB_SUN_PHY_RESET_DELAY);
1303
1304 return;
1305}