Commit ac4d9449 authored by Yaniv Rosner's avatar Yaniv Rosner Committed by David S. Miller

bnx2x: Change BCM848xx configuration according to IEEE

Change BCM848xx behavior to fit IEEE such that setting 10Mb/100Mb will
use force speed, and setting 1Gb/10Gb will use auto-negotiation with the
specific speed advertised
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 54c2fb78
...@@ -4354,197 +4354,159 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars) ...@@ -4354,197 +4354,159 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
} }
case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481: case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823: case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM84823:
{
/* This phy uses the NIG latch mechanism since link /* This phy uses the NIG latch mechanism since link
indication arrives through its LED4 and not via indication arrives through its LED4 and not via
its LASI signal, so we get steady signal its LASI signal, so we get steady signal
instead of clear on read */ instead of clear on read */
u16 autoneg_val, an_1000_val, an_10_100_val;
bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4, bnx2x_bits_en(bp, NIG_REG_LATCH_BC_0 + params->port*4,
1 << NIG_LATCH_BC_ENABLE_MI_INT); 1 << NIG_LATCH_BC_ENABLE_MI_INT);
bnx2x_cl45_write(bp, params->port, bnx2x_cl45_write(bp, params->port,
PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481, ext_phy_type,
ext_phy_addr, ext_phy_addr,
MDIO_PMA_DEVAD, MDIO_PMA_DEVAD,
MDIO_PMA_REG_CTRL, 0x0000); MDIO_PMA_REG_CTRL, 0x0000);
bnx2x_8481_set_led4(params, ext_phy_type, ext_phy_addr); bnx2x_8481_set_led4(params, ext_phy_type, ext_phy_addr);
if (params->req_line_speed == SPEED_AUTO_NEG) {
u16 autoneg_val, an_1000_val, an_10_100_val; bnx2x_cl45_read(bp, params->port,
/* set 1000 speed advertisement */ ext_phy_type,
bnx2x_cl45_read(bp, params->port, ext_phy_addr,
ext_phy_type, MDIO_AN_DEVAD,
ext_phy_addr, MDIO_AN_REG_8481_1000T_CTRL,
MDIO_AN_DEVAD, &an_1000_val);
MDIO_AN_REG_8481_1000T_CTRL, bnx2x_ext_phy_set_pause(params, vars);
&an_1000_val); bnx2x_cl45_read(bp, params->port, ext_phy_type,
ext_phy_addr, MDIO_AN_DEVAD,
if (params->speed_cap_mask & MDIO_AN_REG_8481_LEGACY_AN_ADV,
PORT_HW_CFG_SPEED_CAPABILITY_D0_1G) { &an_10_100_val);
an_1000_val |= (1<<8); bnx2x_cl45_read(bp, params->port, ext_phy_type,
if (params->req_duplex == DUPLEX_FULL) ext_phy_addr, MDIO_AN_DEVAD,
an_1000_val |= (1<<9); MDIO_AN_REG_8481_LEGACY_MII_CTRL,
DP(NETIF_MSG_LINK, "Advertising 1G\n"); &autoneg_val);
} else /* Disable forced speed */
an_1000_val &= ~((1<<8) | (1<<9)); autoneg_val &= ~((1<<6) | (1<<8) | (1<<9) | (1<<12) |
(1<<13));
bnx2x_cl45_write(bp, params->port, an_10_100_val &= ~((1<<5) | (1<<6) | (1<<7) | (1<<8));
ext_phy_type,
ext_phy_addr, if (((params->req_line_speed == SPEED_AUTO_NEG) &&
MDIO_AN_DEVAD, (params->speed_cap_mask &
MDIO_AN_REG_8481_1000T_CTRL, PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) ||
an_1000_val); (params->req_line_speed == SPEED_1000)) {
an_1000_val |= (1<<8);
/* set 100 speed advertisement */ autoneg_val |= (1<<9 | 1<<12);
bnx2x_cl45_read(bp, params->port, if (params->req_duplex == DUPLEX_FULL)
ext_phy_type, an_1000_val |= (1<<9);
ext_phy_addr, DP(NETIF_MSG_LINK, "Advertising 1G\n");
MDIO_AN_DEVAD, } else
MDIO_AN_REG_8481_LEGACY_AN_ADV, an_1000_val &= ~((1<<8) | (1<<9));
&an_10_100_val);
if (params->speed_cap_mask &
(PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL |
PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF)) {
an_10_100_val |= (1<<7);
if (params->req_duplex == DUPLEX_FULL)
an_10_100_val |= (1<<8);
DP(NETIF_MSG_LINK,
"Advertising 100M\n");
} else
an_10_100_val &= ~((1<<7) | (1<<8));
/* set 10 speed advertisement */
if (params->speed_cap_mask &
(PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL |
PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF)) {
an_10_100_val |= (1<<5);
if (params->req_duplex == DUPLEX_FULL)
an_10_100_val |= (1<<6);
DP(NETIF_MSG_LINK, "Advertising 10M\n");
}
else
an_10_100_val &= ~((1<<5) | (1<<6));
bnx2x_cl45_write(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_AN_DEVAD,
MDIO_AN_REG_8481_LEGACY_AN_ADV,
an_10_100_val);
bnx2x_cl45_read(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_AN_DEVAD,
MDIO_AN_REG_8481_LEGACY_MII_CTRL,
&autoneg_val);
/* Disable forced speed */
autoneg_val &= ~(1<<6|1<<13);
/* Enable autoneg and restart autoneg bnx2x_cl45_write(bp, params->port,
for legacy speeds */ ext_phy_type,
autoneg_val |= (1<<9|1<<12); ext_phy_addr,
MDIO_AN_DEVAD,
MDIO_AN_REG_8481_1000T_CTRL,
an_1000_val);
/* set 10 speed advertisement */
if (((params->req_line_speed == SPEED_AUTO_NEG) &&
(params->speed_cap_mask &
(PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_FULL |
PORT_HW_CFG_SPEED_CAPABILITY_D0_100M_HALF)))) {
an_10_100_val |= (1<<7);
/*
* Enable autoneg and restart autoneg for
* legacy speeds
*/
autoneg_val |= (1<<9 | 1<<12);
if (params->req_duplex == DUPLEX_FULL) if (params->req_duplex == DUPLEX_FULL)
autoneg_val |= (1<<8); an_10_100_val |= (1<<8);
else DP(NETIF_MSG_LINK, "Advertising 100M\n");
autoneg_val &= ~(1<<8); }
/* set 10 speed advertisement */
if (((params->req_line_speed == SPEED_AUTO_NEG) &&
(params->speed_cap_mask &
(PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_FULL |
PORT_HW_CFG_SPEED_CAPABILITY_D0_10M_HALF)))) {
an_10_100_val |= (1<<5);
autoneg_val |= (1<<9 | 1<<12);
if (params->req_duplex == DUPLEX_FULL)
an_10_100_val |= (1<<6);
DP(NETIF_MSG_LINK, "Advertising 10M\n");
}
/* Only 10/100 are allowed to work in FORCE mode */
if (params->req_line_speed == SPEED_100) {
autoneg_val |= (1<<13);
/* Enabled AUTO-MDIX when autoneg is disabled */
bnx2x_cl45_write(bp, params->port, bnx2x_cl45_write(bp, params->port,
ext_phy_type, ext_phy_type,
ext_phy_addr, ext_phy_addr,
MDIO_AN_DEVAD, MDIO_AN_DEVAD,
MDIO_AN_REG_8481_LEGACY_MII_CTRL, MDIO_AN_REG_8481_AUX_CTRL,
autoneg_val); (1<<15 | 1<<9 | 7<<0));
DP(NETIF_MSG_LINK, "Setting 100M force\n");
if (params->speed_cap_mask & }
PORT_HW_CFG_SPEED_CAPABILITY_D0_10G) { if (params->req_line_speed == SPEED_10) {
DP(NETIF_MSG_LINK, "Advertising 10G\n"); /* Enabled AUTO-MDIX when autoneg is disabled */
/* Restart autoneg for 10G*/ bnx2x_cl45_write(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_AN_DEVAD,
MDIO_AN_REG_8481_AUX_CTRL,
(1<<15 | 1<<9 | 7<<0));
DP(NETIF_MSG_LINK, "Setting 10M force\n");
}
bnx2x_cl45_write(bp, params->port, bnx2x_cl45_write(bp, params->port,
ext_phy_type, ext_phy_type,
ext_phy_addr, ext_phy_addr,
MDIO_AN_DEVAD, MDIO_AN_DEVAD,
MDIO_AN_REG_CTRL, 0x3200); MDIO_AN_REG_8481_LEGACY_AN_ADV,
} an_10_100_val);
} else {
/* Force speed */
u16 autoneg_ctrl, pma_ctrl;
bnx2x_cl45_read(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_AN_DEVAD,
MDIO_AN_REG_8481_LEGACY_MII_CTRL,
&autoneg_ctrl);
/* Disable autoneg */ if (params->req_duplex == DUPLEX_FULL)
autoneg_ctrl &= ~(1<<12); autoneg_val |= (1<<8);
/* Set 1000 force */ bnx2x_cl45_write(bp, params->port,
switch (params->req_line_speed) { ext_phy_type,
case SPEED_10000: ext_phy_addr,
DP(NETIF_MSG_LINK, MDIO_AN_DEVAD,
"Unable to set 10G force !\n"); MDIO_AN_REG_8481_LEGACY_MII_CTRL,
break; autoneg_val);
case SPEED_1000:
bnx2x_cl45_read(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_PMA_DEVAD,
MDIO_PMA_REG_CTRL,
&pma_ctrl);
autoneg_ctrl &= ~(1<<13);
autoneg_ctrl |= (1<<6);
pma_ctrl &= ~(1<<13);
pma_ctrl |= (1<<6);
DP(NETIF_MSG_LINK,
"Setting 1000M force\n");
bnx2x_cl45_write(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_PMA_DEVAD,
MDIO_PMA_REG_CTRL,
pma_ctrl);
break;
case SPEED_100:
autoneg_ctrl |= (1<<13);
autoneg_ctrl &= ~(1<<6);
DP(NETIF_MSG_LINK,
"Setting 100M force\n");
break;
case SPEED_10:
autoneg_ctrl &= ~(1<<13);
autoneg_ctrl &= ~(1<<6);
DP(NETIF_MSG_LINK,
"Setting 10M force\n");
break;
}
/* Duplex mode */ if (((params->req_line_speed == SPEED_AUTO_NEG) &&
if (params->req_duplex == DUPLEX_FULL) { (params->speed_cap_mask &
autoneg_ctrl |= (1<<8); PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) ||
DP(NETIF_MSG_LINK, (params->req_line_speed == SPEED_10000)) {
"Setting full duplex\n"); DP(NETIF_MSG_LINK, "Advertising 10G\n");
} else /* Restart autoneg for 10G*/
autoneg_ctrl &= ~(1<<8);
/* Update autoneg ctrl and pma ctrl */
bnx2x_cl45_write(bp, params->port, bnx2x_cl45_write(bp, params->port,
ext_phy_type, ext_phy_type,
ext_phy_addr, ext_phy_addr,
MDIO_AN_DEVAD, MDIO_AN_DEVAD,
MDIO_AN_REG_8481_LEGACY_MII_CTRL, MDIO_AN_REG_CTRL,
autoneg_ctrl); 0x3200);
}
} else if (params->req_line_speed != SPEED_10 &&
params->req_line_speed != SPEED_100)
bnx2x_cl45_write(bp, params->port,
ext_phy_type,
ext_phy_addr,
MDIO_AN_DEVAD,
MDIO_AN_REG_8481_10GBASE_T_AN_CTRL,
1);
/* Save spirom version */ /* Save spirom version */
bnx2x_save_8481_spirom_version(bp, params->port, bnx2x_save_8481_spirom_version(bp, params->port,
ext_phy_addr, ext_phy_addr,
params->shmem_base); params->shmem_base);
break; break;
}
case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE: case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE:
DP(NETIF_MSG_LINK, DP(NETIF_MSG_LINK,
"XGXS PHY Failure detected 0x%x\n", "XGXS PHY Failure detected 0x%x\n",
......
...@@ -5212,12 +5212,13 @@ Theotherbitsarereservedandshouldbezero*/ ...@@ -5212,12 +5212,13 @@ Theotherbitsarereservedandshouldbezero*/
#define MDIO_AN_REG_8073_2_5G 0x8329 #define MDIO_AN_REG_8073_2_5G 0x8329
#define MDIO_AN_REG_8727_MISC_CTRL 0x8309 #define MDIO_AN_REG_8727_MISC_CTRL 0x8309
#define MDIO_AN_REG_8481_10GBASE_T_AN_CTRL 0x0020
#define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0 #define MDIO_AN_REG_8481_LEGACY_MII_CTRL 0xffe0
#define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4 #define MDIO_AN_REG_8481_LEGACY_AN_ADV 0xffe4
#define MDIO_AN_REG_8481_1000T_CTRL 0xffe9 #define MDIO_AN_REG_8481_1000T_CTRL 0xffe9
#define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5 #define MDIO_AN_REG_8481_EXPANSION_REG_RD_RW 0xfff5
#define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7 #define MDIO_AN_REG_8481_EXPANSION_REG_ACCESS 0xfff7
#define MDIO_AN_REG_8481_AUX_CTRL 0xfff8
#define MDIO_AN_REG_8481_LEGACY_SHADOW 0xfffc #define MDIO_AN_REG_8481_LEGACY_SHADOW 0xfffc
#define IGU_FUNC_BASE 0x0400 #define IGU_FUNC_BASE 0x0400
......
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