Netdev List
 help / color / mirror / Atom feed
From: Vladimir Oltean <olteanv@gmail.com>
To: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Cc: Marek Beh__n <kabel@kernel.org>, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Subject: Re: [PATCH RFC net-next 6/6] net: dsa: sja1105: support switching between SGMII and 2500BASE-X
Date: Fri, 25 Feb 2022 13:16:49 +0200	[thread overview]
Message-ID: <20220225111649.pkmq3jxo6mm4qzfv@skbuf> (raw)
In-Reply-To: <E1nNGmL-00AOjC-HP@rmk-PC.armlinux.org.uk>

On Thu, Feb 24, 2022 at 04:15:41PM +0000, Russell King (Oracle) wrote:
> Vladimir Oltean suggests that sla1105 can support switching between

s/sla1105/sja1105/

> SGMII and 2500BASE-X modes. Augment sja1105_phylink_get_caps() to
> fill in both interface modes if they can be supported.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
> ---
>  drivers/net/dsa/sja1105/sja1105_main.c | 28 +++++++++++++++++++++-----
>  1 file changed, 23 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/dsa/sja1105/sja1105_main.c b/drivers/net/dsa/sja1105/sja1105_main.c
> index 5beef06d8ff7..36001b1d7968 100644
> --- a/drivers/net/dsa/sja1105/sja1105_main.c
> +++ b/drivers/net/dsa/sja1105/sja1105_main.c
> @@ -1396,6 +1396,7 @@ static void sja1105_phylink_get_caps(struct dsa_switch *ds, int port,
>  {
>  	struct sja1105_private *priv = ds->priv;
>  	struct sja1105_xmii_params_entry *mii;
> +	phy_interface_t phy_mode;
>  
>  	/* This driver does not make use of the speed, duplex, pause or the
>  	 * advertisement in its mac_config, so it is safe to mark this driver
> @@ -1403,11 +1404,28 @@ static void sja1105_phylink_get_caps(struct dsa_switch *ds, int port,
>  	 */
>  	config->legacy_pre_march2020 = false;
>  
> -	/* The SJA1105 MAC programming model is through the static config
> -	 * (the xMII Mode table cannot be dynamically reconfigured), and
> -	 * we have to program that early.
> -	 */
> -	__set_bit(priv->phy_mode[port], config->supported_interfaces);
> +	phy_mode = priv->phy_mode[port];
> +	if (phy_mode == PHY_INTERFACE_MODE_SGMII ||
> +	    phy_mode == PHY_INTERFACE_MODE_2500BASEX) {
> +		/* Changing the PHY mode on SERDES ports is possible and makes
> +		 * sense, because that is done through the XPCS. We allow
> +		 * changes between SGMII and 2500base-X (it is unknown whether
> +		 * 1000base-X is supported).
> +		 */

It is actually known (or so I think).
Bits 2:1 (PCS_MODE) of register VR_MII_AN_CTRL (MMD 0x1f, address 0x8001)
of the XPCS, as instantiated in SJA1105R/S, says:
00: Clause 37 auto-negotiation for 1000BASE-X mode
    *Not supported*
10: Clause 37 auto-negotiation for SGMII mode

When I look at the XPCS documentation for SJA1110, it doesn't say
"Not supported", however I don't have the setup to try it.
If it's anything like the XPCS instantiation from SJA1105 though, this
is possibly a documentation glitch and I wouldn't say it was implemented
just because the documentation doesn't say it isn't.

On the other hand, disabling SGMII in-band autoneg is possible, and the
resulting mode is electrically compatible with 1000Base-X without
in-band autoneg. Interpret this as you wish.

> +		if (priv->info->supports_sgmii[port])
> +			__set_bit(PHY_INTERFACE_MODE_SGMII,
> +				  config->supported_interfaces);
> +
> +		if (priv->info->supports_2500basex[port])
> +			__set_bit(PHY_INTERFACE_MODE_2500BASEX,
> +				  config->supported_interfaces);
> +	} else {
> +		/* The SJA1105 MAC programming model is through the static
> +		 * config (the xMII Mode table cannot be dynamically
> +		 * reconfigured), and we have to program that early.
> +		 */
> +		__set_bit(phy_mode, config->supported_interfaces);
> +	}
>  
>  	/* The MAC does not support pause frames, and also doesn't
>  	 * support half-duplex traffic modes.
> -- 
> 2.30.2
> 

  reply	other threads:[~2022-02-25 11:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-24 16:14 [PATCH RFC net-next 0/6] net: dsa: sja1105: phylink updates Russell King (Oracle)
2022-02-24 16:15 ` [PATCH RFC net-next 1/6] net: dsa: sja1105: populate supported_interfaces Russell King (Oracle)
2022-02-25 10:18   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 2/6] net: dsa: sja1105: remove interface checks Russell King (Oracle)
2022-02-25 10:20   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 3/6] net: dsa: sja1105: use .mac_select_pcs() interface Russell King (Oracle)
2022-02-25 10:39   ` Vladimir Oltean
2022-02-25 10:57     ` Russell King (Oracle)
2022-02-25 11:25       ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 4/6] net: dsa: sja1105: mark as non-legacy Russell King (Oracle)
2022-02-25 10:40   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 5/6] net: dsa: sja1105: convert to phylink_generic_validate() Russell King (Oracle)
2022-02-25 10:44   ` Vladimir Oltean
2022-02-24 16:15 ` [PATCH RFC net-next 6/6] net: dsa: sja1105: support switching between SGMII and 2500BASE-X Russell King (Oracle)
2022-02-25 11:16   ` Vladimir Oltean [this message]
2022-02-25 11:23     ` Russell King (Oracle)
2022-02-25 11:27       ` 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=20220225111649.pkmq3jxo6mm4qzfv@skbuf \
    --to=olteanv@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kabel@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=rmk+kernel@armlinux.org.uk \
    --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