aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2x_link.c
diff options
context:
space:
mode:
authorEilon Greenstein <eilong@broadcom.com>2009-08-12 04:24:29 -0400
committerDavid S. Miller <davem@davemloft.net>2009-08-13 02:03:01 -0400
commitab6ad5a4875e99dffe957a411fe890402a91f67f (patch)
tree26bb0b2a38808f099c0719d5e54ceb3ccc835fa9 /drivers/net/bnx2x_link.c
parent9c63de6293775b537614550fd61075a33ada9469 (diff)
bnx2x: Whitespaces and comments
Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x_link.c')
-rw-r--r--drivers/net/bnx2x_link.c115
1 files changed, 58 insertions, 57 deletions
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);