aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/bnx2x.h38
-rw-r--r--drivers/net/bnx2x_link.c115
-rw-r--r--drivers/net/bnx2x_main.c80
-rw-r--r--drivers/net/bnx2x_reg.h3
4 files changed, 121 insertions, 115 deletions
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index 97bc5e046f47..bbf842284ebb 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -314,9 +314,11 @@ struct bnx2x_fastpath {
314 __le16 *rx_cons_sb; 314 __le16 *rx_cons_sb;
315 __le16 *rx_bd_cons_sb; 315 __le16 *rx_bd_cons_sb;
316 316
317
317 unsigned long tx_pkt, 318 unsigned long tx_pkt,
318 rx_pkt, 319 rx_pkt,
319 rx_calls; 320 rx_calls;
321
320 /* TPA related */ 322 /* TPA related */
321 struct sw_rx_bd tpa_pool[ETH_MAX_AGGREGATION_QUEUES_E1H]; 323 struct sw_rx_bd tpa_pool[ETH_MAX_AGGREGATION_QUEUES_E1H];
322 u8 tpa_state[ETH_MAX_AGGREGATION_QUEUES_E1H]; 324 u8 tpa_state[ETH_MAX_AGGREGATION_QUEUES_E1H];
@@ -998,20 +1000,20 @@ struct bnx2x {
998#define GUNZIP_PHYS(bp) (bp->gunzip_mapping) 1000#define GUNZIP_PHYS(bp) (bp->gunzip_mapping)
999#define GUNZIP_OUTLEN(bp) (bp->gunzip_outlen) 1001#define GUNZIP_OUTLEN(bp) (bp->gunzip_outlen)
1000 1002
1001 struct raw_op *init_ops; 1003 struct raw_op *init_ops;
1002 /* Init blocks offsets inside init_ops */ 1004 /* Init blocks offsets inside init_ops */
1003 u16 *init_ops_offsets; 1005 u16 *init_ops_offsets;
1004 /* Data blob - has 32 bit granularity */ 1006 /* Data blob - has 32 bit granularity */
1005 u32 *init_data; 1007 u32 *init_data;
1006 /* Zipped PRAM blobs - raw data */ 1008 /* Zipped PRAM blobs - raw data */
1007 const u8 *tsem_int_table_data; 1009 const u8 *tsem_int_table_data;
1008 const u8 *tsem_pram_data; 1010 const u8 *tsem_pram_data;
1009 const u8 *usem_int_table_data; 1011 const u8 *usem_int_table_data;
1010 const u8 *usem_pram_data; 1012 const u8 *usem_pram_data;
1011 const u8 *xsem_int_table_data; 1013 const u8 *xsem_int_table_data;
1012 const u8 *xsem_pram_data; 1014 const u8 *xsem_pram_data;
1013 const u8 *csem_int_table_data; 1015 const u8 *csem_int_table_data;
1014 const u8 *csem_pram_data; 1016 const u8 *csem_pram_data;
1015#define INIT_OPS(bp) (bp->init_ops) 1017#define INIT_OPS(bp) (bp->init_ops)
1016#define INIT_OPS_OFFSETS(bp) (bp->init_ops_offsets) 1018#define INIT_OPS_OFFSETS(bp) (bp->init_ops_offsets)
1017#define INIT_DATA(bp) (bp->init_data) 1019#define INIT_DATA(bp) (bp->init_data)
@@ -1024,7 +1026,7 @@ struct bnx2x {
1024#define INIT_CSEM_INT_TABLE_DATA(bp) (bp->csem_int_table_data) 1026#define INIT_CSEM_INT_TABLE_DATA(bp) (bp->csem_int_table_data)
1025#define INIT_CSEM_PRAM_DATA(bp) (bp->csem_pram_data) 1027#define INIT_CSEM_PRAM_DATA(bp) (bp->csem_pram_data)
1026 1028
1027 const struct firmware *firmware; 1029 const struct firmware *firmware;
1028}; 1030};
1029 1031
1030 1032
@@ -1111,9 +1113,9 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
1111#define DMAE_COMP_VAL 0xe0d0d0ae 1113#define DMAE_COMP_VAL 0xe0d0d0ae
1112 1114
1113#define MAX_DMAE_C_PER_PORT 8 1115#define MAX_DMAE_C_PER_PORT 8
1114#define INIT_DMAE_C(bp) (BP_PORT(bp)*MAX_DMAE_C_PER_PORT + \ 1116#define INIT_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \
1115 BP_E1HVN(bp)) 1117 BP_E1HVN(bp))
1116#define PMF_DMAE_C(bp) (BP_PORT(bp)*MAX_DMAE_C_PER_PORT + \ 1118#define PMF_DMAE_C(bp) (BP_PORT(bp) * MAX_DMAE_C_PER_PORT + \
1117 E1HVN_MAX) 1119 E1HVN_MAX)
1118 1120
1119 1121
@@ -1138,7 +1140,8 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
1138 1140
1139 1141
1140/* must be used on a CID before placing it on a HW ring */ 1142/* must be used on a CID before placing it on a HW ring */
1141#define HW_CID(bp, x) ((BP_PORT(bp) << 23) | (BP_E1HVN(bp) << 17) | x) 1143#define HW_CID(bp, x) ((BP_PORT(bp) << 23) | \
1144 (BP_E1HVN(bp) << 17) | (x))
1142 1145
1143#define SP_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_spe)) 1146#define SP_DESC_CNT (BCM_PAGE_SIZE / sizeof(struct eth_spe))
1144#define MAX_SP_DESC_CNT (SP_DESC_CNT - 1) 1147#define MAX_SP_DESC_CNT (SP_DESC_CNT - 1)
@@ -1226,8 +1229,8 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
1226 AEU_INPUTS_ATTN_BITS_QM_PARITY_ERROR | \ 1229 AEU_INPUTS_ATTN_BITS_QM_PARITY_ERROR | \
1227 AEU_INPUTS_ATTN_BITS_XSDM_PARITY_ERROR | \ 1230 AEU_INPUTS_ATTN_BITS_XSDM_PARITY_ERROR | \
1228 AEU_INPUTS_ATTN_BITS_XSEMI_PARITY_ERROR | \ 1231 AEU_INPUTS_ATTN_BITS_XSEMI_PARITY_ERROR | \
1229 AEU_INPUTS_ATTN_BITS_DOORBELLQ_PARITY_ERROR |\ 1232 AEU_INPUTS_ATTN_BITS_DOORBELLQ_PARITY_ERROR |\
1230 AEU_INPUTS_ATTN_BITS_VAUX_PCI_CORE_PARITY_ERROR |\ 1233 AEU_INPUTS_ATTN_BITS_VAUX_PCI_CORE_PARITY_ERROR |\
1231 AEU_INPUTS_ATTN_BITS_DEBUG_PARITY_ERROR | \ 1234 AEU_INPUTS_ATTN_BITS_DEBUG_PARITY_ERROR | \
1232 AEU_INPUTS_ATTN_BITS_USDM_PARITY_ERROR | \ 1235 AEU_INPUTS_ATTN_BITS_USDM_PARITY_ERROR | \
1233 AEU_INPUTS_ATTN_BITS_USEMI_PARITY_ERROR | \ 1236 AEU_INPUTS_ATTN_BITS_USEMI_PARITY_ERROR | \
@@ -1255,7 +1258,6 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
1255 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY | \ 1258 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY | \
1256 (bp->multi_mode << \ 1259 (bp->multi_mode << \
1257 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT)) 1260 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT))
1258
1259#define MULTI_MASK 0x7f 1261#define MULTI_MASK 0x7f
1260 1262
1261 1263
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c
index c2b001031e7b..e32d3370862e 100644
--- a/drivers/net/bnx2x_link.c
+++ b/drivers/net/bnx2x_link.c
@@ -182,6 +182,7 @@ static void bnx2x_set_serdes_access(struct link_params *params)
182{ 182{
183 struct bnx2x *bp = params->bp; 183 struct bnx2x *bp = params->bp;
184 u32 emac_base = (params->port) ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 184 u32 emac_base = (params->port) ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
185
185 /* Set Clause 22 */ 186 /* Set Clause 22 */
186 REG_WR(bp, NIG_REG_SERDES0_CTRL_MD_ST + params->port*0x10, 1); 187 REG_WR(bp, NIG_REG_SERDES0_CTRL_MD_ST + params->port*0x10, 1);
187 REG_WR(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM, 0x245f8000); 188 REG_WR(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM, 0x245f8000);
@@ -194,6 +195,7 @@ static void bnx2x_set_serdes_access(struct link_params *params)
194static void bnx2x_set_phy_mdio(struct link_params *params, u8 phy_flags) 195static void bnx2x_set_phy_mdio(struct link_params *params, u8 phy_flags)
195{ 196{
196 struct bnx2x *bp = params->bp; 197 struct bnx2x *bp = params->bp;
198
197 if (phy_flags & PHY_XGXS_FLAG) { 199 if (phy_flags & PHY_XGXS_FLAG) {
198 REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + 200 REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST +
199 params->port*0x18, 0); 201 params->port*0x18, 0);
@@ -465,7 +467,6 @@ static u8 bnx2x_bmac_enable(struct link_params *params, struct link_vars *vars,
465 REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_BMAC_CONTROL, 467 REG_WR_DMAE(bp, bmac_addr + BIGMAC_REGISTER_BMAC_CONTROL,
466 wb_data, 2); 468 wb_data, 2);
467 469
468
469 /* set rx mtu */ 470 /* set rx mtu */
470 wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD; 471 wb_data[0] = ETH_MAX_JUMBO_PACKET_SIZE + ETH_OVREHEAD;
471 wb_data[1] = 0; 472 wb_data[1] = 0;
@@ -684,6 +685,7 @@ void bnx2x_link_status_update(struct link_params *params,
684static void bnx2x_update_mng(struct link_params *params, u32 link_status) 685static void bnx2x_update_mng(struct link_params *params, u32 link_status)
685{ 686{
686 struct bnx2x *bp = params->bp; 687 struct bnx2x *bp = params->bp;
688
687 REG_WR(bp, params->shmem_base + 689 REG_WR(bp, params->shmem_base +
688 offsetof(struct shmem_region, 690 offsetof(struct shmem_region,
689 port_mb[params->port].link_status), 691 port_mb[params->port].link_status),
@@ -780,7 +782,6 @@ static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl,
780 DP(NETIF_MSG_LINK, "Invalid line_speed 0x%x\n", 782 DP(NETIF_MSG_LINK, "Invalid line_speed 0x%x\n",
781 line_speed); 783 line_speed);
782 return -EINVAL; 784 return -EINVAL;
783 break;
784 } 785 }
785 } 786 }
786 REG_WR(bp, PBF_REG_P0_INIT_CRD + port*4, init_crd); 787 REG_WR(bp, PBF_REG_P0_INIT_CRD + port*4, init_crd);
@@ -800,6 +801,7 @@ static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl,
800static u32 bnx2x_get_emac_base(struct bnx2x *bp, u32 ext_phy_type, u8 port) 801static u32 bnx2x_get_emac_base(struct bnx2x *bp, u32 ext_phy_type, u8 port)
801{ 802{
802 u32 emac_base; 803 u32 emac_base;
804
803 switch (ext_phy_type) { 805 switch (ext_phy_type) {
804 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 806 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
805 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: 807 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
@@ -905,7 +907,7 @@ u8 bnx2x_cl45_read(struct bnx2x *bp, u8 port, u32 ext_phy_type,
905 val = saved_mode & ((EMAC_MDIO_MODE_AUTO_POLL | 907 val = saved_mode & ((EMAC_MDIO_MODE_AUTO_POLL |
906 EMAC_MDIO_MODE_CLOCK_CNT)); 908 EMAC_MDIO_MODE_CLOCK_CNT));
907 val |= (EMAC_MDIO_MODE_CLAUSE_45 | 909 val |= (EMAC_MDIO_MODE_CLAUSE_45 |
908 (49 << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT)); 910 (49L << EMAC_MDIO_MODE_CLOCK_CNT_BITSHIFT));
909 REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, val); 911 REG_WR(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE, val);
910 REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE); 912 REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE);
911 udelay(40); 913 udelay(40);
@@ -1535,14 +1537,14 @@ static void bnx2x_pause_resolve(struct link_vars *vars, u32 pause_result)
1535 } 1537 }
1536} 1538}
1537 1539
1538static u8 bnx2x_ext_phy_resove_fc(struct link_params *params, 1540static u8 bnx2x_ext_phy_resolve_fc(struct link_params *params,
1539 struct link_vars *vars) 1541 struct link_vars *vars)
1540{ 1542{
1541 struct bnx2x *bp = params->bp; 1543 struct bnx2x *bp = params->bp;
1542 u8 ext_phy_addr; 1544 u8 ext_phy_addr;
1543 u16 ld_pause; /* local */ 1545 u16 ld_pause; /* local */
1544 u16 lp_pause; /* link partner */ 1546 u16 lp_pause; /* link partner */
1545 u16 an_complete; /* AN complete */ 1547 u16 an_complete; /* AN complete */
1546 u16 pause_result; 1548 u16 pause_result;
1547 u8 ret = 0; 1549 u8 ret = 0;
1548 u32 ext_phy_type; 1550 u32 ext_phy_type;
@@ -1642,7 +1644,7 @@ static void bnx2x_flow_ctrl_resolve(struct link_params *params,
1642 DP(NETIF_MSG_LINK, "pause_result 0x%x\n", pause_result); 1644 DP(NETIF_MSG_LINK, "pause_result 0x%x\n", pause_result);
1643 bnx2x_pause_resolve(vars, pause_result); 1645 bnx2x_pause_resolve(vars, pause_result);
1644 } else if ((params->req_flow_ctrl == BNX2X_FLOW_CTRL_AUTO) && 1646 } else if ((params->req_flow_ctrl == BNX2X_FLOW_CTRL_AUTO) &&
1645 (bnx2x_ext_phy_resove_fc(params, vars))) { 1647 (bnx2x_ext_phy_resolve_fc(params, vars))) {
1646 return; 1648 return;
1647 } else { 1649 } else {
1648 if (params->req_flow_ctrl == BNX2X_FLOW_CTRL_AUTO) 1650 if (params->req_flow_ctrl == BNX2X_FLOW_CTRL_AUTO)
@@ -1784,7 +1786,7 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1784 "link speed unsupported gp_status 0x%x\n", 1786 "link speed unsupported gp_status 0x%x\n",
1785 gp_status); 1787 gp_status);
1786 return -EINVAL; 1788 return -EINVAL;
1787 break; 1789
1788 case GP_STATUS_10G_KX4: 1790 case GP_STATUS_10G_KX4:
1789 case GP_STATUS_10G_HIG: 1791 case GP_STATUS_10G_HIG:
1790 case GP_STATUS_10G_CX4: 1792 case GP_STATUS_10G_CX4:
@@ -1821,8 +1823,7 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
1821 DP(NETIF_MSG_LINK, 1823 DP(NETIF_MSG_LINK,
1822 "link speed unsupported gp_status 0x%x\n", 1824 "link speed unsupported gp_status 0x%x\n",
1823 gp_status); 1825 gp_status);
1824 return -EINVAL; 1826 return -EINVAL;
1825 break;
1826 } 1827 }
1827 1828
1828 /* Upon link speed change set the NIG into drain mode. 1829 /* Upon link speed change set the NIG into drain mode.
@@ -2061,16 +2062,17 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
2061 MDIO_PMA_DEVAD, 2062 MDIO_PMA_DEVAD,
2062 MDIO_PMA_REG_CTRL, 2063 MDIO_PMA_REG_CTRL,
2063 1<<15); 2064 1<<15);
2064
2065 break; 2065 break;
2066
2066 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072: 2067 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
2068 DP(NETIF_MSG_LINK, "XGXS 8072\n");
2069
2067 /* Unset Low Power Mode and SW reset */ 2070 /* Unset Low Power Mode and SW reset */
2068 /* Restore normal power mode*/ 2071 /* Restore normal power mode*/
2069 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, 2072 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
2070 MISC_REGISTERS_GPIO_OUTPUT_HIGH, 2073 MISC_REGISTERS_GPIO_OUTPUT_HIGH,
2071 params->port); 2074 params->port);
2072 2075
2073 DP(NETIF_MSG_LINK, "XGXS 8072\n");
2074 bnx2x_cl45_write(bp, params->port, 2076 bnx2x_cl45_write(bp, params->port,
2075 ext_phy_type, 2077 ext_phy_type,
2076 ext_phy_addr, 2078 ext_phy_addr,
@@ -2078,8 +2080,9 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
2078 MDIO_PMA_REG_CTRL, 2080 MDIO_PMA_REG_CTRL,
2079 1<<15); 2081 1<<15);
2080 break; 2082 break;
2083
2081 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073: 2084 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
2082 { 2085 DP(NETIF_MSG_LINK, "XGXS 8073\n");
2083 2086
2084 /* Restore normal power mode*/ 2087 /* Restore normal power mode*/
2085 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, 2088 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
@@ -2089,9 +2092,6 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
2089 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1, 2092 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1,
2090 MISC_REGISTERS_GPIO_OUTPUT_HIGH, 2093 MISC_REGISTERS_GPIO_OUTPUT_HIGH,
2091 params->port); 2094 params->port);
2092
2093 DP(NETIF_MSG_LINK, "XGXS 8073\n");
2094 }
2095 break; 2095 break;
2096 2096
2097 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101: 2097 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
@@ -2107,7 +2107,6 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
2107 break; 2107 break;
2108 2108
2109 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481: 2109 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
2110
2111 /* Restore normal power mode*/ 2110 /* Restore normal power mode*/
2112 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2, 2111 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
2113 MISC_REGISTERS_GPIO_OUTPUT_HIGH, 2112 MISC_REGISTERS_GPIO_OUTPUT_HIGH,
@@ -2146,20 +2145,18 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
2146 break; 2145 break;
2147 2146
2148 default: 2147 default:
2149 DP(NETIF_MSG_LINK, 2148 DP(NETIF_MSG_LINK, "BAD SerDes ext_phy_config 0x%x\n",
2150 "BAD SerDes ext_phy_config 0x%x\n",
2151 params->ext_phy_config); 2149 params->ext_phy_config);
2152 break; 2150 break;
2153 } 2151 }
2154 } 2152 }
2155} 2153}
2156 2154
2157
2158static void bnx2x_save_spirom_version(struct bnx2x *bp, u8 port, 2155static void bnx2x_save_spirom_version(struct bnx2x *bp, u8 port,
2159 u32 shmem_base, u32 spirom_ver) 2156 u32 shmem_base, u32 spirom_ver)
2160{ 2157{
2161 DP(NETIF_MSG_LINK, "FW version 0x%x:0x%x\n", 2158 DP(NETIF_MSG_LINK, "FW version 0x%x:0x%x for port %d\n",
2162 (u16)(spirom_ver>>16), (u16)spirom_ver); 2159 (u16)(spirom_ver>>16), (u16)spirom_ver, port);
2163 REG_WR(bp, shmem_base + 2160 REG_WR(bp, shmem_base +
2164 offsetof(struct shmem_region, 2161 offsetof(struct shmem_region,
2165 port_mb[port].ext_phy_fw_version), 2162 port_mb[port].ext_phy_fw_version),
@@ -2171,6 +2168,7 @@ static void bnx2x_save_bcm_spirom_ver(struct bnx2x *bp, u8 port,
2171 u32 shmem_base) 2168 u32 shmem_base)
2172{ 2169{
2173 u16 fw_ver1, fw_ver2; 2170 u16 fw_ver1, fw_ver2;
2171
2174 bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr, MDIO_PMA_DEVAD, 2172 bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr, MDIO_PMA_DEVAD,
2175 MDIO_PMA_REG_ROM_VER1, &fw_ver1); 2173 MDIO_PMA_REG_ROM_VER1, &fw_ver1);
2176 bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr, MDIO_PMA_DEVAD, 2174 bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr, MDIO_PMA_DEVAD,
@@ -2423,7 +2421,6 @@ static u8 bnx2x_bcm8073_xaui_wa(struct link_params *params)
2423 } 2421 }
2424 DP(NETIF_MSG_LINK, "Warning: XAUI work-around timeout !!!\n"); 2422 DP(NETIF_MSG_LINK, "Warning: XAUI work-around timeout !!!\n");
2425 return -EINVAL; 2423 return -EINVAL;
2426
2427} 2424}
2428 2425
2429static void bnx2x_bcm8073_bcm8727_external_rom_boot(struct bnx2x *bp, u8 port, 2426static void bnx2x_bcm8073_bcm8727_external_rom_boot(struct bnx2x *bp, u8 port,
@@ -2565,6 +2562,7 @@ static void bnx2x_sfp_set_transmitter(struct bnx2x *bp, u8 port,
2565 u8 tx_en) 2562 u8 tx_en)
2566{ 2563{
2567 u16 val; 2564 u16 val;
2565
2568 DP(NETIF_MSG_LINK, "Setting transmitter tx_en=%x for port %x\n", 2566 DP(NETIF_MSG_LINK, "Setting transmitter tx_en=%x for port %x\n",
2569 tx_en, port); 2567 tx_en, port);
2570 /* Disable/Enable transmitter ( TX laser of the SFP+ module.)*/ 2568 /* Disable/Enable transmitter ( TX laser of the SFP+ module.)*/
@@ -2597,6 +2595,7 @@ static u8 bnx2x_8726_read_sfp_module_eeprom(struct link_params *params,
2597 u8 port = params->port; 2595 u8 port = params->port;
2598 u8 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config); 2596 u8 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config);
2599 u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config); 2597 u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
2598
2600 if (byte_cnt > 16) { 2599 if (byte_cnt > 16) {
2601 DP(NETIF_MSG_LINK, "Reading from eeprom is" 2600 DP(NETIF_MSG_LINK, "Reading from eeprom is"
2602 " is limited to 0xf\n"); 2601 " is limited to 0xf\n");
@@ -2808,6 +2807,7 @@ static u8 bnx2x_get_edc_mode(struct link_params *params,
2808 case SFP_EEPROM_CON_TYPE_VAL_COPPER: 2807 case SFP_EEPROM_CON_TYPE_VAL_COPPER:
2809 { 2808 {
2810 u8 copper_module_type; 2809 u8 copper_module_type;
2810
2811 /* Check if its active cable( includes SFP+ module) 2811 /* Check if its active cable( includes SFP+ module)
2812 of passive cable*/ 2812 of passive cable*/
2813 if (bnx2x_read_sfp_module_eeprom(params, 2813 if (bnx2x_read_sfp_module_eeprom(params,
@@ -2842,7 +2842,6 @@ static u8 bnx2x_get_edc_mode(struct link_params *params,
2842 DP(NETIF_MSG_LINK, "Optic module detected\n"); 2842 DP(NETIF_MSG_LINK, "Optic module detected\n");
2843 check_limiting_mode = 1; 2843 check_limiting_mode = 1;
2844 break; 2844 break;
2845
2846 default: 2845 default:
2847 DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n", 2846 DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n",
2848 val); 2847 val);
@@ -3169,6 +3168,7 @@ void bnx2x_handle_module_detect_int(struct link_params *params)
3169 struct bnx2x *bp = params->bp; 3168 struct bnx2x *bp = params->bp;
3170 u32 gpio_val; 3169 u32 gpio_val;
3171 u8 port = params->port; 3170 u8 port = params->port;
3171
3172 /* Set valid module led off */ 3172 /* Set valid module led off */
3173 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0, 3173 bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0,
3174 MISC_REGISTERS_GPIO_HIGH, 3174 MISC_REGISTERS_GPIO_HIGH,
@@ -3236,6 +3236,7 @@ static void bnx2x_bcm807x_force_10G(struct link_params *params)
3236 MDIO_AN_REG_CTRL, 3236 MDIO_AN_REG_CTRL,
3237 0x0000); 3237 0x0000);
3238} 3238}
3239
3239static void bnx2x_bcm8073_set_xaui_low_power_mode(struct link_params *params) 3240static void bnx2x_bcm8073_set_xaui_low_power_mode(struct link_params *params)
3240{ 3241{
3241 struct bnx2x *bp = params->bp; 3242 struct bnx2x *bp = params->bp;
@@ -3303,7 +3304,6 @@ static void bnx2x_bcm8073_set_xaui_low_power_mode(struct link_params *params)
3303static void bnx2x_8073_set_pause_cl37(struct link_params *params, 3304static void bnx2x_8073_set_pause_cl37(struct link_params *params,
3304 struct link_vars *vars) 3305 struct link_vars *vars)
3305{ 3306{
3306
3307 struct bnx2x *bp = params->bp; 3307 struct bnx2x *bp = params->bp;
3308 u16 cl37_val; 3308 u16 cl37_val;
3309 u8 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config); 3309 u8 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config);
@@ -3535,6 +3535,7 @@ static void bnx2x_init_internal_phy(struct link_params *params,
3535 u8 enable_cl73) 3535 u8 enable_cl73)
3536{ 3536{
3537 struct bnx2x *bp = params->bp; 3537 struct bnx2x *bp = params->bp;
3538
3538 if (!(vars->phy_flags & PHY_SGMII_FLAG)) { 3539 if (!(vars->phy_flags & PHY_SGMII_FLAG)) {
3539 if ((XGXS_EXT_PHY_TYPE(params->ext_phy_config) == 3540 if ((XGXS_EXT_PHY_TYPE(params->ext_phy_config) ==
3540 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) && 3541 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) &&
@@ -3585,6 +3586,7 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
3585 u16 ctrl = 0; 3586 u16 ctrl = 0;
3586 u16 val = 0; 3587 u16 val = 0;
3587 u8 rc = 0; 3588 u8 rc = 0;
3589
3588 if (vars->phy_flags & PHY_XGXS_FLAG) { 3590 if (vars->phy_flags & PHY_XGXS_FLAG) {
3589 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config); 3591 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config);
3590 3592
@@ -3881,14 +3883,12 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
3881 bnx2x_8073_set_pause_cl37(params, vars); 3883 bnx2x_8073_set_pause_cl37(params, vars);
3882 3884
3883 if (ext_phy_type == 3885 if (ext_phy_type ==
3884 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072){ 3886 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072)
3885 bnx2x_bcm8072_external_rom_boot(params); 3887 bnx2x_bcm8072_external_rom_boot(params);
3886 } else { 3888 else
3887
3888 /* In case of 8073 with long xaui lines, 3889 /* In case of 8073 with long xaui lines,
3889 don't set the 8073 xaui low power*/ 3890 don't set the 8073 xaui low power*/
3890 bnx2x_bcm8073_set_xaui_low_power_mode(params); 3891 bnx2x_bcm8073_set_xaui_low_power_mode(params);
3891 }
3892 3892
3893 bnx2x_cl45_read(bp, params->port, 3893 bnx2x_cl45_read(bp, params->port,
3894 ext_phy_type, 3894 ext_phy_type,
@@ -3953,10 +3953,8 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
3953 ext_phy_addr, 3953 ext_phy_addr,
3954 MDIO_AN_DEVAD, 3954 MDIO_AN_DEVAD,
3955 MDIO_AN_REG_ADV, val); 3955 MDIO_AN_REG_ADV, val);
3956
3957 if (ext_phy_type == 3956 if (ext_phy_type ==
3958 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073) { 3957 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073) {
3959
3960 bnx2x_cl45_read(bp, params->port, 3958 bnx2x_cl45_read(bp, params->port,
3961 ext_phy_type, 3959 ext_phy_type,
3962 ext_phy_addr, 3960 ext_phy_addr,
@@ -4290,7 +4288,6 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
4290 bnx2x_save_spirom_version(params->bp, params->port, 4288 bnx2x_save_spirom_version(params->bp, params->port,
4291 params->shmem_base, 4289 params->shmem_base,
4292 (u32)(fw_ver1<<16 | fw_ver2)); 4290 (u32)(fw_ver1<<16 | fw_ver2));
4293
4294 break; 4291 break;
4295 } 4292 }
4296 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481: 4293 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
@@ -4621,6 +4618,7 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
4621 u16 rx_sd, pcs_status; 4618 u16 rx_sd, pcs_status;
4622 u8 ext_phy_link_up = 0; 4619 u8 ext_phy_link_up = 0;
4623 u8 port = params->port; 4620 u8 port = params->port;
4621
4624 if (vars->phy_flags & PHY_XGXS_FLAG) { 4622 if (vars->phy_flags & PHY_XGXS_FLAG) {
4625 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config); 4623 ext_phy_addr = XGXS_EXT_PHY_ADDR(params->ext_phy_config);
4626 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config); 4624 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
@@ -4729,7 +4727,6 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
4729 break; 4727 break;
4730 } 4728 }
4731 } 4729 }
4732
4733 if (val2 & (1<<1)) 4730 if (val2 & (1<<1))
4734 vars->line_speed = SPEED_1000; 4731 vars->line_speed = SPEED_1000;
4735 else 4732 else
@@ -4786,8 +4783,9 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
4786 4783
4787 if ((val1 & (1<<8)) == 0) { 4784 if ((val1 & (1<<8)) == 0) {
4788 DP(NETIF_MSG_LINK, "8727 Power fault" 4785 DP(NETIF_MSG_LINK, "8727 Power fault"
4789 " has been detected on port" 4786 " has been detected on "
4790 " %d\n", params->port); 4787 "port %d\n",
4788 params->port);
4791 printk(KERN_ERR PFX "Error: Power" 4789 printk(KERN_ERR PFX "Error: Power"
4792 " fault on %s Port %d has" 4790 " fault on %s Port %d has"
4793 " been detected and the" 4791 " been detected and the"
@@ -4894,6 +4892,7 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
4894 { 4892 {
4895 u16 link_status = 0; 4893 u16 link_status = 0;
4896 u16 an1000_status = 0; 4894 u16 an1000_status = 0;
4895
4897 if (ext_phy_type == 4896 if (ext_phy_type ==
4898 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072) { 4897 PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072) {
4899 bnx2x_cl45_read(bp, params->port, 4898 bnx2x_cl45_read(bp, params->port,
@@ -4909,7 +4908,6 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
4909 DP(NETIF_MSG_LINK, 4908 DP(NETIF_MSG_LINK,
4910 "870x LASI status 0x%x->0x%x\n", 4909 "870x LASI status 0x%x->0x%x\n",
4911 val1, val2); 4910 val1, val2);
4912
4913 } else { 4911 } else {
4914 /* In 8073, port1 is directed through emac0 and 4912 /* In 8073, port1 is directed through emac0 and
4915 * port0 is directed through emac1 4913 * port0 is directed through emac1
@@ -5039,8 +5037,6 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
5039 MDIO_PMA_DEVAD, 5037 MDIO_PMA_DEVAD,
5040 MDIO_PMA_REG_CDR_BANDWIDTH, 5038 MDIO_PMA_REG_CDR_BANDWIDTH,
5041 0x0333); 5039 0x0333);
5042
5043
5044 } 5040 }
5045 bnx2x_cl45_read(bp, params->port, 5041 bnx2x_cl45_read(bp, params->port,
5046 ext_phy_type, 5042 ext_phy_type,
@@ -5225,7 +5221,6 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
5225 ext_phy_addr); 5221 ext_phy_addr);
5226 } 5222 }
5227 } 5223 }
5228
5229 break; 5224 break;
5230 default: 5225 default:
5231 DP(NETIF_MSG_LINK, "BAD XGXS ext_phy_config 0x%x\n", 5226 DP(NETIF_MSG_LINK, "BAD XGXS ext_phy_config 0x%x\n",
@@ -5272,6 +5267,7 @@ static void bnx2x_link_int_enable(struct link_params *params)
5272 u32 ext_phy_type; 5267 u32 ext_phy_type;
5273 u32 mask; 5268 u32 mask;
5274 struct bnx2x *bp = params->bp; 5269 struct bnx2x *bp = params->bp;
5270
5275 /* setting the status to report on link up 5271 /* setting the status to report on link up
5276 for either XGXS or SerDes */ 5272 for either XGXS or SerDes */
5277 5273
@@ -5303,10 +5299,10 @@ static void bnx2x_link_int_enable(struct link_params *params)
5303 bnx2x_bits_en(bp, 5299 bnx2x_bits_en(bp,
5304 NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 5300 NIG_REG_MASK_INTERRUPT_PORT0 + port*4,
5305 mask); 5301 mask);
5306 DP(NETIF_MSG_LINK, "port %x, is_xgxs=%x, int_status 0x%x\n", port, 5302
5303 DP(NETIF_MSG_LINK, "port %x, is_xgxs %x, int_status 0x%x\n", port,
5307 (params->switch_cfg == SWITCH_CFG_10G), 5304 (params->switch_cfg == SWITCH_CFG_10G),
5308 REG_RD(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4)); 5305 REG_RD(bp, NIG_REG_STATUS_INTERRUPT_PORT0 + port*4));
5309
5310 DP(NETIF_MSG_LINK, " int_mask 0x%x, MI_INT %x, SERDES_LINK %x\n", 5306 DP(NETIF_MSG_LINK, " int_mask 0x%x, MI_INT %x, SERDES_LINK %x\n",
5311 REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4), 5307 REG_RD(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4),
5312 REG_RD(bp, NIG_REG_EMAC0_STATUS_MISC_MI_INT + port*0x18), 5308 REG_RD(bp, NIG_REG_EMAC0_STATUS_MISC_MI_INT + port*0x18),
@@ -5738,6 +5734,7 @@ u8 bnx2x_set_led(struct bnx2x *bp, u8 port, u8 mode, u32 speed,
5738 u8 rc = 0; 5734 u8 rc = 0;
5739 u32 tmp; 5735 u32 tmp;
5740 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0; 5736 u32 emac_base = port ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
5737
5741 DP(NETIF_MSG_LINK, "bnx2x_set_led: port %x, mode %d\n", port, mode); 5738 DP(NETIF_MSG_LINK, "bnx2x_set_led: port %x, mode %d\n", port, mode);
5742 DP(NETIF_MSG_LINK, "speed 0x%x, hw_led_mode 0x%x\n", 5739 DP(NETIF_MSG_LINK, "speed 0x%x, hw_led_mode 0x%x\n",
5743 speed, hw_led_mode); 5740 speed, hw_led_mode);
@@ -5816,6 +5813,7 @@ static u8 bnx2x_link_initialize(struct link_params *params,
5816 u8 rc = 0; 5813 u8 rc = 0;
5817 u8 non_ext_phy; 5814 u8 non_ext_phy;
5818 u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config); 5815 u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
5816
5819 /* Activate the external PHY */ 5817 /* Activate the external PHY */
5820 bnx2x_ext_phy_reset(params, vars); 5818 bnx2x_ext_phy_reset(params, vars);
5821 5819
@@ -5889,11 +5887,11 @@ static u8 bnx2x_link_initialize(struct link_params *params,
5889u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars) 5887u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5890{ 5888{
5891 struct bnx2x *bp = params->bp; 5889 struct bnx2x *bp = params->bp;
5892
5893 u32 val; 5890 u32 val;
5894 DP(NETIF_MSG_LINK, "Phy Initialization started \n"); 5891
5895 DP(NETIF_MSG_LINK, "req_speed = %d, req_flowctrl=%d\n", 5892 DP(NETIF_MSG_LINK, "Phy Initialization started\n");
5896 params->req_line_speed, params->req_flow_ctrl); 5893 DP(NETIF_MSG_LINK, "req_speed %d, req_flowctrl %d\n",
5894 params->req_line_speed, params->req_flow_ctrl);
5897 vars->link_status = 0; 5895 vars->link_status = 0;
5898 vars->phy_link_up = 0; 5896 vars->phy_link_up = 0;
5899 vars->link_up = 0; 5897 vars->link_up = 0;
@@ -5907,7 +5905,6 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5907 else 5905 else
5908 vars->phy_flags = PHY_XGXS_FLAG; 5906 vars->phy_flags = PHY_XGXS_FLAG;
5909 5907
5910
5911 /* disable attentions */ 5908 /* disable attentions */
5912 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + params->port*4, 5909 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + params->port*4,
5913 (NIG_MASK_XGXS0_LINK_STATUS | 5910 (NIG_MASK_XGXS0_LINK_STATUS |
@@ -5918,6 +5915,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5918 bnx2x_emac_init(params, vars); 5915 bnx2x_emac_init(params, vars);
5919 5916
5920 if (CHIP_REV_IS_FPGA(bp)) { 5917 if (CHIP_REV_IS_FPGA(bp)) {
5918
5921 vars->link_up = 1; 5919 vars->link_up = 1;
5922 vars->line_speed = SPEED_10000; 5920 vars->line_speed = SPEED_10000;
5923 vars->duplex = DUPLEX_FULL; 5921 vars->duplex = DUPLEX_FULL;
@@ -5926,7 +5924,8 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5926 /* enable on E1.5 FPGA */ 5924 /* enable on E1.5 FPGA */
5927 if (CHIP_IS_E1H(bp)) { 5925 if (CHIP_IS_E1H(bp)) {
5928 vars->flow_ctrl |= 5926 vars->flow_ctrl |=
5929 (BNX2X_FLOW_CTRL_TX | BNX2X_FLOW_CTRL_RX); 5927 (BNX2X_FLOW_CTRL_TX |
5928 BNX2X_FLOW_CTRL_RX);
5930 vars->link_status |= 5929 vars->link_status |=
5931 (LINK_STATUS_TX_FLOW_CONTROL_ENABLED | 5930 (LINK_STATUS_TX_FLOW_CONTROL_ENABLED |
5932 LINK_STATUS_RX_FLOW_CONTROL_ENABLED); 5931 LINK_STATUS_RX_FLOW_CONTROL_ENABLED);
@@ -5935,8 +5934,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5935 bnx2x_emac_enable(params, vars, 0); 5934 bnx2x_emac_enable(params, vars, 0);
5936 bnx2x_pbf_update(params, vars->flow_ctrl, vars->line_speed); 5935 bnx2x_pbf_update(params, vars->flow_ctrl, vars->line_speed);
5937 /* disable drain */ 5936 /* disable drain */
5938 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE 5937 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + params->port*4, 0);
5939 + params->port*4, 0);
5940 5938
5941 /* update shared memory */ 5939 /* update shared memory */
5942 bnx2x_update_mng(params, vars->link_status); 5940 bnx2x_update_mng(params, vars->link_status);
@@ -5966,6 +5964,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5966 5964
5967 } else 5965 } else
5968 if (params->loopback_mode == LOOPBACK_BMAC) { 5966 if (params->loopback_mode == LOOPBACK_BMAC) {
5967
5969 vars->link_up = 1; 5968 vars->link_up = 1;
5970 vars->line_speed = SPEED_10000; 5969 vars->line_speed = SPEED_10000;
5971 vars->duplex = DUPLEX_FULL; 5970 vars->duplex = DUPLEX_FULL;
@@ -5980,7 +5979,9 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5980 5979
5981 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + 5980 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE +
5982 params->port*4, 0); 5981 params->port*4, 0);
5982
5983 } else if (params->loopback_mode == LOOPBACK_EMAC) { 5983 } else if (params->loopback_mode == LOOPBACK_EMAC) {
5984
5984 vars->link_up = 1; 5985 vars->link_up = 1;
5985 vars->line_speed = SPEED_1000; 5986 vars->line_speed = SPEED_1000;
5986 vars->duplex = DUPLEX_FULL; 5987 vars->duplex = DUPLEX_FULL;
@@ -5996,8 +5997,10 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
5996 vars->duplex); 5997 vars->duplex);
5997 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE + 5998 REG_WR(bp, NIG_REG_EGRESS_DRAIN0_MODE +
5998 params->port*4, 0); 5999 params->port*4, 0);
6000
5999 } else if ((params->loopback_mode == LOOPBACK_XGXS_10) || 6001 } else if ((params->loopback_mode == LOOPBACK_XGXS_10) ||
6000 (params->loopback_mode == LOOPBACK_EXT_PHY)) { 6002 (params->loopback_mode == LOOPBACK_EXT_PHY)) {
6003
6001 vars->link_up = 1; 6004 vars->link_up = 1;
6002 vars->line_speed = SPEED_10000; 6005 vars->line_speed = SPEED_10000;
6003 vars->duplex = DUPLEX_FULL; 6006 vars->duplex = DUPLEX_FULL;
@@ -6034,7 +6037,6 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
6034 } else 6037 } else
6035 /* No loopback */ 6038 /* No loopback */
6036 { 6039 {
6037
6038 bnx2x_phy_deassert(params, vars->phy_flags); 6040 bnx2x_phy_deassert(params, vars->phy_flags);
6039 switch (params->switch_cfg) { 6041 switch (params->switch_cfg) {
6040 case SWITCH_CFG_1G: 6042 case SWITCH_CFG_1G:
@@ -6042,8 +6044,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
6042 if ((params->ext_phy_config & 6044 if ((params->ext_phy_config &
6043 PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK) == 6045 PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK) ==
6044 PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482) { 6046 PORT_HW_CFG_SERDES_EXT_PHY_TYPE_BCM5482) {
6045 vars->phy_flags |= 6047 vars->phy_flags |= PHY_SGMII_FLAG;
6046 PHY_SGMII_FLAG;
6047 } 6048 }
6048 6049
6049 val = REG_RD(bp, 6050 val = REG_RD(bp,
@@ -6064,7 +6065,6 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
6064 default: 6065 default:
6065 DP(NETIF_MSG_LINK, "Invalid switch_cfg\n"); 6066 DP(NETIF_MSG_LINK, "Invalid switch_cfg\n");
6066 return -EINVAL; 6067 return -EINVAL;
6067 break;
6068 } 6068 }
6069 DP(NETIF_MSG_LINK, "Phy address = 0x%x\n", params->phy_addr); 6069 DP(NETIF_MSG_LINK, "Phy address = 0x%x\n", params->phy_addr);
6070 6070
@@ -6089,7 +6089,6 @@ static void bnx2x_8726_reset_phy(struct bnx2x *bp, u8 port, u8 ext_phy_addr)
6089u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars, 6089u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
6090 u8 reset_ext_phy) 6090 u8 reset_ext_phy)
6091{ 6091{
6092
6093 struct bnx2x *bp = params->bp; 6092 struct bnx2x *bp = params->bp;
6094 u32 ext_phy_config = params->ext_phy_config; 6093 u32 ext_phy_config = params->ext_phy_config;
6095 u16 hw_led_mode = params->hw_led_mode; 6094 u16 hw_led_mode = params->hw_led_mode;
@@ -6102,7 +6101,6 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
6102 config)); 6101 config));
6103 6102
6104 /* disable attentions */ 6103 /* disable attentions */
6105
6106 vars->link_status = 0; 6104 vars->link_status = 0;
6107 bnx2x_update_mng(params, vars->link_status); 6105 bnx2x_update_mng(params, vars->link_status);
6108 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4, 6106 bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + port*4,
@@ -6198,6 +6196,7 @@ static u8 bnx2x_update_link_down(struct link_params *params,
6198{ 6196{
6199 struct bnx2x *bp = params->bp; 6197 struct bnx2x *bp = params->bp;
6200 u8 port = params->port; 6198 u8 port = params->port;
6199
6201 DP(NETIF_MSG_LINK, "Port %x: Link is down\n", port); 6200 DP(NETIF_MSG_LINK, "Port %x: Link is down\n", port);
6202 bnx2x_set_led(bp, port, LED_MODE_OFF, 6201 bnx2x_set_led(bp, port, LED_MODE_OFF,
6203 0, params->hw_led_mode, 6202 0, params->hw_led_mode,
@@ -6234,6 +6233,7 @@ static u8 bnx2x_update_link_up(struct link_params *params,
6234 struct bnx2x *bp = params->bp; 6233 struct bnx2x *bp = params->bp;
6235 u8 port = params->port; 6234 u8 port = params->port;
6236 u8 rc = 0; 6235 u8 rc = 0;
6236
6237 vars->link_status |= LINK_STATUS_LINK_UP; 6237 vars->link_status |= LINK_STATUS_LINK_UP;
6238 if (link_10g) { 6238 if (link_10g) {
6239 bnx2x_bmac_enable(params, vars, 0); 6239 bnx2x_bmac_enable(params, vars, 0);
@@ -6547,6 +6547,7 @@ static u8 bnx2x_8726_common_init_phy(struct bnx2x *bp, u32 shmem_base)
6547 u8 ext_phy_addr; 6547 u8 ext_phy_addr;
6548 u32 val; 6548 u32 val;
6549 s8 port; 6549 s8 port;
6550
6550 /* Use port1 because of the static port-swap */ 6551 /* Use port1 because of the static port-swap */
6551 /* Enable the module detection interrupt */ 6552 /* Enable the module detection interrupt */
6552 val = REG_RD(bp, MISC_REG_GPIO_EVENT_EN); 6553 val = REG_RD(bp, MISC_REG_GPIO_EVENT_EN);
diff --git a/drivers/net/bnx2x_main.c b/drivers/net/bnx2x_main.c
index 8b6bb999d8e0..466c447c5fe9 100644
--- a/drivers/net/bnx2x_main.c
+++ b/drivers/net/bnx2x_main.c
@@ -63,8 +63,8 @@
63#include <linux/firmware.h> 63#include <linux/firmware.h>
64#include "bnx2x_fw_file_hdr.h" 64#include "bnx2x_fw_file_hdr.h"
65/* FW files */ 65/* FW files */
66#define FW_FILE_PREFIX_E1 "bnx2x-e1-" 66#define FW_FILE_PREFIX_E1 "bnx2x-e1-"
67#define FW_FILE_PREFIX_E1H "bnx2x-e1h-" 67#define FW_FILE_PREFIX_E1H "bnx2x-e1h-"
68 68
69/* Time in jiffies before concluding the transmitter is hung */ 69/* Time in jiffies before concluding the transmitter is hung */
70#define TX_TIMEOUT (5*HZ) 70#define TX_TIMEOUT (5*HZ)
@@ -723,7 +723,6 @@ static void bnx2x_int_disable(struct bnx2x *bp)
723 REG_WR(bp, addr, val); 723 REG_WR(bp, addr, val);
724 if (REG_RD(bp, addr) != val) 724 if (REG_RD(bp, addr) != val)
725 BNX2X_ERR("BUG! proper val not read from IGU!\n"); 725 BNX2X_ERR("BUG! proper val not read from IGU!\n");
726
727} 726}
728 727
729static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw) 728static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
@@ -1660,6 +1659,7 @@ reuse_rx:
1660 } 1659 }
1661 1660
1662 skb_record_rx_queue(skb, fp->index); 1661 skb_record_rx_queue(skb, fp->index);
1662
1663#ifdef BCM_VLAN 1663#ifdef BCM_VLAN
1664 if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) && 1664 if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
1665 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & 1665 (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
@@ -2418,14 +2418,12 @@ static void bnx2x_link_attn(struct bnx2x *bp)
2418 int func; 2418 int func;
2419 int vn; 2419 int vn;
2420 2420
2421 /* Set the attention towards other drivers on the same port */
2421 for (vn = VN_0; vn < E1HVN_MAX; vn++) { 2422 for (vn = VN_0; vn < E1HVN_MAX; vn++) {
2422 if (vn == BP_E1HVN(bp)) 2423 if (vn == BP_E1HVN(bp))
2423 continue; 2424 continue;
2424 2425
2425 func = ((vn << 1) | port); 2426 func = ((vn << 1) | port);
2426
2427 /* Set the attention towards other drivers
2428 on the same port */
2429 REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_0 + 2427 REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_0 +
2430 (LINK_SYNC_ATTENTION_BIT_FUNC_0 + func)*4, 1); 2428 (LINK_SYNC_ATTENTION_BIT_FUNC_0 + func)*4, 1);
2431 } 2429 }
@@ -2880,6 +2878,7 @@ static inline void bnx2x_fan_failure(struct bnx2x *bp)
2880 " damage. Please contact Dell Support for assistance\n", 2878 " damage. Please contact Dell Support for assistance\n",
2881 bp->dev->name); 2879 bp->dev->name);
2882} 2880}
2881
2883static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn) 2882static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
2884{ 2883{
2885 int port = BP_PORT(bp); 2884 int port = BP_PORT(bp);
@@ -7660,9 +7659,11 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
7660 7659
7661 bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT; 7660 bp->state = BNX2X_STATE_CLOSING_WAIT4_HALT;
7662 7661
7662 /* Set "drop all" */
7663 bp->rx_mode = BNX2X_RX_MODE_NONE; 7663 bp->rx_mode = BNX2X_RX_MODE_NONE;
7664 bnx2x_set_storm_rx_mode(bp); 7664 bnx2x_set_storm_rx_mode(bp);
7665 7665
7666 /* Disable HW interrupts, NAPI and Tx */
7666 bnx2x_netif_stop(bp, 1); 7667 bnx2x_netif_stop(bp, 1);
7667 7668
7668 del_timer_sync(&bp->timer); 7669 del_timer_sync(&bp->timer);
@@ -9158,8 +9159,7 @@ static int bnx2x_nway_reset(struct net_device *dev)
9158 return 0; 9159 return 0;
9159} 9160}
9160 9161
9161static u32 9162static u32 bnx2x_get_link(struct net_device *dev)
9162bnx2x_get_link(struct net_device *dev)
9163{ 9163{
9164 struct bnx2x *bp = netdev_priv(dev); 9164 struct bnx2x *bp = netdev_priv(dev);
9165 9165
@@ -10169,7 +10169,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
10169 __be32 buf[0x350 / 4]; 10169 __be32 buf[0x350 / 4];
10170 u8 *data = (u8 *)buf; 10170 u8 *data = (u8 *)buf;
10171 int i, rc; 10171 int i, rc;
10172 u32 magic, csum; 10172 u32 magic, crc;
10173 10173
10174 rc = bnx2x_nvram_read(bp, 0, data, 4); 10174 rc = bnx2x_nvram_read(bp, 0, data, 4);
10175 if (rc) { 10175 if (rc) {
@@ -10194,10 +10194,10 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
10194 goto test_nvram_exit; 10194 goto test_nvram_exit;
10195 } 10195 }
10196 10196
10197 csum = ether_crc_le(nvram_tbl[i].size, data); 10197 crc = ether_crc_le(nvram_tbl[i].size, data);
10198 if (csum != CRC32_RESIDUAL) { 10198 if (crc != CRC32_RESIDUAL) {
10199 DP(NETIF_MSG_PROBE, 10199 DP(NETIF_MSG_PROBE,
10200 "nvram_tbl[%d] csum value (0x%08x)\n", i, csum); 10200 "nvram_tbl[%d] crc value (0x%08x)\n", i, crc);
10201 rc = -ENODEV; 10201 rc = -ENODEV;
10202 goto test_nvram_exit; 10202 goto test_nvram_exit;
10203 } 10203 }
@@ -11771,17 +11771,17 @@ static int __devinit bnx2x_check_firmware(struct bnx2x *bp)
11771 BCM_5710_FW_MINOR_VERSION, 11771 BCM_5710_FW_MINOR_VERSION,
11772 BCM_5710_FW_REVISION_VERSION, 11772 BCM_5710_FW_REVISION_VERSION,
11773 BCM_5710_FW_ENGINEERING_VERSION); 11773 BCM_5710_FW_ENGINEERING_VERSION);
11774 return -EINVAL; 11774 return -EINVAL;
11775 } 11775 }
11776 11776
11777 return 0; 11777 return 0;
11778} 11778}
11779 11779
11780static void inline be32_to_cpu_n(const u8 *_source, u8 *_target, u32 n) 11780static inline void be32_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
11781{ 11781{
11782 const __be32 *source = (const __be32 *)_source;
11783 u32 *target = (u32 *)_target;
11782 u32 i; 11784 u32 i;
11783 const __be32 *source = (const __be32*)_source;
11784 u32 *target = (u32*)_target;
11785 11785
11786 for (i = 0; i < n/4; i++) 11786 for (i = 0; i < n/4; i++)
11787 target[i] = be32_to_cpu(source[i]); 11787 target[i] = be32_to_cpu(source[i]);
@@ -11791,66 +11791,67 @@ static void inline be32_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
11791 Ops array is stored in the following format: 11791 Ops array is stored in the following format:
11792 {op(8bit), offset(24bit, big endian), data(32bit, big endian)} 11792 {op(8bit), offset(24bit, big endian), data(32bit, big endian)}
11793 */ 11793 */
11794static void inline bnx2x_prep_ops(const u8 *_source, u8 *_target, u32 n) 11794static inline void bnx2x_prep_ops(const u8 *_source, u8 *_target, u32 n)
11795{ 11795{
11796 const __be32 *source = (const __be32 *)_source;
11797 struct raw_op *target = (struct raw_op *)_target;
11796 u32 i, j, tmp; 11798 u32 i, j, tmp;
11797 const __be32 *source = (const __be32*)_source;
11798 struct raw_op *target = (struct raw_op*)_target;
11799 11799
11800 for (i = 0, j = 0; i < n/8; i++, j+=2) { 11800 for (i = 0, j = 0; i < n/8; i++, j += 2) {
11801 tmp = be32_to_cpu(source[j]); 11801 tmp = be32_to_cpu(source[j]);
11802 target[i].op = (tmp >> 24) & 0xff; 11802 target[i].op = (tmp >> 24) & 0xff;
11803 target[i].offset = tmp & 0xffffff; 11803 target[i].offset = tmp & 0xffffff;
11804 target[i].raw_data = be32_to_cpu(source[j+1]); 11804 target[i].raw_data = be32_to_cpu(source[j+1]);
11805 } 11805 }
11806} 11806}
11807static void inline be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n) 11807
11808static inline void be16_to_cpu_n(const u8 *_source, u8 *_target, u32 n)
11808{ 11809{
11810 const __be16 *source = (const __be16 *)_source;
11811 u16 *target = (u16 *)_target;
11809 u32 i; 11812 u32 i;
11810 u16 *target = (u16*)_target;
11811 const __be16 *source = (const __be16*)_source;
11812 11813
11813 for (i = 0; i < n/2; i++) 11814 for (i = 0; i < n/2; i++)
11814 target[i] = be16_to_cpu(source[i]); 11815 target[i] = be16_to_cpu(source[i]);
11815} 11816}
11816 11817
11817#define BNX2X_ALLOC_AND_SET(arr, lbl, func) \ 11818#define BNX2X_ALLOC_AND_SET(arr, lbl, func) \
11818 do { \ 11819 do { \
11819 u32 len = be32_to_cpu(fw_hdr->arr.len); \ 11820 u32 len = be32_to_cpu(fw_hdr->arr.len); \
11820 bp->arr = kmalloc(len, GFP_KERNEL); \ 11821 bp->arr = kmalloc(len, GFP_KERNEL); \
11821 if (!bp->arr) { \ 11822 if (!bp->arr) { \
11822 printk(KERN_ERR PFX "Failed to allocate %d bytes for "#arr"\n", len); \ 11823 printk(KERN_ERR PFX "Failed to allocate %d bytes " \
11824 "for "#arr"\n", len); \
11823 goto lbl; \ 11825 goto lbl; \
11824 } \ 11826 } \
11825 func(bp->firmware->data + \ 11827 func(bp->firmware->data + be32_to_cpu(fw_hdr->arr.offset), \
11826 be32_to_cpu(fw_hdr->arr.offset), \ 11828 (u8 *)bp->arr, len); \
11827 (u8*)bp->arr, len); \
11828 } while (0) 11829 } while (0)
11829 11830
11830
11831static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev) 11831static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
11832{ 11832{
11833 char fw_file_name[40] = {0}; 11833 char fw_file_name[40] = {0};
11834 int rc, offset;
11835 struct bnx2x_fw_file_hdr *fw_hdr; 11834 struct bnx2x_fw_file_hdr *fw_hdr;
11835 int rc, offset;
11836 11836
11837 /* Create a FW file name */ 11837 /* Create a FW file name */
11838 if (CHIP_IS_E1(bp)) 11838 if (CHIP_IS_E1(bp))
11839 offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1); 11839 offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1);
11840 else 11840 else
11841 offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1H); 11841 offset = sprintf(fw_file_name, FW_FILE_PREFIX_E1H);
11842 11842
11843 sprintf(fw_file_name + offset, "%d.%d.%d.%d.fw", 11843 sprintf(fw_file_name + offset, "%d.%d.%d.%d.fw",
11844 BCM_5710_FW_MAJOR_VERSION, 11844 BCM_5710_FW_MAJOR_VERSION,
11845 BCM_5710_FW_MINOR_VERSION, 11845 BCM_5710_FW_MINOR_VERSION,
11846 BCM_5710_FW_REVISION_VERSION, 11846 BCM_5710_FW_REVISION_VERSION,
11847 BCM_5710_FW_ENGINEERING_VERSION); 11847 BCM_5710_FW_ENGINEERING_VERSION);
11848 11848
11849 printk(KERN_INFO PFX "Loading %s\n", fw_file_name); 11849 printk(KERN_INFO PFX "Loading %s\n", fw_file_name);
11850 11850
11851 rc = request_firmware(&bp->firmware, fw_file_name, dev); 11851 rc = request_firmware(&bp->firmware, fw_file_name, dev);
11852 if (rc) { 11852 if (rc) {
11853 printk(KERN_ERR PFX "Can't load firmware file %s\n", fw_file_name); 11853 printk(KERN_ERR PFX "Can't load firmware file %s\n",
11854 fw_file_name);
11854 goto request_firmware_exit; 11855 goto request_firmware_exit;
11855 } 11856 }
11856 11857
@@ -11870,7 +11871,8 @@ static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
11870 BNX2X_ALLOC_AND_SET(init_ops, init_ops_alloc_err, bnx2x_prep_ops); 11871 BNX2X_ALLOC_AND_SET(init_ops, init_ops_alloc_err, bnx2x_prep_ops);
11871 11872
11872 /* Offsets */ 11873 /* Offsets */
11873 BNX2X_ALLOC_AND_SET(init_ops_offsets, init_offsets_alloc_err, be16_to_cpu_n); 11874 BNX2X_ALLOC_AND_SET(init_ops_offsets, init_offsets_alloc_err,
11875 be16_to_cpu_n);
11874 11876
11875 /* STORMs firmware */ 11877 /* STORMs firmware */
11876 INIT_TSEM_INT_TABLE_DATA(bp) = bp->firmware->data + 11878 INIT_TSEM_INT_TABLE_DATA(bp) = bp->firmware->data +
@@ -11891,6 +11893,7 @@ static int __devinit bnx2x_init_firmware(struct bnx2x *bp, struct device *dev)
11891 be32_to_cpu(fw_hdr->csem_pram_data.offset); 11893 be32_to_cpu(fw_hdr->csem_pram_data.offset);
11892 11894
11893 return 0; 11895 return 0;
11896
11894init_offsets_alloc_err: 11897init_offsets_alloc_err:
11895 kfree(bp->init_ops); 11898 kfree(bp->init_ops);
11896init_ops_alloc_err: 11899init_ops_alloc_err:
@@ -11902,7 +11905,6 @@ request_firmware_exit:
11902} 11905}
11903 11906
11904 11907
11905
11906static int __devinit bnx2x_init_one(struct pci_dev *pdev, 11908static int __devinit bnx2x_init_one(struct pci_dev *pdev,
11907 const struct pci_device_id *ent) 11909 const struct pci_device_id *ent)
11908{ 11910{
diff --git a/drivers/net/bnx2x_reg.h b/drivers/net/bnx2x_reg.h
index 95ebf3fb3e89..0695be14cf91 100644
--- a/drivers/net/bnx2x_reg.h
+++ b/drivers/net/bnx2x_reg.h
@@ -4561,7 +4561,8 @@
4561#define LATCHED_ATTN_SCPAD_PARITY_MCP 33 4561#define LATCHED_ATTN_SCPAD_PARITY_MCP 33
4562 4562
4563#define GENERAL_ATTEN_WORD(atten_name) ((94 + atten_name) / 32) 4563#define GENERAL_ATTEN_WORD(atten_name) ((94 + atten_name) / 32)
4564#define GENERAL_ATTEN_OFFSET(atten_name) (1 << ((94 + atten_name) % 32)) 4564#define GENERAL_ATTEN_OFFSET(atten_name)\
4565 (1UL << ((94 + atten_name) % 32))
4565/* 4566/*
4566 * This file defines GRC base address for every block. 4567 * This file defines GRC base address for every block.
4567 * This file is included by chipsim, asm microcode and cpp microcode. 4568 * This file is included by chipsim, asm microcode and cpp microcode.