summaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorYaniv Rosner <yanivr@broadcom.com>2012-10-31 01:46:56 -0400
committerDavid S. Miller <davem@davemloft.net>2012-11-01 11:31:54 -0400
commite82041df5d0a85457880fbbe00da057443b3fcc0 (patch)
tree724e1b413a82ad9d447996f55fd0b867f269249c /drivers/net
parent4978140c38958b15b3b95a49bda688723fa014eb (diff)
bnx2x: Fix unrecognized SFP+ module after driver is loaded
When SFP+ module is plugged in after driver is already loaded, it may not be recognized, so set SFP module recognition time up to 300ms, without resetting the module power in the middle. Signed-off-by: Yaniv Rosner <yanivr@broadcom.com> Signed-off-by: Barak Witkowski <barak@broadcom.com> Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 308ba42dfd56..679d45e09805 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -7634,7 +7634,7 @@ static void bnx2x_warpcore_power_module(struct link_params *params,
7634static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, 7634static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
7635 struct link_params *params, 7635 struct link_params *params,
7636 u16 addr, u8 byte_cnt, 7636 u16 addr, u8 byte_cnt,
7637 u8 *o_buf) 7637 u8 *o_buf, u8 is_init)
7638{ 7638{
7639 int rc = 0; 7639 int rc = 0;
7640 u8 i, j = 0, cnt = 0; 7640 u8 i, j = 0, cnt = 0;
@@ -7651,10 +7651,10 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
7651 /* 4 byte aligned address */ 7651 /* 4 byte aligned address */
7652 addr32 = addr & (~0x3); 7652 addr32 = addr & (~0x3);
7653 do { 7653 do {
7654 if (cnt == I2C_WA_PWR_ITER) { 7654 if ((!is_init) && (cnt == I2C_WA_PWR_ITER)) {
7655 bnx2x_warpcore_power_module(params, phy, 0); 7655 bnx2x_warpcore_power_module(params, phy, 0);
7656 /* Note that 100us are not enough here */ 7656 /* Note that 100us are not enough here */
7657 usleep_range(1000,1000); 7657 usleep_range(1000, 2000);
7658 bnx2x_warpcore_power_module(params, phy, 1); 7658 bnx2x_warpcore_power_module(params, phy, 1);
7659 } 7659 }
7660 rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt, 7660 rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt,
@@ -7774,7 +7774,7 @@ int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy,
7774 break; 7774 break;
7775 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: 7775 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
7776 rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr, 7776 rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr,
7777 byte_cnt, o_buf); 7777 byte_cnt, o_buf, 0);
7778 break; 7778 break;
7779 } 7779 }
7780 return rc; 7780 return rc;
@@ -7978,6 +7978,7 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy,
7978 7978
7979{ 7979{
7980 u8 val; 7980 u8 val;
7981 int rc;
7981 struct bnx2x *bp = params->bp; 7982 struct bnx2x *bp = params->bp;
7982 u16 timeout; 7983 u16 timeout;
7983 /* Initialization time after hot-plug may take up to 300ms for 7984 /* Initialization time after hot-plug may take up to 300ms for
@@ -7985,8 +7986,14 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy,
7985 */ 7986 */
7986 7987
7987 for (timeout = 0; timeout < 60; timeout++) { 7988 for (timeout = 0; timeout < 60; timeout++) {
7988 if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val) 7989 if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT)
7989 == 0) { 7990 rc = bnx2x_warpcore_read_sfp_module_eeprom(phy,
7991 params, 1,
7992 1, &val, 1);
7993 else
7994 rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1,
7995 &val);
7996 if (rc == 0) {
7990 DP(NETIF_MSG_LINK, 7997 DP(NETIF_MSG_LINK,
7991 "SFP+ module initialization took %d ms\n", 7998 "SFP+ module initialization took %d ms\n",
7992 timeout * 5); 7999 timeout * 5);
@@ -7994,7 +8001,8 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy,
7994 } 8001 }
7995 usleep_range(5000, 10000); 8002 usleep_range(5000, 10000);
7996 } 8003 }
7997 return -EINVAL; 8004 rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val);
8005 return rc;
7998} 8006}
7999 8007
8000static void bnx2x_8727_power_module(struct bnx2x *bp, 8008static void bnx2x_8727_power_module(struct bnx2x *bp,