diff options
Diffstat (limited to 'drivers/net/bnx2x/bnx2x_link.c')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_link.c | 234 |
1 files changed, 155 insertions, 79 deletions
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index 43b0de24f391..dd1210fddfff 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
@@ -1573,7 +1573,7 @@ static void bnx2x_set_aer_mmd_xgxs(struct link_params *params, | |||
1573 | 1573 | ||
1574 | offset = phy->addr + ser_lane; | 1574 | offset = phy->addr + ser_lane; |
1575 | if (CHIP_IS_E2(bp)) | 1575 | if (CHIP_IS_E2(bp)) |
1576 | aer_val = 0x2800 + offset - 1; | 1576 | aer_val = 0x3800 + offset - 1; |
1577 | else | 1577 | else |
1578 | aer_val = 0x3800 + offset; | 1578 | aer_val = 0x3800 + offset; |
1579 | CL45_WR_OVER_CL22(bp, phy, | 1579 | CL45_WR_OVER_CL22(bp, phy, |
@@ -3166,7 +3166,23 @@ u8 bnx2x_set_led(struct link_params *params, | |||
3166 | if (!vars->link_up) | 3166 | if (!vars->link_up) |
3167 | break; | 3167 | break; |
3168 | case LED_MODE_ON: | 3168 | case LED_MODE_ON: |
3169 | if (SINGLE_MEDIA_DIRECT(params)) { | 3169 | if (params->phy[EXT_PHY1].type == |
3170 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8727 && | ||
3171 | CHIP_IS_E2(bp) && params->num_phys == 2) { | ||
3172 | /** | ||
3173 | * This is a work-around for E2+8727 Configurations | ||
3174 | */ | ||
3175 | if (mode == LED_MODE_ON || | ||
3176 | speed == SPEED_10000){ | ||
3177 | REG_WR(bp, NIG_REG_LED_MODE_P0 + port*4, 0); | ||
3178 | REG_WR(bp, NIG_REG_LED_10G_P0 + port*4, 1); | ||
3179 | |||
3180 | tmp = EMAC_RD(bp, EMAC_REG_EMAC_LED); | ||
3181 | EMAC_WR(bp, EMAC_REG_EMAC_LED, | ||
3182 | (tmp | EMAC_LED_OVERRIDE)); | ||
3183 | return rc; | ||
3184 | } | ||
3185 | } else if (SINGLE_MEDIA_DIRECT(params)) { | ||
3170 | /** | 3186 | /** |
3171 | * This is a work-around for HW issue found when link | 3187 | * This is a work-around for HW issue found when link |
3172 | * is up in CL73 | 3188 | * is up in CL73 |
@@ -3854,11 +3870,14 @@ static void bnx2x_8073_resolve_fc(struct bnx2x_phy *phy, | |||
3854 | pause_result); | 3870 | pause_result); |
3855 | } | 3871 | } |
3856 | } | 3872 | } |
3857 | 3873 | static u8 bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp, | |
3858 | static void bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp, | ||
3859 | struct bnx2x_phy *phy, | 3874 | struct bnx2x_phy *phy, |
3860 | u8 port) | 3875 | u8 port) |
3861 | { | 3876 | { |
3877 | u32 count = 0; | ||
3878 | u16 fw_ver1, fw_msgout; | ||
3879 | u8 rc = 0; | ||
3880 | |||
3862 | /* Boot port from external ROM */ | 3881 | /* Boot port from external ROM */ |
3863 | /* EDC grst */ | 3882 | /* EDC grst */ |
3864 | bnx2x_cl45_write(bp, phy, | 3883 | bnx2x_cl45_write(bp, phy, |
@@ -3888,56 +3907,45 @@ static void bnx2x_8073_8727_external_rom_boot(struct bnx2x *bp, | |||
3888 | MDIO_PMA_REG_GEN_CTRL, | 3907 | MDIO_PMA_REG_GEN_CTRL, |
3889 | MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP); | 3908 | MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP); |
3890 | 3909 | ||
3891 | /* wait for 120ms for code download via SPI port */ | 3910 | /* Delay 100ms per the PHY specifications */ |
3892 | msleep(120); | 3911 | msleep(100); |
3912 | |||
3913 | /* 8073 sometimes taking longer to download */ | ||
3914 | do { | ||
3915 | count++; | ||
3916 | if (count > 300) { | ||
3917 | DP(NETIF_MSG_LINK, | ||
3918 | "bnx2x_8073_8727_external_rom_boot port %x:" | ||
3919 | "Download failed. fw version = 0x%x\n", | ||
3920 | port, fw_ver1); | ||
3921 | rc = -EINVAL; | ||
3922 | break; | ||
3923 | } | ||
3924 | |||
3925 | bnx2x_cl45_read(bp, phy, | ||
3926 | MDIO_PMA_DEVAD, | ||
3927 | MDIO_PMA_REG_ROM_VER1, &fw_ver1); | ||
3928 | bnx2x_cl45_read(bp, phy, | ||
3929 | MDIO_PMA_DEVAD, | ||
3930 | MDIO_PMA_REG_M8051_MSGOUT_REG, &fw_msgout); | ||
3931 | |||
3932 | msleep(1); | ||
3933 | } while (fw_ver1 == 0 || fw_ver1 == 0x4321 || | ||
3934 | ((fw_msgout & 0xff) != 0x03 && (phy->type == | ||
3935 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073))); | ||
3893 | 3936 | ||
3894 | /* Clear ser_boot_ctl bit */ | 3937 | /* Clear ser_boot_ctl bit */ |
3895 | bnx2x_cl45_write(bp, phy, | 3938 | bnx2x_cl45_write(bp, phy, |
3896 | MDIO_PMA_DEVAD, | 3939 | MDIO_PMA_DEVAD, |
3897 | MDIO_PMA_REG_MISC_CTRL1, 0x0000); | 3940 | MDIO_PMA_REG_MISC_CTRL1, 0x0000); |
3898 | bnx2x_save_bcm_spirom_ver(bp, phy, port); | 3941 | bnx2x_save_bcm_spirom_ver(bp, phy, port); |
3899 | } | ||
3900 | 3942 | ||
3901 | static void bnx2x_8073_set_xaui_low_power_mode(struct bnx2x *bp, | 3943 | DP(NETIF_MSG_LINK, |
3902 | struct bnx2x_phy *phy) | 3944 | "bnx2x_8073_8727_external_rom_boot port %x:" |
3903 | { | 3945 | "Download complete. fw version = 0x%x\n", |
3904 | u16 val; | 3946 | port, fw_ver1); |
3905 | bnx2x_cl45_read(bp, phy, | ||
3906 | MDIO_PMA_DEVAD, MDIO_PMA_REG_8073_CHIP_REV, &val); | ||
3907 | |||
3908 | if (val == 0) { | ||
3909 | /* Mustn't set low power mode in 8073 A0 */ | ||
3910 | return; | ||
3911 | } | ||
3912 | |||
3913 | /* Disable PLL sequencer (use read-modify-write to clear bit 13) */ | ||
3914 | bnx2x_cl45_read(bp, phy, | ||
3915 | MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, &val); | ||
3916 | val &= ~(1<<13); | ||
3917 | bnx2x_cl45_write(bp, phy, | ||
3918 | MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, val); | ||
3919 | |||
3920 | /* PLL controls */ | ||
3921 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805E, 0x1077); | ||
3922 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805D, 0x0000); | ||
3923 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805C, 0x030B); | ||
3924 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805B, 0x1240); | ||
3925 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x805A, 0x2490); | ||
3926 | |||
3927 | /* Tx Controls */ | ||
3928 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80A7, 0x0C74); | ||
3929 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80A6, 0x9041); | ||
3930 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80A5, 0x4640); | ||
3931 | |||
3932 | /* Rx Controls */ | ||
3933 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80FE, 0x01C4); | ||
3934 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80FD, 0x9249); | ||
3935 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, 0x80FC, 0x2015); | ||
3936 | 3947 | ||
3937 | /* Enable PLL sequencer (use read-modify-write to set bit 13) */ | 3948 | return rc; |
3938 | bnx2x_cl45_read(bp, phy, MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, &val); | ||
3939 | val |= (1<<13); | ||
3940 | bnx2x_cl45_write(bp, phy, MDIO_XS_DEVAD, MDIO_XS_PLL_SEQUENCER, val); | ||
3941 | } | 3949 | } |
3942 | 3950 | ||
3943 | /******************************************************************/ | 3951 | /******************************************************************/ |
@@ -4098,8 +4106,6 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4098 | 4106 | ||
4099 | bnx2x_8073_set_pause_cl37(params, phy, vars); | 4107 | bnx2x_8073_set_pause_cl37(params, phy, vars); |
4100 | 4108 | ||
4101 | bnx2x_8073_set_xaui_low_power_mode(bp, phy); | ||
4102 | |||
4103 | bnx2x_cl45_read(bp, phy, | 4109 | bnx2x_cl45_read(bp, phy, |
4104 | MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &tmp1); | 4110 | MDIO_PMA_DEVAD, MDIO_PMA_REG_M8051_MSGOUT_REG, &tmp1); |
4105 | 4111 | ||
@@ -4108,6 +4114,25 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4108 | 4114 | ||
4109 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); | 4115 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); |
4110 | 4116 | ||
4117 | /** | ||
4118 | * If this is forced speed, set to KR or KX (all other are not | ||
4119 | * supported) | ||
4120 | */ | ||
4121 | /* Swap polarity if required - Must be done only in non-1G mode */ | ||
4122 | if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { | ||
4123 | /* Configure the 8073 to swap _P and _N of the KR lines */ | ||
4124 | DP(NETIF_MSG_LINK, "Swapping polarity for the 8073\n"); | ||
4125 | /* 10G Rx/Tx and 1G Tx signal polarity swap */ | ||
4126 | bnx2x_cl45_read(bp, phy, | ||
4127 | MDIO_PMA_DEVAD, | ||
4128 | MDIO_PMA_REG_8073_OPT_DIGITAL_CTRL, &val); | ||
4129 | bnx2x_cl45_write(bp, phy, | ||
4130 | MDIO_PMA_DEVAD, | ||
4131 | MDIO_PMA_REG_8073_OPT_DIGITAL_CTRL, | ||
4132 | (val | (3<<9))); | ||
4133 | } | ||
4134 | |||
4135 | |||
4111 | /* Enable CL37 BAM */ | 4136 | /* Enable CL37 BAM */ |
4112 | if (REG_RD(bp, params->shmem_base + | 4137 | if (REG_RD(bp, params->shmem_base + |
4113 | offsetof(struct shmem_region, dev_info. | 4138 | offsetof(struct shmem_region, dev_info. |
@@ -4314,8 +4339,32 @@ static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, | |||
4314 | } | 4339 | } |
4315 | 4340 | ||
4316 | if (link_up) { | 4341 | if (link_up) { |
4342 | /* Swap polarity if required */ | ||
4343 | if (params->lane_config & | ||
4344 | PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { | ||
4345 | /* Configure the 8073 to swap P and N of the KR lines */ | ||
4346 | bnx2x_cl45_read(bp, phy, | ||
4347 | MDIO_XS_DEVAD, | ||
4348 | MDIO_XS_REG_8073_RX_CTRL_PCIE, &val1); | ||
4349 | /** | ||
4350 | * Set bit 3 to invert Rx in 1G mode and clear this bit | ||
4351 | * when it`s in 10G mode. | ||
4352 | */ | ||
4353 | if (vars->line_speed == SPEED_1000) { | ||
4354 | DP(NETIF_MSG_LINK, "Swapping 1G polarity for" | ||
4355 | "the 8073\n"); | ||
4356 | val1 |= (1<<3); | ||
4357 | } else | ||
4358 | val1 &= ~(1<<3); | ||
4359 | |||
4360 | bnx2x_cl45_write(bp, phy, | ||
4361 | MDIO_XS_DEVAD, | ||
4362 | MDIO_XS_REG_8073_RX_CTRL_PCIE, | ||
4363 | val1); | ||
4364 | } | ||
4317 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); | 4365 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); |
4318 | bnx2x_8073_resolve_fc(phy, params, vars); | 4366 | bnx2x_8073_resolve_fc(phy, params, vars); |
4367 | vars->duplex = DUPLEX_FULL; | ||
4319 | } | 4368 | } |
4320 | return link_up; | 4369 | return link_up; |
4321 | } | 4370 | } |
@@ -5062,6 +5111,7 @@ static u8 bnx2x_8706_8726_read_status(struct bnx2x_phy *phy, | |||
5062 | else | 5111 | else |
5063 | vars->line_speed = SPEED_10000; | 5112 | vars->line_speed = SPEED_10000; |
5064 | bnx2x_ext_phy_resolve_fc(phy, params, vars); | 5113 | bnx2x_ext_phy_resolve_fc(phy, params, vars); |
5114 | vars->duplex = DUPLEX_FULL; | ||
5065 | } | 5115 | } |
5066 | return link_up; | 5116 | return link_up; |
5067 | } | 5117 | } |
@@ -5758,8 +5808,11 @@ static u8 bnx2x_8727_read_status(struct bnx2x_phy *phy, | |||
5758 | DP(NETIF_MSG_LINK, "port %x: External link is down\n", | 5808 | DP(NETIF_MSG_LINK, "port %x: External link is down\n", |
5759 | params->port); | 5809 | params->port); |
5760 | } | 5810 | } |
5761 | if (link_up) | 5811 | if (link_up) { |
5762 | bnx2x_ext_phy_resolve_fc(phy, params, vars); | 5812 | bnx2x_ext_phy_resolve_fc(phy, params, vars); |
5813 | vars->duplex = DUPLEX_FULL; | ||
5814 | DP(NETIF_MSG_LINK, "duplex = 0x%x\n", vars->duplex); | ||
5815 | } | ||
5763 | 5816 | ||
5764 | if ((DUAL_MEDIA(params)) && | 5817 | if ((DUAL_MEDIA(params)) && |
5765 | (phy->req_line_speed == SPEED_1000)) { | 5818 | (phy->req_line_speed == SPEED_1000)) { |
@@ -5875,10 +5928,26 @@ static void bnx2x_848xx_set_led(struct bnx2x *bp, | |||
5875 | MDIO_PMA_REG_8481_LED2_MASK, | 5928 | MDIO_PMA_REG_8481_LED2_MASK, |
5876 | 0x18); | 5929 | 0x18); |
5877 | 5930 | ||
5931 | /* Select activity source by Tx and Rx, as suggested by PHY AE */ | ||
5878 | bnx2x_cl45_write(bp, phy, | 5932 | bnx2x_cl45_write(bp, phy, |
5879 | MDIO_PMA_DEVAD, | 5933 | MDIO_PMA_DEVAD, |
5880 | MDIO_PMA_REG_8481_LED3_MASK, | 5934 | MDIO_PMA_REG_8481_LED3_MASK, |
5881 | 0x0040); | 5935 | 0x0006); |
5936 | |||
5937 | /* Select the closest activity blink rate to that in 10/100/1000 */ | ||
5938 | bnx2x_cl45_write(bp, phy, | ||
5939 | MDIO_PMA_DEVAD, | ||
5940 | MDIO_PMA_REG_8481_LED3_BLINK, | ||
5941 | 0); | ||
5942 | |||
5943 | bnx2x_cl45_read(bp, phy, | ||
5944 | MDIO_PMA_DEVAD, | ||
5945 | MDIO_PMA_REG_84823_CTL_LED_CTL_1, &val); | ||
5946 | val |= MDIO_PMA_REG_84823_LED3_STRETCH_EN; /* stretch_en for LED3*/ | ||
5947 | |||
5948 | bnx2x_cl45_write(bp, phy, | ||
5949 | MDIO_PMA_DEVAD, | ||
5950 | MDIO_PMA_REG_84823_CTL_LED_CTL_1, val); | ||
5882 | 5951 | ||
5883 | /* 'Interrupt Mask' */ | 5952 | /* 'Interrupt Mask' */ |
5884 | bnx2x_cl45_write(bp, phy, | 5953 | bnx2x_cl45_write(bp, phy, |
@@ -6126,6 +6195,7 @@ static u8 bnx2x_848xx_read_status(struct bnx2x_phy *phy, | |||
6126 | /* Check link 10G */ | 6195 | /* Check link 10G */ |
6127 | if (val2 & (1<<11)) { | 6196 | if (val2 & (1<<11)) { |
6128 | vars->line_speed = SPEED_10000; | 6197 | vars->line_speed = SPEED_10000; |
6198 | vars->duplex = DUPLEX_FULL; | ||
6129 | link_up = 1; | 6199 | link_up = 1; |
6130 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); | 6200 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); |
6131 | } else { /* Check Legacy speed link */ | 6201 | } else { /* Check Legacy speed link */ |
@@ -6405,6 +6475,18 @@ static void bnx2x_848xx_set_link_led(struct bnx2x_phy *phy, | |||
6405 | MDIO_PMA_DEVAD, | 6475 | MDIO_PMA_DEVAD, |
6406 | MDIO_PMA_REG_8481_LED1_MASK, | 6476 | MDIO_PMA_REG_8481_LED1_MASK, |
6407 | 0x80); | 6477 | 0x80); |
6478 | |||
6479 | /* Tell LED3 to blink on source */ | ||
6480 | bnx2x_cl45_read(bp, phy, | ||
6481 | MDIO_PMA_DEVAD, | ||
6482 | MDIO_PMA_REG_8481_LINK_SIGNAL, | ||
6483 | &val); | ||
6484 | val &= ~(7<<6); | ||
6485 | val |= (1<<6); /* A83B[8:6]= 1 */ | ||
6486 | bnx2x_cl45_write(bp, phy, | ||
6487 | MDIO_PMA_DEVAD, | ||
6488 | MDIO_PMA_REG_8481_LINK_SIGNAL, | ||
6489 | val); | ||
6408 | } | 6490 | } |
6409 | break; | 6491 | break; |
6410 | } | 6492 | } |
@@ -6489,6 +6571,7 @@ static u8 bnx2x_7101_read_status(struct bnx2x_phy *phy, | |||
6489 | MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS, | 6571 | MDIO_AN_DEVAD, MDIO_AN_REG_MASTER_STATUS, |
6490 | &val2); | 6572 | &val2); |
6491 | vars->line_speed = SPEED_10000; | 6573 | vars->line_speed = SPEED_10000; |
6574 | vars->duplex = DUPLEX_FULL; | ||
6492 | DP(NETIF_MSG_LINK, "SFX7101 AN status 0x%x->Master=%x\n", | 6575 | DP(NETIF_MSG_LINK, "SFX7101 AN status 0x%x->Master=%x\n", |
6493 | val2, (val2 & (1<<14))); | 6576 | val2, (val2 & (1<<14))); |
6494 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); | 6577 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); |
@@ -7605,10 +7688,13 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7605 | struct bnx2x_phy phy[PORT_MAX]; | 7688 | struct bnx2x_phy phy[PORT_MAX]; |
7606 | struct bnx2x_phy *phy_blk[PORT_MAX]; | 7689 | struct bnx2x_phy *phy_blk[PORT_MAX]; |
7607 | u16 val; | 7690 | u16 val; |
7608 | s8 port; | 7691 | s8 port = 0; |
7609 | s8 port_of_path = 0; | 7692 | s8 port_of_path = 0; |
7610 | 7693 | u32 swap_val, swap_override; | |
7611 | bnx2x_ext_phy_hw_reset(bp, 0); | 7694 | swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); |
7695 | swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE); | ||
7696 | port ^= (swap_val && swap_override); | ||
7697 | bnx2x_ext_phy_hw_reset(bp, port); | ||
7612 | /* PART1 - Reset both phys */ | 7698 | /* PART1 - Reset both phys */ |
7613 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { | 7699 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { |
7614 | u32 shmem_base, shmem2_base; | 7700 | u32 shmem_base, shmem2_base; |
@@ -7663,7 +7749,6 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7663 | 7749 | ||
7664 | /* PART2 - Download firmware to both phys */ | 7750 | /* PART2 - Download firmware to both phys */ |
7665 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { | 7751 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { |
7666 | u16 fw_ver1; | ||
7667 | if (CHIP_IS_E2(bp)) | 7752 | if (CHIP_IS_E2(bp)) |
7668 | port_of_path = 0; | 7753 | port_of_path = 0; |
7669 | else | 7754 | else |
@@ -7671,19 +7756,9 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, | |||
7671 | 7756 | ||
7672 | DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", | 7757 | DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", |
7673 | phy_blk[port]->addr); | 7758 | phy_blk[port]->addr); |
7674 | bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port], | 7759 | if (bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port], |
7675 | port_of_path); | 7760 | port_of_path)) |
7676 | |||
7677 | bnx2x_cl45_read(bp, phy_blk[port], | ||
7678 | MDIO_PMA_DEVAD, | ||
7679 | MDIO_PMA_REG_ROM_VER1, &fw_ver1); | ||
7680 | if (fw_ver1 == 0 || fw_ver1 == 0x4321) { | ||
7681 | DP(NETIF_MSG_LINK, | ||
7682 | "bnx2x_8073_common_init_phy port %x:" | ||
7683 | "Download failed. fw version = 0x%x\n", | ||
7684 | port, fw_ver1); | ||
7685 | return -EINVAL; | 7761 | return -EINVAL; |
7686 | } | ||
7687 | 7762 | ||
7688 | /* Only set bit 10 = 1 (Tx power down) */ | 7763 | /* Only set bit 10 = 1 (Tx power down) */ |
7689 | bnx2x_cl45_read(bp, phy_blk[port], | 7764 | bnx2x_cl45_read(bp, phy_blk[port], |
@@ -7848,27 +7923,17 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, | |||
7848 | } | 7923 | } |
7849 | /* PART2 - Download firmware to both phys */ | 7924 | /* PART2 - Download firmware to both phys */ |
7850 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { | 7925 | for (port = PORT_MAX - 1; port >= PORT_0; port--) { |
7851 | u16 fw_ver1; | ||
7852 | if (CHIP_IS_E2(bp)) | 7926 | if (CHIP_IS_E2(bp)) |
7853 | port_of_path = 0; | 7927 | port_of_path = 0; |
7854 | else | 7928 | else |
7855 | port_of_path = port; | 7929 | port_of_path = port; |
7856 | DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", | 7930 | DP(NETIF_MSG_LINK, "Loading spirom for phy address 0x%x\n", |
7857 | phy_blk[port]->addr); | 7931 | phy_blk[port]->addr); |
7858 | bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port], | 7932 | if (bnx2x_8073_8727_external_rom_boot(bp, phy_blk[port], |
7859 | port_of_path); | 7933 | port_of_path)) |
7860 | bnx2x_cl45_read(bp, phy_blk[port], | ||
7861 | MDIO_PMA_DEVAD, | ||
7862 | MDIO_PMA_REG_ROM_VER1, &fw_ver1); | ||
7863 | if (fw_ver1 == 0 || fw_ver1 == 0x4321) { | ||
7864 | DP(NETIF_MSG_LINK, | ||
7865 | "bnx2x_8727_common_init_phy port %x:" | ||
7866 | "Download failed. fw version = 0x%x\n", | ||
7867 | port, fw_ver1); | ||
7868 | return -EINVAL; | 7934 | return -EINVAL; |
7869 | } | ||
7870 | } | ||
7871 | 7935 | ||
7936 | } | ||
7872 | return 0; | 7937 | return 0; |
7873 | } | 7938 | } |
7874 | 7939 | ||
@@ -7916,6 +7981,7 @@ u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[], | |||
7916 | u32 shmem2_base_path[], u32 chip_id) | 7981 | u32 shmem2_base_path[], u32 chip_id) |
7917 | { | 7982 | { |
7918 | u8 rc = 0; | 7983 | u8 rc = 0; |
7984 | u32 phy_ver; | ||
7919 | u8 phy_index; | 7985 | u8 phy_index; |
7920 | u32 ext_phy_type, ext_phy_config; | 7986 | u32 ext_phy_type, ext_phy_config; |
7921 | DP(NETIF_MSG_LINK, "Begin common phy init\n"); | 7987 | DP(NETIF_MSG_LINK, "Begin common phy init\n"); |
@@ -7923,6 +7989,16 @@ u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base_path[], | |||
7923 | if (CHIP_REV_IS_EMUL(bp)) | 7989 | if (CHIP_REV_IS_EMUL(bp)) |
7924 | return 0; | 7990 | return 0; |
7925 | 7991 | ||
7992 | /* Check if common init was already done */ | ||
7993 | phy_ver = REG_RD(bp, shmem_base_path[0] + | ||
7994 | offsetof(struct shmem_region, | ||
7995 | port_mb[PORT_0].ext_phy_fw_version)); | ||
7996 | if (phy_ver) { | ||
7997 | DP(NETIF_MSG_LINK, "Not doing common init; phy ver is 0x%x\n", | ||
7998 | phy_ver); | ||
7999 | return 0; | ||
8000 | } | ||
8001 | |||
7926 | /* Read the ext_phy_type for arbitrary port(0) */ | 8002 | /* Read the ext_phy_type for arbitrary port(0) */ |
7927 | for (phy_index = EXT_PHY1; phy_index < MAX_PHYS; | 8003 | for (phy_index = EXT_PHY1; phy_index < MAX_PHYS; |
7928 | phy_index++) { | 8004 | phy_index++) { |