mirror of https://gitee.com/openkylin/linux.git
bcm63xx_enet: check 1000BASE-T advertisement configuration
If a gigabit ethernet PHY is connected to a fast ethernet MAC, then it can detect 1000 support from the partner but not use it. This results in a forced speed of 1000 and RX/TX failure. Check for 1000BASE-T support and then check the advertisement configuration before setting the MAC speed to 1000mbit. Signed-off-by: Simon Arlott <simon@fire.lp0.eu> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
1099f86044
commit
aebd99477f
|
@ -2049,7 +2049,7 @@ static void swphy_poll_timer(unsigned long data)
|
||||||
|
|
||||||
for (i = 0; i < priv->num_ports; i++) {
|
for (i = 0; i < priv->num_ports; i++) {
|
||||||
struct bcm63xx_enetsw_port *port;
|
struct bcm63xx_enetsw_port *port;
|
||||||
int val, j, up, advertise, lpa, lpa2, speed, duplex, media;
|
int val, j, up, advertise, lpa, speed, duplex, media;
|
||||||
int external_phy = bcm_enet_port_is_rgmii(i);
|
int external_phy = bcm_enet_port_is_rgmii(i);
|
||||||
u8 override;
|
u8 override;
|
||||||
|
|
||||||
|
@ -2092,22 +2092,27 @@ static void swphy_poll_timer(unsigned long data)
|
||||||
lpa = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id,
|
lpa = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id,
|
||||||
MII_LPA);
|
MII_LPA);
|
||||||
|
|
||||||
lpa2 = bcmenet_sw_mdio_read(priv, external_phy, port->phy_id,
|
|
||||||
MII_STAT1000);
|
|
||||||
|
|
||||||
/* figure out media and duplex from advertise and LPA values */
|
/* figure out media and duplex from advertise and LPA values */
|
||||||
media = mii_nway_result(lpa & advertise);
|
media = mii_nway_result(lpa & advertise);
|
||||||
duplex = (media & ADVERTISE_FULL) ? 1 : 0;
|
duplex = (media & ADVERTISE_FULL) ? 1 : 0;
|
||||||
if (lpa2 & LPA_1000FULL)
|
|
||||||
duplex = 1;
|
|
||||||
|
|
||||||
if (lpa2 & (LPA_1000FULL | LPA_1000HALF))
|
if (media & (ADVERTISE_100FULL | ADVERTISE_100HALF))
|
||||||
speed = 1000;
|
speed = 100;
|
||||||
else {
|
else
|
||||||
if (media & (ADVERTISE_100FULL | ADVERTISE_100HALF))
|
speed = 10;
|
||||||
speed = 100;
|
|
||||||
else
|
if (val & BMSR_ESTATEN) {
|
||||||
speed = 10;
|
advertise = bcmenet_sw_mdio_read(priv, external_phy,
|
||||||
|
port->phy_id, MII_CTRL1000);
|
||||||
|
|
||||||
|
lpa = bcmenet_sw_mdio_read(priv, external_phy,
|
||||||
|
port->phy_id, MII_STAT1000);
|
||||||
|
|
||||||
|
if (advertise & (ADVERTISE_1000FULL | ADVERTISE_1000HALF)
|
||||||
|
&& lpa & (LPA_1000FULL | LPA_1000HALF)) {
|
||||||
|
speed = 1000;
|
||||||
|
duplex = (lpa & LPA_1000FULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_info(&priv->pdev->dev,
|
dev_info(&priv->pdev->dev,
|
||||||
|
|
Loading…
Reference in New Issue