aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorMichael Chan <mchan@broadcom.com>2007-07-08 01:48:00 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-07-11 01:18:30 -0400
commitdeaf391b4cc9d9f8e2b2793ebd56da776b54197a (patch)
treef834c1aae99c9d97eea7393286d91e5c3e43b13a /drivers/net/bnx2.c
parent5faf41535214b68c989a22302c8870f8758cbb8c (diff)
[BNX2]: Add bnx2_set_default_link().
Put existing code to setup the default link settings in this new function. This makes it easier to support the remote PHY feature in the next few patches. Also change ETHTOOL_ALL_FIBRE_SPEED to include 2500Mbps if supported. Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c43
1 files changed, 25 insertions, 18 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 0f4f76fda26f..56bc41ee9a47 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -1323,7 +1323,9 @@ bnx2_setup_serdes_phy(struct bnx2 *bp)
1323} 1323}
1324 1324
1325#define ETHTOOL_ALL_FIBRE_SPEED \ 1325#define ETHTOOL_ALL_FIBRE_SPEED \
1326 (ADVERTISED_1000baseT_Full) 1326 (bp->phy_flags & PHY_2_5G_CAPABLE_FLAG) ? \
1327 (ADVERTISED_2500baseX_Full | ADVERTISED_1000baseT_Full) :\
1328 (ADVERTISED_1000baseT_Full)
1327 1329
1328#define ETHTOOL_ALL_COPPER_SPEED \ 1330#define ETHTOOL_ALL_COPPER_SPEED \
1329 (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | \ 1331 (ADVERTISED_10baseT_Half | ADVERTISED_10baseT_Full | \
@@ -1335,6 +1337,27 @@ bnx2_setup_serdes_phy(struct bnx2 *bp)
1335 1337
1336#define PHY_ALL_1000_SPEED (ADVERTISE_1000HALF | ADVERTISE_1000FULL) 1338#define PHY_ALL_1000_SPEED (ADVERTISE_1000HALF | ADVERTISE_1000FULL)
1337 1339
1340static void
1341bnx2_set_default_link(struct bnx2 *bp)
1342{
1343 bp->autoneg = AUTONEG_SPEED | AUTONEG_FLOW_CTRL;
1344 bp->req_line_speed = 0;
1345 if (bp->phy_flags & PHY_SERDES_FLAG) {
1346 u32 reg;
1347
1348 bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg;
1349
1350 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_CONFIG);
1351 reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK;
1352 if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) {
1353 bp->autoneg = 0;
1354 bp->req_line_speed = bp->line_speed = SPEED_1000;
1355 bp->req_duplex = DUPLEX_FULL;
1356 }
1357 } else
1358 bp->advertising = ETHTOOL_ALL_COPPER_SPEED | ADVERTISED_Autoneg;
1359}
1360
1338static int 1361static int
1339bnx2_setup_copper_phy(struct bnx2 *bp) 1362bnx2_setup_copper_phy(struct bnx2 *bp)
1340{ 1363{
@@ -6374,23 +6397,7 @@ bnx2_init_board(struct pci_dev *pdev, struct net_device *dev)
6374 } 6397 }
6375 } 6398 }
6376 6399
6377 bp->autoneg = AUTONEG_SPEED | AUTONEG_FLOW_CTRL; 6400 bnx2_set_default_link(bp);
6378 bp->req_line_speed = 0;
6379 if (bp->phy_flags & PHY_SERDES_FLAG) {
6380 bp->advertising = ETHTOOL_ALL_FIBRE_SPEED | ADVERTISED_Autoneg;
6381
6382 reg = REG_RD_IND(bp, bp->shmem_base + BNX2_PORT_HW_CFG_CONFIG);
6383 reg &= BNX2_PORT_HW_CFG_CFG_DFLT_LINK_MASK;
6384 if (reg == BNX2_PORT_HW_CFG_CFG_DFLT_LINK_1G) {
6385 bp->autoneg = 0;
6386 bp->req_line_speed = bp->line_speed = SPEED_1000;
6387 bp->req_duplex = DUPLEX_FULL;
6388 }
6389 }
6390 else {
6391 bp->advertising = ETHTOOL_ALL_COPPER_SPEED | ADVERTISED_Autoneg;
6392 }
6393
6394 bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX; 6401 bp->req_flow_ctrl = FLOW_CTRL_RX | FLOW_CTRL_TX;
6395 6402
6396 init_timer(&bp->timer); 6403 init_timer(&bp->timer);