diff options
author | Yaniv Rosner <yanivr@broadcom.com> | 2011-07-04 21:06:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-05 07:21:40 -0400 |
commit | 985848f80ffc61a29d9a72fec46ddce3c9643636 (patch) | |
tree | 756d4cf1b0c10d8e3260b40d5a19f784dd725f7b | |
parent | a34bc969a19b3a2364c03c101abb3b4d467089c0 (diff) |
bnx2x: Reset PHY due to fan failure for 578xx
Add hardware PHY reset action for BCM578xx when fan failure occur.
The new bnx2x_warpcore_hw_reset warps bnx2x_warpcore_power_module to fit the .hw_reset function template of the phy structure.
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_link.c | 80 |
1 files changed, 65 insertions, 15 deletions
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index 270a2f7f2c7f..a04fa13ad1c2 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
@@ -7904,6 +7904,9 @@ static void bnx2x_warpcore_power_module(struct link_params *params, | |||
7904 | dev_info.port_hw_config[params->port].e3_sfp_ctrl)) & | 7904 | dev_info.port_hw_config[params->port].e3_sfp_ctrl)) & |
7905 | PORT_HW_CFG_E3_PWR_DIS_MASK) >> | 7905 | PORT_HW_CFG_E3_PWR_DIS_MASK) >> |
7906 | PORT_HW_CFG_E3_PWR_DIS_SHIFT; | 7906 | PORT_HW_CFG_E3_PWR_DIS_SHIFT; |
7907 | |||
7908 | if (pin_cfg == PIN_CFG_NA) | ||
7909 | return; | ||
7907 | DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n", | 7910 | DP(NETIF_MSG_LINK, "Setting SFP+ module power to %d using pin cfg %d\n", |
7908 | power, pin_cfg); | 7911 | power, pin_cfg); |
7909 | /* | 7912 | /* |
@@ -7913,6 +7916,12 @@ static void bnx2x_warpcore_power_module(struct link_params *params, | |||
7913 | bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1); | 7916 | bnx2x_set_cfg_pin(bp, pin_cfg, power ^ 1); |
7914 | } | 7917 | } |
7915 | 7918 | ||
7919 | static void bnx2x_warpcore_hw_reset(struct bnx2x_phy *phy, | ||
7920 | struct link_params *params) | ||
7921 | { | ||
7922 | bnx2x_warpcore_power_module(params, phy, 0); | ||
7923 | } | ||
7924 | |||
7916 | static void bnx2x_power_sfp_module(struct link_params *params, | 7925 | static void bnx2x_power_sfp_module(struct link_params *params, |
7917 | struct bnx2x_phy *phy, | 7926 | struct bnx2x_phy *phy, |
7918 | u8 power) | 7927 | u8 power) |
@@ -9294,9 +9303,9 @@ static int bnx2x_84833_pair_swap_cfg(struct bnx2x_phy *phy, | |||
9294 | } | 9303 | } |
9295 | 9304 | ||
9296 | 9305 | ||
9297 | static int bnx2x_84833_common_init_phy(struct bnx2x *bp, | 9306 | static u8 bnx2x_84833_get_reset_gpios(struct bnx2x *bp, |
9298 | u32 shmem_base_path[], | 9307 | u32 shmem_base_path[], |
9299 | u32 chip_id) | 9308 | u32 chip_id) |
9300 | { | 9309 | { |
9301 | u32 reset_pin[2]; | 9310 | u32 reset_pin[2]; |
9302 | u32 idx; | 9311 | u32 idx; |
@@ -9329,6 +9338,41 @@ static int bnx2x_84833_common_init_phy(struct bnx2x *bp, | |||
9329 | reset_gpios = (u8)(reset_pin[0] | reset_pin[1]); | 9338 | reset_gpios = (u8)(reset_pin[0] | reset_pin[1]); |
9330 | } | 9339 | } |
9331 | 9340 | ||
9341 | return reset_gpios; | ||
9342 | } | ||
9343 | |||
9344 | static int bnx2x_84833_hw_reset_phy(struct bnx2x_phy *phy, | ||
9345 | struct link_params *params) | ||
9346 | { | ||
9347 | struct bnx2x *bp = params->bp; | ||
9348 | u8 reset_gpios; | ||
9349 | u32 other_shmem_base_addr = REG_RD(bp, params->shmem2_base + | ||
9350 | offsetof(struct shmem2_region, | ||
9351 | other_shmem_base_addr)); | ||
9352 | |||
9353 | u32 shmem_base_path[2]; | ||
9354 | shmem_base_path[0] = params->shmem_base; | ||
9355 | shmem_base_path[1] = other_shmem_base_addr; | ||
9356 | |||
9357 | reset_gpios = bnx2x_84833_get_reset_gpios(bp, shmem_base_path, | ||
9358 | params->chip_id); | ||
9359 | |||
9360 | bnx2x_set_mult_gpio(bp, reset_gpios, MISC_REGISTERS_GPIO_OUTPUT_LOW); | ||
9361 | udelay(10); | ||
9362 | DP(NETIF_MSG_LINK, "84833 hw reset on pin values 0x%x\n", | ||
9363 | reset_gpios); | ||
9364 | |||
9365 | return 0; | ||
9366 | } | ||
9367 | |||
9368 | static int bnx2x_84833_common_init_phy(struct bnx2x *bp, | ||
9369 | u32 shmem_base_path[], | ||
9370 | u32 chip_id) | ||
9371 | { | ||
9372 | u8 reset_gpios; | ||
9373 | |||
9374 | reset_gpios = bnx2x_84833_get_reset_gpios(bp, shmem_base_path, chip_id); | ||
9375 | |||
9332 | bnx2x_set_mult_gpio(bp, reset_gpios, MISC_REGISTERS_GPIO_OUTPUT_LOW); | 9376 | bnx2x_set_mult_gpio(bp, reset_gpios, MISC_REGISTERS_GPIO_OUTPUT_LOW); |
9333 | udelay(10); | 9377 | udelay(10); |
9334 | bnx2x_set_mult_gpio(bp, reset_gpios, MISC_REGISTERS_GPIO_OUTPUT_HIGH); | 9378 | bnx2x_set_mult_gpio(bp, reset_gpios, MISC_REGISTERS_GPIO_OUTPUT_HIGH); |
@@ -9362,17 +9406,11 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
9362 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, | 9406 | MISC_REGISTERS_GPIO_OUTPUT_HIGH, |
9363 | port); | 9407 | port); |
9364 | } else { | 9408 | } else { |
9409 | /* MDIO reset */ | ||
9365 | bnx2x_cl45_write(bp, phy, | 9410 | bnx2x_cl45_write(bp, phy, |
9366 | MDIO_PMA_DEVAD, | 9411 | MDIO_PMA_DEVAD, |
9367 | MDIO_PMA_REG_CTRL, 0x8000); | 9412 | MDIO_PMA_REG_CTRL, 0x8000); |
9368 | } | 9413 | /* Bring PHY out of super isolate mode */ |
9369 | |||
9370 | bnx2x_wait_reset_complete(bp, phy, params); | ||
9371 | /* Wait for GPHY to come out of reset */ | ||
9372 | msleep(50); | ||
9373 | |||
9374 | /* Bring PHY out of super isolate mode */ | ||
9375 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) { | ||
9376 | bnx2x_cl45_read(bp, phy, | 9414 | bnx2x_cl45_read(bp, phy, |
9377 | MDIO_CTL_DEVAD, | 9415 | MDIO_CTL_DEVAD, |
9378 | MDIO_84833_TOP_CFG_XGPHY_STRAP1, &val); | 9416 | MDIO_84833_TOP_CFG_XGPHY_STRAP1, &val); |
@@ -9380,9 +9418,13 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, | |||
9380 | bnx2x_cl45_write(bp, phy, | 9418 | bnx2x_cl45_write(bp, phy, |
9381 | MDIO_CTL_DEVAD, | 9419 | MDIO_CTL_DEVAD, |
9382 | MDIO_84833_TOP_CFG_XGPHY_STRAP1, val); | 9420 | MDIO_84833_TOP_CFG_XGPHY_STRAP1, val); |
9383 | bnx2x_wait_reset_complete(bp, phy, params); | ||
9384 | } | 9421 | } |
9385 | 9422 | ||
9423 | bnx2x_wait_reset_complete(bp, phy, params); | ||
9424 | |||
9425 | /* Wait for GPHY to come out of reset */ | ||
9426 | msleep(50); | ||
9427 | |||
9386 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) | 9428 | if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84833) |
9387 | bnx2x_84833_pair_swap_cfg(phy, params, vars); | 9429 | bnx2x_84833_pair_swap_cfg(phy, params, vars); |
9388 | 9430 | ||
@@ -10448,7 +10490,7 @@ static struct bnx2x_phy phy_warpcore = { | |||
10448 | .link_reset = (link_reset_t)bnx2x_warpcore_link_reset, | 10490 | .link_reset = (link_reset_t)bnx2x_warpcore_link_reset, |
10449 | .config_loopback = (config_loopback_t)bnx2x_set_warpcore_loopback, | 10491 | .config_loopback = (config_loopback_t)bnx2x_set_warpcore_loopback, |
10450 | .format_fw_ver = (format_fw_ver_t)NULL, | 10492 | .format_fw_ver = (format_fw_ver_t)NULL, |
10451 | .hw_reset = (hw_reset_t)NULL, | 10493 | .hw_reset = (hw_reset_t)bnx2x_warpcore_hw_reset, |
10452 | .set_link_led = (set_link_led_t)NULL, | 10494 | .set_link_led = (set_link_led_t)NULL, |
10453 | .phy_specific_func = (phy_specific_func_t)NULL | 10495 | .phy_specific_func = (phy_specific_func_t)NULL |
10454 | }; | 10496 | }; |
@@ -10736,7 +10778,7 @@ static struct bnx2x_phy phy_84833 = { | |||
10736 | .link_reset = (link_reset_t)bnx2x_848x3_link_reset, | 10778 | .link_reset = (link_reset_t)bnx2x_848x3_link_reset, |
10737 | .config_loopback = (config_loopback_t)NULL, | 10779 | .config_loopback = (config_loopback_t)NULL, |
10738 | .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, | 10780 | .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, |
10739 | .hw_reset = (hw_reset_t)NULL, | 10781 | .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, |
10740 | .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, | 10782 | .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, |
10741 | .phy_specific_func = (phy_specific_func_t)NULL | 10783 | .phy_specific_func = (phy_specific_func_t)NULL |
10742 | }; | 10784 | }; |
@@ -12122,7 +12164,15 @@ u8 bnx2x_fan_failure_det_req(struct bnx2x *bp, | |||
12122 | void bnx2x_hw_reset_phy(struct link_params *params) | 12164 | void bnx2x_hw_reset_phy(struct link_params *params) |
12123 | { | 12165 | { |
12124 | u8 phy_index; | 12166 | u8 phy_index; |
12125 | for (phy_index = EXT_PHY1; phy_index < MAX_PHYS; | 12167 | struct bnx2x *bp = params->bp; |
12168 | bnx2x_update_mng(params, 0); | ||
12169 | bnx2x_bits_dis(bp, NIG_REG_MASK_INTERRUPT_PORT0 + params->port*4, | ||
12170 | (NIG_MASK_XGXS0_LINK_STATUS | | ||
12171 | NIG_MASK_XGXS0_LINK10G | | ||
12172 | NIG_MASK_SERDES0_LINK_STATUS | | ||
12173 | NIG_MASK_MI_INT)); | ||
12174 | |||
12175 | for (phy_index = INT_PHY; phy_index < MAX_PHYS; | ||
12126 | phy_index++) { | 12176 | phy_index++) { |
12127 | if (params->phy[phy_index].hw_reset) { | 12177 | if (params->phy[phy_index].hw_reset) { |
12128 | params->phy[phy_index].hw_reset( | 12178 | params->phy[phy_index].hw_reset( |