[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200320000622.GI25745@shell.armlinux.org.uk>
Date: Fri, 20 Mar 2020 00:06:22 +0000
From: Russell King - ARM Linux admin <linux@...linux.org.uk>
To: Vladimir Oltean <olteanv@...il.com>
Cc: davem@...emloft.net, netdev@...r.kernel.org, andrew@...n.ch,
f.fainelli@...il.com, vivien.didelot@...il.com
Subject: Re: [PATCH net-next] net: dsa: sja1105: Add support for the SGMII
port
On Fri, Mar 20, 2020 at 01:53:13AM +0200, Vladimir Oltean wrote:
> @@ -774,10 +881,14 @@ static void sja1105_mac_config(struct dsa_switch *ds, int port,
> return;
> }
>
> - if (link_an_mode == MLO_AN_INBAND) {
> + if (link_an_mode == MLO_AN_INBAND && !is_sgmii) {
> dev_err(ds->dev, "In-band AN not supported!\n");
> return;
> }
> +
> + if (is_sgmii)
> + sja1105_sgmii_config(priv, port, link_an_mode == MLO_AN_INBAND,
> + state->speed);
Please avoid new usages of state->speed in mac_config() - I'm trying
to eliminate them now that the mac_link_up() patches are in. If you
need to set the PCS for the link speed, please hook that into
mac_link_up() instead.
> }
>
> static void sja1105_mac_link_down(struct dsa_switch *ds, int port,
> @@ -833,7 +944,8 @@ static void sja1105_phylink_validate(struct dsa_switch *ds, int port,
> phylink_set(mask, 10baseT_Full);
> phylink_set(mask, 100baseT_Full);
> phylink_set(mask, 100baseT1_Full);
> - if (mii->xmii_mode[port] == XMII_MODE_RGMII)
> + if (mii->xmii_mode[port] == XMII_MODE_RGMII ||
> + mii->xmii_mode[port] == XMII_MODE_SGMII)
> phylink_set(mask, 1000baseT_Full);
>
> bitmap_and(supported, supported, mask, __ETHTOOL_LINK_MODE_MASK_NBITS);
> @@ -841,6 +953,82 @@ static void sja1105_phylink_validate(struct dsa_switch *ds, int port,
> __ETHTOOL_LINK_MODE_MASK_NBITS);
> }
>
> +static int sja1105_mac_pcs_get_state(struct dsa_switch *ds, int port,
> + struct phylink_link_state *state)
> +{
> + struct sja1105_private *priv = ds->priv;
> + int bmcr;
> +
> + bmcr = sja1105_sgmii_read(priv, MII_BMCR);
> + if (bmcr < 0)
> + return bmcr;
> +
> + state->an_enabled = !!(bmcr & BMCR_ANENABLE);
> +
> + if (state->an_enabled) {
mac_pcs_get_state() is only called when in in-band AN mode, so this
is not useful. If it's called with AN disabled, that's a bug.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 10.2Mbps down 587kbps up
Powered by blists - more mailing lists