diff options
author | Yuval Mintz <Yuval.Mintz@qlogic.com> | 2016-02-21 08:07:27 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-21 22:50:54 -0500 |
commit | 27ba2d2df0d7882008d9cf21f7dc05711415eeac (patch) | |
tree | 715d8f52deec460e6a384c69c389216a793ef438 | |
parent | 512ab9a001eb88e197859cefbb89b609a971251f (diff) |
bnx2x: Correct 84858 PHY fw version
The phy's firmware version isn't being parsed properly as it's
currently parsed like the rest of the 848xx phys.
Signed-off-by: Yuval Mintz <Yuval.Mintz@qlogic.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | 92 |
1 files changed, 79 insertions, 13 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c index b496e4a7b910..0c7b1c706142 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c | |||
@@ -6185,26 +6185,80 @@ static int bnx2x_format_ver(u32 num, u8 *str, u16 *len) | |||
6185 | shift -= 4; | 6185 | shift -= 4; |
6186 | digit = ((num & mask) >> shift); | 6186 | digit = ((num & mask) >> shift); |
6187 | if (digit == 0 && remove_leading_zeros) { | 6187 | if (digit == 0 && remove_leading_zeros) { |
6188 | mask = mask >> 4; | 6188 | *str_ptr = '0'; |
6189 | continue; | 6189 | } else { |
6190 | } else if (digit < 0xa) | 6190 | if (digit < 0xa) |
6191 | *str_ptr = digit + '0'; | 6191 | *str_ptr = digit + '0'; |
6192 | else | 6192 | else |
6193 | *str_ptr = digit - 0xa + 'a'; | 6193 | *str_ptr = digit - 0xa + 'a'; |
6194 | remove_leading_zeros = 0; | 6194 | |
6195 | str_ptr++; | 6195 | remove_leading_zeros = 0; |
6196 | (*len)--; | 6196 | str_ptr++; |
6197 | (*len)--; | ||
6198 | } | ||
6197 | mask = mask >> 4; | 6199 | mask = mask >> 4; |
6198 | if (shift == 4*4) { | 6200 | if (shift == 4*4) { |
6201 | if (remove_leading_zeros) { | ||
6202 | str_ptr++; | ||
6203 | (*len)--; | ||
6204 | } | ||
6199 | *str_ptr = '.'; | 6205 | *str_ptr = '.'; |
6200 | str_ptr++; | 6206 | str_ptr++; |
6201 | (*len)--; | 6207 | (*len)--; |
6202 | remove_leading_zeros = 1; | 6208 | remove_leading_zeros = 1; |
6203 | } | 6209 | } |
6204 | } | 6210 | } |
6211 | if (remove_leading_zeros) | ||
6212 | (*len)--; | ||
6205 | return 0; | 6213 | return 0; |
6206 | } | 6214 | } |
6207 | 6215 | ||
6216 | static int bnx2x_3_seq_format_ver(u32 num, u8 *str, u16 *len) | ||
6217 | { | ||
6218 | u8 *str_ptr = str; | ||
6219 | u32 mask = 0x00f00000; | ||
6220 | u8 shift = 8*3; | ||
6221 | u8 digit; | ||
6222 | u8 remove_leading_zeros = 1; | ||
6223 | |||
6224 | if (*len < 10) { | ||
6225 | /* Need more than 10chars for this format */ | ||
6226 | *str_ptr = '\0'; | ||
6227 | (*len)--; | ||
6228 | return -EINVAL; | ||
6229 | } | ||
6230 | |||
6231 | while (shift > 0) { | ||
6232 | shift -= 4; | ||
6233 | digit = ((num & mask) >> shift); | ||
6234 | if (digit == 0 && remove_leading_zeros) { | ||
6235 | *str_ptr = '0'; | ||
6236 | } else { | ||
6237 | if (digit < 0xa) | ||
6238 | *str_ptr = digit + '0'; | ||
6239 | else | ||
6240 | *str_ptr = digit - 0xa + 'a'; | ||
6241 | |||
6242 | remove_leading_zeros = 0; | ||
6243 | str_ptr++; | ||
6244 | (*len)--; | ||
6245 | } | ||
6246 | mask = mask >> 4; | ||
6247 | if ((shift == 4*4) || (shift == 4*2)) { | ||
6248 | if (remove_leading_zeros) { | ||
6249 | str_ptr++; | ||
6250 | (*len)--; | ||
6251 | } | ||
6252 | *str_ptr = '.'; | ||
6253 | str_ptr++; | ||
6254 | (*len)--; | ||
6255 | remove_leading_zeros = 1; | ||
6256 | } | ||
6257 | } | ||
6258 | if (remove_leading_zeros) | ||
6259 | (*len)--; | ||
6260 | return 0; | ||
6261 | } | ||
6208 | 6262 | ||
6209 | static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len) | 6263 | static int bnx2x_null_format_ver(u32 spirom_ver, u8 *str, u16 *len) |
6210 | { | 6264 | { |
@@ -9677,8 +9731,9 @@ static void bnx2x_save_848xx_spirom_version(struct bnx2x_phy *phy, | |||
9677 | 9731 | ||
9678 | if (bnx2x_is_8483x_8485x(phy)) { | 9732 | if (bnx2x_is_8483x_8485x(phy)) { |
9679 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); | 9733 | bnx2x_cl45_read(bp, phy, MDIO_CTL_DEVAD, 0x400f, &fw_ver1); |
9680 | bnx2x_save_spirom_version(bp, port, fw_ver1 & 0xfff, | 9734 | if (phy->type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84858) |
9681 | phy->ver_addr); | 9735 | fw_ver1 &= 0xfff; |
9736 | bnx2x_save_spirom_version(bp, port, fw_ver1, phy->ver_addr); | ||
9682 | } else { | 9737 | } else { |
9683 | /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ | 9738 | /* For 32-bit registers in 848xx, access via MDIO2ARM i/f. */ |
9684 | /* (1) set reg 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */ | 9739 | /* (1) set reg 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */ |
@@ -9775,7 +9830,7 @@ static void bnx2x_848xx_specific_func(struct bnx2x_phy *phy, | |||
9775 | struct bnx2x *bp = params->bp; | 9830 | struct bnx2x *bp = params->bp; |
9776 | switch (action) { | 9831 | switch (action) { |
9777 | case PHY_INIT: | 9832 | case PHY_INIT: |
9778 | if (!bnx2x_is_8483x_8485x(phy)) { | 9833 | if (bnx2x_is_8483x_8485x(phy)) { |
9779 | /* Save spirom version */ | 9834 | /* Save spirom version */ |
9780 | bnx2x_save_848xx_spirom_version(phy, bp, params->port); | 9835 | bnx2x_save_848xx_spirom_version(phy, bp, params->port); |
9781 | } | 9836 | } |
@@ -10581,6 +10636,17 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, | |||
10581 | return link_up; | 10636 | return link_up; |
10582 | } | 10637 | } |
10583 | 10638 | ||
10639 | static int bnx2x_8485x_format_ver(u32 raw_ver, u8 *str, u16 *len) | ||
10640 | { | ||
10641 | int status = 0; | ||
10642 | u32 num; | ||
10643 | |||
10644 | num = ((raw_ver & 0xF80) >> 7) << 16 | ((raw_ver & 0x7F) << 8) | | ||
10645 | ((raw_ver & 0xF000) >> 12); | ||
10646 | status = bnx2x_3_seq_format_ver(num, str, len); | ||
10647 | return status; | ||
10648 | } | ||
10649 | |||
10584 | static int bnx2x_848xx_format_ver(u32 raw_ver, u8 *str, u16 *len) | 10650 | static int bnx2x_848xx_format_ver(u32 raw_ver, u8 *str, u16 *len) |
10585 | { | 10651 | { |
10586 | int status = 0; | 10652 | int status = 0; |
@@ -12008,7 +12074,7 @@ static const struct bnx2x_phy phy_84858 = { | |||
12008 | .read_status = (read_status_t)bnx2x_848xx_read_status, | 12074 | .read_status = (read_status_t)bnx2x_848xx_read_status, |
12009 | .link_reset = (link_reset_t)bnx2x_848x3_link_reset, | 12075 | .link_reset = (link_reset_t)bnx2x_848x3_link_reset, |
12010 | .config_loopback = (config_loopback_t)NULL, | 12076 | .config_loopback = (config_loopback_t)NULL, |
12011 | .format_fw_ver = (format_fw_ver_t)bnx2x_848xx_format_ver, | 12077 | .format_fw_ver = (format_fw_ver_t)bnx2x_8485x_format_ver, |
12012 | .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, | 12078 | .hw_reset = (hw_reset_t)bnx2x_84833_hw_reset_phy, |
12013 | .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, | 12079 | .set_link_led = (set_link_led_t)bnx2x_848xx_set_link_led, |
12014 | .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func | 12080 | .phy_specific_func = (phy_specific_func_t)bnx2x_848xx_specific_func |