Commit bc7f0a05 authored by Eilon Greenstein's avatar Eilon Greenstein Committed by David S. Miller

bnx2x: BCM8727 FW load

The BCM8727 is a dual port PHY. The FW must be loaded in a given order on all
designs - including those which swapped the ports (calling port number zero the
second port)
Signed-off-by: default avatarYaniv Rosner <yanivr@broadcom.com>
Signed-off-by: default avatarEilon Greenstein <eilong@broadcom.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 97b41dad
...@@ -6430,7 +6430,7 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, u32 shmem_base) ...@@ -6430,7 +6430,7 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, u32 shmem_base)
static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base) static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base)
{ {
u8 ext_phy_addr[PORT_MAX]; u8 ext_phy_addr[PORT_MAX];
s8 port; s8 port, first_port, i;
u32 swap_val, swap_override; u32 swap_val, swap_override;
DP(NETIF_MSG_LINK, "Executing BCM8727 common init\n"); DP(NETIF_MSG_LINK, "Executing BCM8727 common init\n");
swap_val = REG_RD(bp, NIG_REG_PORT_SWAP); swap_val = REG_RD(bp, NIG_REG_PORT_SWAP);
...@@ -6439,8 +6439,13 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base) ...@@ -6439,8 +6439,13 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base)
bnx2x_hw_reset(bp, 1 ^ (swap_val && swap_override)); bnx2x_hw_reset(bp, 1 ^ (swap_val && swap_override));
msleep(5); msleep(5);
if (swap_val && swap_override)
first_port = PORT_0;
else
first_port = PORT_1;
/* PART1 - Reset both phys */ /* PART1 - Reset both phys */
for (port = PORT_MAX - 1; port >= PORT_0; port--) { for (i = 0, port = first_port; i < PORT_MAX; i++, port = !port) {
/* Extract the ext phy address for the port */ /* Extract the ext phy address for the port */
u32 ext_phy_config = REG_RD(bp, shmem_base + u32 ext_phy_config = REG_RD(bp, shmem_base +
offsetof(struct shmem_region, offsetof(struct shmem_region,
...@@ -6470,7 +6475,7 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base) ...@@ -6470,7 +6475,7 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base)
msleep(150); msleep(150);
/* PART2 - Download firmware to both phys */ /* PART2 - Download firmware to both phys */
for (port = PORT_MAX - 1; port >= PORT_0; port--) { for (i = 0, port = first_port; i < PORT_MAX; i++, port = !port) {
u16 fw_ver1; u16 fw_ver1;
bnx2x_bcm8727_external_rom_boot(bp, port, bnx2x_bcm8727_external_rom_boot(bp, port,
...@@ -6482,16 +6487,13 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base) ...@@ -6482,16 +6487,13 @@ static u8 bnx2x_8727_common_init_phy(struct bnx2x *bp, u32 shmem_base)
MDIO_PMA_REG_ROM_VER1, &fw_ver1); MDIO_PMA_REG_ROM_VER1, &fw_ver1);
if (fw_ver1 == 0 || fw_ver1 == 0x4321) { if (fw_ver1 == 0 || fw_ver1 == 0x4321) {
DP(NETIF_MSG_LINK, DP(NETIF_MSG_LINK,
"bnx2x_8073_common_init_phy port %x:" "bnx2x_8727_common_init_phy port %x:"
"Download failed. fw version = 0x%x\n", "Download failed. fw version = 0x%x\n",
port, fw_ver1); port, fw_ver1);
return -EINVAL; return -EINVAL;
} }
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment