aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaniv Rosner <yaniv.rosner@broadcom.com>2010-09-07 07:41:20 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-07 16:15:42 -0400
commita22f078867ef362e35c54055878168e6613ff743 (patch)
tree2cf683f3057b7ed5dcaaaad16192f3a267dcf0f8
parentde6eae1f42eae736548f293570fd867bd37c3bdd (diff)
bnx2x: Add dual-media changes
Add required changes in order to support dual-media boards. Signed-off-by: Yaniv Rosner <yanivr@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bnx2x/bnx2x.h10
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.c14
-rw-r--r--drivers/net/bnx2x/bnx2x_cmn.h3
-rw-r--r--drivers/net/bnx2x/bnx2x_ethtool.c176
-rw-r--r--drivers/net/bnx2x/bnx2x_hsi.h111
-rw-r--r--drivers/net/bnx2x/bnx2x_link.c695
-rw-r--r--drivers/net/bnx2x/bnx2x_link.h62
-rw-r--r--drivers/net/bnx2x/bnx2x_main.c354
-rw-r--r--drivers/net/bnx2x/bnx2x_reg.h25
9 files changed, 1074 insertions, 376 deletions
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index a019c67d2995..137187684f27 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -566,13 +566,13 @@ struct bnx2x_common {
566struct bnx2x_port { 566struct bnx2x_port {
567 u32 pmf; 567 u32 pmf;
568 568
569 u32 link_config; 569 u32 link_config[LINK_CONFIG_SIZE];
570 570
571 u32 supported; 571 u32 supported[LINK_CONFIG_SIZE];
572/* link settings - missing defines */ 572/* link settings - missing defines */
573#define SUPPORTED_2500baseX_Full (1 << 15) 573#define SUPPORTED_2500baseX_Full (1 << 15)
574 574
575 u32 advertising; 575 u32 advertising[LINK_CONFIG_SIZE];
576/* link settings - missing defines */ 576/* link settings - missing defines */
577#define ADVERTISED_2500baseX_Full (1 << 15) 577#define ADVERTISED_2500baseX_Full (1 << 15)
578 578
@@ -931,7 +931,7 @@ void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
931int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port); 931int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port);
932int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port); 932int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port);
933int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port); 933int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port);
934u32 bnx2x_fw_command(struct bnx2x *bp, u32 command); 934u32 bnx2x_fw_command(struct bnx2x *bp, u32 command, u32 param);
935void bnx2x_reg_wr_ind(struct bnx2x *bp, u32 addr, u32 val); 935void bnx2x_reg_wr_ind(struct bnx2x *bp, u32 addr, u32 val);
936void bnx2x_write_dmae_phys_len(struct bnx2x *bp, dma_addr_t phys_addr, 936void bnx2x_write_dmae_phys_len(struct bnx2x *bp, dma_addr_t phys_addr,
937 u32 addr, u32 len); 937 u32 addr, u32 len);
@@ -939,7 +939,7 @@ void bnx2x_calc_fc_adv(struct bnx2x *bp);
939int bnx2x_sp_post(struct bnx2x *bp, int command, int cid, 939int bnx2x_sp_post(struct bnx2x *bp, int command, int cid,
940 u32 data_hi, u32 data_lo, int common); 940 u32 data_hi, u32 data_lo, int common);
941void bnx2x_update_coalesce(struct bnx2x *bp); 941void bnx2x_update_coalesce(struct bnx2x *bp);
942 942int bnx2x_get_link_cfg_idx(struct bnx2x *bp);
943static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms, 943static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
944 int wait) 944 int wait)
945{ 945{
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 0e4caf411905..7f1d291eaaa5 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -1283,7 +1283,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1283 common blocks should be initialized, otherwise - not 1283 common blocks should be initialized, otherwise - not
1284 */ 1284 */
1285 if (!BP_NOMCP(bp)) { 1285 if (!BP_NOMCP(bp)) {
1286 load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ); 1286 load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_REQ, 0);
1287 if (!load_code) { 1287 if (!load_code) {
1288 BNX2X_ERR("MCP response failure, aborting\n"); 1288 BNX2X_ERR("MCP response failure, aborting\n");
1289 rc = -EBUSY; 1289 rc = -EBUSY;
@@ -1322,9 +1322,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1322 rc = bnx2x_init_hw(bp, load_code); 1322 rc = bnx2x_init_hw(bp, load_code);
1323 if (rc) { 1323 if (rc) {
1324 BNX2X_ERR("HW init failed, aborting\n"); 1324 BNX2X_ERR("HW init failed, aborting\n");
1325 bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_DONE); 1325 bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_DONE, 0);
1326 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP); 1326 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP, 0);
1327 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE); 1327 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0);
1328 goto load_error2; 1328 goto load_error2;
1329 } 1329 }
1330 1330
@@ -1339,7 +1339,7 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
1339 1339
1340 /* Send LOAD_DONE command to MCP */ 1340 /* Send LOAD_DONE command to MCP */
1341 if (!BP_NOMCP(bp)) { 1341 if (!BP_NOMCP(bp)) {
1342 load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_DONE); 1342 load_code = bnx2x_fw_command(bp, DRV_MSG_CODE_LOAD_DONE, 0);
1343 if (!load_code) { 1343 if (!load_code) {
1344 BNX2X_ERR("MCP response failure, aborting\n"); 1344 BNX2X_ERR("MCP response failure, aborting\n");
1345 rc = -EBUSY; 1345 rc = -EBUSY;
@@ -1455,8 +1455,8 @@ load_error4:
1455load_error3: 1455load_error3:
1456 bnx2x_int_disable_sync(bp, 1); 1456 bnx2x_int_disable_sync(bp, 1);
1457 if (!BP_NOMCP(bp)) { 1457 if (!BP_NOMCP(bp)) {
1458 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP); 1458 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_REQ_WOL_MCP, 0);
1459 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE); 1459 bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE, 0);
1460 } 1460 }
1461 bp->port.pmf = 0; 1461 bp->port.pmf = 0;
1462 /* Free SKBs, SGEs, TPA pool and driver internals */ 1462 /* Free SKBs, SGEs, TPA pool and driver internals */
diff --git a/drivers/net/bnx2x/bnx2x_cmn.h b/drivers/net/bnx2x/bnx2x_cmn.h
index 32543c32805c..d1e6a8c977d1 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.h
+++ b/drivers/net/bnx2x/bnx2x_cmn.h
@@ -49,10 +49,11 @@ void bnx2x_link_set(struct bnx2x *bp);
49 * Query link status 49 * Query link status
50 * 50 *
51 * @param bp 51 * @param bp
52 * @param is_serdes
52 * 53 *
53 * @return 0 - link is UP 54 * @return 0 - link is UP
54 */ 55 */
55u8 bnx2x_link_test(struct bnx2x *bp); 56u8 bnx2x_link_test(struct bnx2x *bp, u8 is_serdes);
56 57
57/** 58/**
58 * Handles link status change 59 * Handles link status change
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c
index dbcfa7a5618f..d058f9716785 100644
--- a/drivers/net/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/bnx2x/bnx2x_ethtool.c
@@ -29,9 +29,12 @@
29static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 29static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
30{ 30{
31 struct bnx2x *bp = netdev_priv(dev); 31 struct bnx2x *bp = netdev_priv(dev);
32 32 int cfg_idx = bnx2x_get_link_cfg_idx(bp);
33 cmd->supported = bp->port.supported; 33 /* Dual Media boards present all available port types */
34 cmd->advertising = bp->port.advertising; 34 cmd->supported = bp->port.supported[cfg_idx] |
35 (bp->port.supported[cfg_idx ^ 1] &
36 (SUPPORTED_TP | SUPPORTED_FIBRE));
37 cmd->advertising = bp->port.advertising[cfg_idx];
35 38
36 if ((bp->state == BNX2X_STATE_OPEN) && 39 if ((bp->state == BNX2X_STATE_OPEN) &&
37 !(bp->flags & MF_FUNC_DIS) && 40 !(bp->flags & MF_FUNC_DIS) &&
@@ -48,22 +51,21 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
48 cmd->speed = vn_max_rate; 51 cmd->speed = vn_max_rate;
49 } 52 }
50 } else { 53 } else {
51 cmd->speed = -1; 54 cmd->speed = bp->link_params.req_line_speed[cfg_idx];
52 cmd->duplex = -1; 55 cmd->duplex = bp->link_params.req_duplex[cfg_idx];
53 } 56 }
54 57
55 if (bp->link_params.num_phys > 0) { 58 if (bp->port.supported[cfg_idx] & SUPPORTED_TP)
56 if (bp->link_params.phy[bp->link_params.num_phys - 1]. 59 cmd->port = PORT_TP;
57 supported & SUPPORTED_FIBRE) 60 else if (bp->port.supported[cfg_idx] & SUPPORTED_FIBRE)
58 cmd->port = PORT_FIBRE; 61 cmd->port = PORT_FIBRE;
59 else 62 else
60 cmd->port = PORT_TP; 63 BNX2X_ERR("XGXS PHY Failure detected\n");
61 } else 64
62 DP(NETIF_MSG_LINK, "No media found\n");
63 cmd->phy_address = bp->mdio.prtad; 65 cmd->phy_address = bp->mdio.prtad;
64 cmd->transceiver = XCVR_INTERNAL; 66 cmd->transceiver = XCVR_INTERNAL;
65 67
66 if (bp->link_params.req_line_speed == SPEED_AUTO_NEG) 68 if (bp->link_params.req_line_speed[cfg_idx] == SPEED_AUTO_NEG)
67 cmd->autoneg = AUTONEG_ENABLE; 69 cmd->autoneg = AUTONEG_ENABLE;
68 else 70 else
69 cmd->autoneg = AUTONEG_DISABLE; 71 cmd->autoneg = AUTONEG_DISABLE;
@@ -85,7 +87,7 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
85static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd) 87static int bnx2x_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
86{ 88{
87 struct bnx2x *bp