From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Vladimir Oltean <olteanv@gmail.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, andrew@lunn.ch,
f.fainelli@gmail.com, vivien.didelot@gmail.com
Subject: Re: [PATCH net-next] net: dsa: sja1105: Add support for the SGMII port
Date: Fri, 20 Mar 2020 00:06:22 +0000 [thread overview]
Message-ID: <20200320000622.GI25745@shell.armlinux.org.uk> (raw)
In-Reply-To: <20200319235313.26579-1-olteanv@gmail.com>
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
next prev parent reply other threads:[~2020-03-20 0:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-19 23:53 [PATCH net-next] net: dsa: sja1105: Add support for the SGMII port Vladimir Oltean
2020-03-20 0:06 ` Russell King - ARM Linux admin [this message]
2020-03-20 0:38 ` Vladimir Oltean
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200320000622.GI25745@shell.armlinux.org.uk \
--to=linux@armlinux.org.uk \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).