diff options
author | Yaniv Rosner <yanivr@broadcom.com> | 2011-01-17 23:33:18 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-01-18 19:10:36 -0500 |
commit | 74d7a11979e39adc1fc4d7a77afe83aa12a0f2b1 (patch) | |
tree | 326ad93d0674bb866199e8c06f439691cf63113b /drivers/net/bnx2x | |
parent | f966a13f92913ce8cbd35bc7f066553c9f3d41b0 (diff) |
bnx2x: Swap BCM8073 PHY polarity if required
Enable controlling BCM8073 PN polarity swap through nvm configuration, which is required in certain systems
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')
-rw-r--r-- | drivers/net/bnx2x/bnx2x_hsi.h | 4 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_link.c | 42 |
2 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/bnx2x/bnx2x_hsi.h b/drivers/net/bnx2x/bnx2x_hsi.h index 6238d4f63989..548f5631c0dc 100644 --- a/drivers/net/bnx2x/bnx2x_hsi.h +++ b/drivers/net/bnx2x/bnx2x_hsi.h | |||
@@ -352,6 +352,10 @@ struct port_hw_cfg { /* port 0: 0x12c port 1: 0x2bc */ | |||
352 | #define PORT_HW_CFG_LANE_SWAP_CFG_31203120 0x0000d8d8 | 352 | #define PORT_HW_CFG_LANE_SWAP_CFG_31203120 0x0000d8d8 |
353 | /* forced only */ | 353 | /* forced only */ |
354 | #define PORT_HW_CFG_LANE_SWAP_CFG_32103210 0x0000e4e4 | 354 | #define PORT_HW_CFG_LANE_SWAP_CFG_32103210 0x0000e4e4 |
355 | /* Indicate whether to swap the external phy polarity */ | ||
356 | #define PORT_HW_CFG_SWAP_PHY_POLARITY_MASK 0x00010000 | ||
357 | #define PORT_HW_CFG_SWAP_PHY_POLARITY_DISABLED 0x00000000 | ||
358 | #define PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED 0x00010000 | ||
355 | 359 | ||
356 | u32 external_phy_config; | 360 | u32 external_phy_config; |
357 | #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK 0xff000000 | 361 | #define PORT_HW_CFG_SERDES_EXT_PHY_TYPE_MASK 0xff000000 |
diff --git a/drivers/net/bnx2x/bnx2x_link.c b/drivers/net/bnx2x/bnx2x_link.c index 43b0de24f391..77f9eb193cba 100644 --- a/drivers/net/bnx2x/bnx2x_link.c +++ b/drivers/net/bnx2x/bnx2x_link.c | |||
@@ -4108,6 +4108,25 @@ static u8 bnx2x_8073_config_init(struct bnx2x_phy *phy, | |||
4108 | 4108 | ||
4109 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); | 4109 | DP(NETIF_MSG_LINK, "Before rom RX_ALARM(port1): 0x%x\n", tmp1); |
4110 | 4110 | ||
4111 | /** | ||
4112 | * If this is forced speed, set to KR or KX (all other are not | ||
4113 | * supported) | ||
4114 | */ | ||
4115 | /* Swap polarity if required - Must be done only in non-1G mode */ | ||
4116 | if (params->lane_config & PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { | ||
4117 | /* Configure the 8073 to swap _P and _N of the KR lines */ | ||
4118 | DP(NETIF_MSG_LINK, "Swapping polarity for the 8073\n"); | ||
4119 | /* 10G Rx/Tx and 1G Tx signal polarity swap */ | ||
4120 | bnx2x_cl45_read(bp, phy, | ||
4121 | MDIO_PMA_DEVAD, | ||
4122 | MDIO_PMA_REG_8073_OPT_DIGITAL_CTRL, &val); | ||
4123 | bnx2x_cl45_write(bp, phy, | ||
4124 | MDIO_PMA_DEVAD, | ||
4125 | MDIO_PMA_REG_8073_OPT_DIGITAL_CTRL, | ||
4126 | (val | (3<<9))); | ||
4127 | } | ||
4128 | |||
4129 | |||
4111 | /* Enable CL37 BAM */ | 4130 | /* Enable CL37 BAM */ |
4112 | if (REG_RD(bp, params->shmem_base + | 4131 | if (REG_RD(bp, params->shmem_base + |
4113 | offsetof(struct shmem_region, dev_info. | 4132 | offsetof(struct shmem_region, dev_info. |
@@ -4314,6 +4333,29 @@ static u8 bnx2x_8073_read_status(struct bnx2x_phy *phy, | |||
4314 | } | 4333 | } |
4315 | 4334 | ||
4316 | if (link_up) { | 4335 | if (link_up) { |
4336 | /* Swap polarity if required */ | ||
4337 | if (params->lane_config & | ||
4338 | PORT_HW_CFG_SWAP_PHY_POLARITY_ENABLED) { | ||
4339 | /* Configure the 8073 to swap P and N of the KR lines */ | ||
4340 | bnx2x_cl45_read(bp, phy, | ||
4341 | MDIO_XS_DEVAD, | ||
4342 | MDIO_XS_REG_8073_RX_CTRL_PCIE, &val1); | ||
4343 | /** | ||
4344 | * Set bit 3 to invert Rx in 1G mode and clear this bit | ||
4345 | * when it`s in 10G mode. | ||
4346 | */ | ||
4347 | if (vars->line_speed == SPEED_1000) { | ||
4348 | DP(NETIF_MSG_LINK, "Swapping 1G polarity for" | ||
4349 | "the 8073\n"); | ||
4350 | val1 |= (1<<3); | ||
4351 | } else | ||
4352 | val1 &= ~(1<<3); | ||
4353 | |||
4354 | bnx2x_cl45_write(bp, phy, | ||
4355 | MDIO_XS_DEVAD, | ||
4356 | MDIO_XS_REG_8073_RX_CTRL_PCIE, | ||
4357 | val1); | ||
4358 | } | ||
4317 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); | 4359 | bnx2x_ext_phy_10G_an_resolve(bp, phy, vars); |
4318 | bnx2x_8073_resolve_fc(phy, params, vars); | 4360 | bnx2x_8073_resolve_fc(phy, params, vars); |
4319 | } | 4361 | } |