diff options
author | Eilon Greenstein <eilong@broadcom.com> | 2009-08-12 04:22:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-08-13 02:02:19 -0400 |
commit | b1607af526fd408b244c7b32a0c256c1ef163a17 (patch) | |
tree | 7efd1dd3780d2b96ea15f22f99297cd20100de91 /drivers/net/bnx2x_link.c | |
parent | 2f9044603c8b9ead9eb4d88e360093b44d362b58 (diff) |
bnx2x: Reading the FW version of the BCM8481 PHY
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>
Diffstat (limited to 'drivers/net/bnx2x_link.c')
-rw-r--r-- | drivers/net/bnx2x_link.c | 118 |
1 files changed, 113 insertions, 5 deletions
diff --git a/drivers/net/bnx2x_link.c b/drivers/net/bnx2x_link.c index 9e1f19a00ab1..c9252498d51d 100644 --- a/drivers/net/bnx2x_link.c +++ b/drivers/net/bnx2x_link.c | |||
@@ -2046,6 +2046,111 @@ static void bnx2x_save_bcm_spirom_ver(struct bnx2x *bp, u8 port, | |||
2046 | (u32)(fw_ver1<<16 | fw_ver2)); | 2046 | (u32)(fw_ver1<<16 | fw_ver2)); |
2047 | } | 2047 | } |
2048 | 2048 | ||
2049 | |||
2050 | static void bnx2x_save_8481_spirom_version(struct bnx2x *bp, u8 port, | ||
2051 | u8 ext_phy_addr, u32 shmem_base) | ||
2052 | { | ||
2053 | u16 val, fw_ver1, fw_ver2, cnt; | ||
2054 | /* For the 32 bits registers in 8481, access via MDIO2ARM interface.*/ | ||
2055 | /* (1) set register 0xc200_0014(SPI_BRIDGE_CTRL_2) to 0x03000000 */ | ||
2056 | bnx2x_cl45_write(bp, port, | ||
2057 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2058 | ext_phy_addr, MDIO_PMA_DEVAD, | ||
2059 | 0xA819, 0x0014); | ||
2060 | bnx2x_cl45_write(bp, port, | ||
2061 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2062 | ext_phy_addr, | ||
2063 | MDIO_PMA_DEVAD, | ||
2064 | 0xA81A, | ||
2065 | 0xc200); | ||
2066 | bnx2x_cl45_write(bp, port, | ||
2067 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2068 | ext_phy_addr, | ||
2069 | MDIO_PMA_DEVAD, | ||
2070 | 0xA81B, | ||
2071 | 0x0000); | ||
2072 | bnx2x_cl45_write(bp, port, | ||
2073 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2074 | ext_phy_addr, | ||
2075 | MDIO_PMA_DEVAD, | ||
2076 | 0xA81C, | ||
2077 | 0x0300); | ||
2078 | bnx2x_cl45_write(bp, port, | ||
2079 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2080 | ext_phy_addr, | ||
2081 | MDIO_PMA_DEVAD, | ||
2082 | 0xA817, | ||
2083 | 0x0009); | ||
2084 | |||
2085 | for (cnt = 0; cnt < 100; cnt++) { | ||
2086 | bnx2x_cl45_read(bp, port, | ||
2087 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2088 | ext_phy_addr, | ||
2089 | MDIO_PMA_DEVAD, | ||
2090 | 0xA818, | ||
2091 | &val); | ||
2092 | if (val & 1) | ||
2093 | break; | ||
2094 | udelay(5); | ||
2095 | } | ||
2096 | if (cnt == 100) { | ||
2097 | DP(NETIF_MSG_LINK, "Unable to read 8481 phy fw version(1)\n"); | ||
2098 | bnx2x_save_spirom_version(bp, port, | ||
2099 | shmem_base, 0); | ||
2100 | return; | ||
2101 | } | ||
2102 | |||
2103 | |||
2104 | /* 2) read register 0xc200_0000 (SPI_FW_STATUS) */ | ||
2105 | bnx2x_cl45_write(bp, port, | ||
2106 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2107 | ext_phy_addr, MDIO_PMA_DEVAD, | ||
2108 | 0xA819, 0x0000); | ||
2109 | bnx2x_cl45_write(bp, port, | ||
2110 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2111 | ext_phy_addr, MDIO_PMA_DEVAD, | ||
2112 | 0xA81A, 0xc200); | ||
2113 | bnx2x_cl45_write(bp, port, | ||
2114 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2115 | ext_phy_addr, MDIO_PMA_DEVAD, | ||
2116 | 0xA817, 0x000A); | ||
2117 | for (cnt = 0; cnt < 100; cnt++) { | ||
2118 | bnx2x_cl45_read(bp, port, | ||
2119 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2120 | ext_phy_addr, | ||
2121 | MDIO_PMA_DEVAD, | ||
2122 | 0xA818, | ||
2123 | &val); | ||
2124 | if (val & 1) | ||
2125 | break; | ||
2126 | udelay(5); | ||
2127 | } | ||
2128 | if (cnt == 100) { | ||
2129 | DP(NETIF_MSG_LINK, "Unable to read 8481 phy fw version(2)\n"); | ||
2130 | bnx2x_save_spirom_version(bp, port, | ||
2131 | shmem_base, 0); | ||
2132 | return; | ||
2133 | } | ||
2134 | |||
2135 | /* lower 16 bits of the register SPI_FW_STATUS */ | ||
2136 | bnx2x_cl45_read(bp, port, | ||
2137 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2138 | ext_phy_addr, | ||
2139 | MDIO_PMA_DEVAD, | ||
2140 | 0xA81B, | ||
2141 | &fw_ver1); | ||
2142 | /* upper 16 bits of register SPI_FW_STATUS */ | ||
2143 | bnx2x_cl45_read(bp, port, | ||
2144 | PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, | ||
2145 | ext_phy_addr, | ||
2146 | MDIO_PMA_DEVAD, | ||
2147 | 0xA81C, | ||
2148 | &fw_ver2); | ||
2149 | |||
2150 | bnx2x_save_spirom_version(bp, port, | ||
2151 | shmem_base, (fw_ver2<<16) | fw_ver1); | ||
2152 | } | ||
2153 | |||
2049 | static void bnx2x_bcm8072_external_rom_boot(struct link_params *params) | 2154 | static void bnx2x_bcm8072_external_rom_boot(struct link_params *params) |
2050 | { | 2155 | { |
2051 | struct bnx2x *bp = params->bp; | 2156 | struct bnx2x *bp = params->bp; |
@@ -4269,11 +4374,10 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars) | |||
4269 | autoneg_ctrl); | 4374 | autoneg_ctrl); |
4270 | } | 4375 | } |
4271 | 4376 | ||
4272 | bnx2x_save_bcm_spirom_ver(bp, params->port, | 4377 | /* Save spirom version */ |
4273 | ext_phy_type, | 4378 | bnx2x_save_8481_spirom_version(bp, params->port, |
4274 | ext_phy_addr, | 4379 | ext_phy_addr, |
4275 | params->shmem_base); | 4380 | params->shmem_base); |
4276 | |||
4277 | break; | 4381 | break; |
4278 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE: | 4382 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE: |
4279 | DP(NETIF_MSG_LINK, | 4383 | DP(NETIF_MSG_LINK, |
@@ -5320,7 +5424,11 @@ u8 bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded, | |||
5320 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705: | 5424 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705: |
5321 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: | 5425 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706: |
5322 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: | 5426 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726: |
5427 | status = bnx2x_format_ver(spirom_ver, version, len); | ||
5428 | break; | ||
5323 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481: | 5429 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481: |
5430 | spirom_ver = ((spirom_ver & 0xF80) >> 7) << 16 | | ||
5431 | (spirom_ver & 0x7F); | ||
5324 | status = bnx2x_format_ver(spirom_ver, version, len); | 5432 | status = bnx2x_format_ver(spirom_ver, version, len); |
5325 | break; | 5433 | break; |
5326 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: | 5434 | case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT: |