diff options
| author | Florian Fainelli <f.fainelli@gmail.com> | 2014-12-11 21:12:42 -0500 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2014-12-11 21:17:13 -0500 |
| commit | 7855f675e6cbccb565c41dfeef708b8d7e6444ff (patch) | |
| tree | 494ca00b12107cbd311b98369c929e8e9d7a8a0d | |
| parent | 697766df6b952f09b17eefda8b5ef746acb9c1eb (diff) | |
net: dsa: bcm_sf2: force link for all fixed PHY devices
For ports of the switch that we define as "fixed PHYs" such as MoCA, we
would have our Port 7 special handling that would allow us to assert the
link status indication.
For other ports, such as e.g: RGMII_1 connected to a cable modem, we
would rely on whatever the bootloader has left configured, which is a
bad assumption to make, we really need to force the link status
indication here.
Fixes: 246d7f773c13 ("net: dsa: add Broadcom SF2 switch driver")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| -rw-r--r-- | drivers/net/dsa/bcm_sf2.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index 4f4c2a7888e5..feb29c4526f7 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c | |||
| @@ -684,10 +684,9 @@ static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, | |||
| 684 | struct fixed_phy_status *status) | 684 | struct fixed_phy_status *status) |
| 685 | { | 685 | { |
| 686 | struct bcm_sf2_priv *priv = ds_to_priv(ds); | 686 | struct bcm_sf2_priv *priv = ds_to_priv(ds); |
| 687 | u32 link, duplex, pause, speed; | 687 | u32 duplex, pause, speed; |
| 688 | u32 reg; | 688 | u32 reg; |
| 689 | 689 | ||
| 690 | link = core_readl(priv, CORE_LNKSTS); | ||
| 691 | duplex = core_readl(priv, CORE_DUPSTS); | 690 | duplex = core_readl(priv, CORE_DUPSTS); |
| 692 | pause = core_readl(priv, CORE_PAUSESTS); | 691 | pause = core_readl(priv, CORE_PAUSESTS); |
| 693 | speed = core_readl(priv, CORE_SPDSTS); | 692 | speed = core_readl(priv, CORE_SPDSTS); |
| @@ -701,22 +700,26 @@ static void bcm_sf2_sw_fixed_link_update(struct dsa_switch *ds, int port, | |||
| 701 | * which means that we need to force the link at the port override | 700 | * which means that we need to force the link at the port override |
| 702 | * level to get the data to flow. We do use what the interrupt handler | 701 | * level to get the data to flow. We do use what the interrupt handler |
| 703 | * did determine before. | 702 | * did determine before. |
| 703 | * | ||
| 704 | * For the other ports, we just force the link status, since this is | ||
| 705 | * a fixed PHY device. | ||
| 704 | */ | 706 | */ |
| 705 | if (port == 7) { | 707 | if (port == 7) { |
| 706 | status->link = priv->port_sts[port].link; | 708 | status->link = priv->port_sts[port].link; |
| 707 | reg = core_readl(priv, CORE_STS_OVERRIDE_GMIIP_PORT(7)); | ||
| 708 | reg |= SW_OVERRIDE; | ||
| 709 | if (status->link) | ||
| 710 | reg |= LINK_STS; | ||
| 711 | else | ||
| 712 | reg &= ~LINK_STS; | ||
| 713 | core_writel(priv, reg, CORE_STS_OVERRIDE_GMIIP_PORT(7)); | ||
| 714 | status->duplex = 1; | 709 | status->duplex = 1; |
| 715 | } else { | 710 | } else { |
| 716 | status->link = !!(link & (1 << port)); | 711 | status->link = 1; |
| 717 | status->duplex = !!(duplex & (1 << port)); | 712 | status->duplex = !!(duplex & (1 << port)); |
| 718 | } | 713 | } |
| 719 | 714 | ||
| 715 | reg = core_readl(priv, CORE_STS_OVERRIDE_GMIIP_PORT(port)); | ||
| 716 | reg |= SW_OVERRIDE; | ||
| 717 | if (status->link) | ||
| 718 | reg |= LINK_STS; | ||
| 719 | else | ||
| 720 | reg &= ~LINK_STS; | ||
| 721 | core_writel(priv, reg, CORE_STS_OVERRIDE_GMIIP_PORT(port)); | ||
| 722 | |||
| 720 | switch (speed) { | 723 | switch (speed) { |
| 721 | case SPDSTS_10: | 724 | case SPDSTS_10: |
| 722 | status->speed = SPEED_10; | 725 | status->speed = SPEED_10; |
