netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: Marcus Carlberg <marcus.carlberg@axis.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	<kernel@axis.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] net: dsa: mv88e6xxx: support RGMII cmode
Date: Fri, 19 Aug 2022 20:19:43 +0200	[thread overview]
Message-ID: <20220819201943.5f6a4d09@thinkpad> (raw)
In-Reply-To: <20220819135629.32590-1-marcus.carlberg@axis.com>

On Fri, 19 Aug 2022 15:56:29 +0200
Marcus Carlberg <marcus.carlberg@axis.com> wrote:

> Since the probe defaults all interfaces to the highest speed possible
> (10GBASE-X in mv88e6393x) before the phy mode configuration from the
> devicetree is considered it is currently impossible to use port 0 in
> RGMII mode.
> 
> This change will allow RGMII modes to be configurable for port 0
> enabling port 0 to be configured as RGMII as well as serial depending
> on configuration.
> 
> Signed-off-by: Marcus Carlberg <marcus.carlberg@axis.com>
> ---
> 
> Notes:
>     v2: add phy mode input validation for SERDES only ports
> 
>  drivers/net/dsa/mv88e6xxx/port.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/drivers/net/dsa/mv88e6xxx/port.c b/drivers/net/dsa/mv88e6xxx/port.c
> index 90c55f23b7c9..5c4195c635b0 100644
> --- a/drivers/net/dsa/mv88e6xxx/port.c
> +++ b/drivers/net/dsa/mv88e6xxx/port.c
> @@ -517,6 +517,12 @@ static int mv88e6xxx_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
>  	case PHY_INTERFACE_MODE_RMII:
>  		cmode = MV88E6XXX_PORT_STS_CMODE_RMII;
>  		break;
> +	case PHY_INTERFACE_MODE_RGMII:
> +	case PHY_INTERFACE_MODE_RGMII_ID:
> +	case PHY_INTERFACE_MODE_RGMII_RXID:
> +	case PHY_INTERFACE_MODE_RGMII_TXID:
> +		cmode = MV88E6XXX_PORT_STS_CMODE_RGMII;
> +		break;
>  	case PHY_INTERFACE_MODE_1000BASEX:
>  		cmode = MV88E6XXX_PORT_STS_CMODE_1000BASEX;
>  		break;
> @@ -634,6 +640,19 @@ int mv88e6393x_port_set_cmode(struct mv88e6xxx_chip *chip, int port,
>  	if (port != 0 && port != 9 && port != 10)
>  		return -EOPNOTSUPP;
>  
> +	if (port == 9 || port == 10) {
> +		switch (mode) {
> +		case PHY_INTERFACE_MODE_RMII:
> +		case PHY_INTERFACE_MODE_RGMII:
> +		case PHY_INTERFACE_MODE_RGMII_ID:
> +		case PHY_INTERFACE_MODE_RGMII_RXID:
> +		case PHY_INTERFACE_MODE_RGMII_TXID:
> +			return -EINVAL;
> +		default:
> +			break;
> +		}
> +	}
> +
>  	/* mv88e6393x errata 4.5: EEE should be disabled on SERDES ports */
>  	err = mv88e6xxx_port_read(chip, port, MV88E6XXX_PORT_MAC_CTL, &reg);
>  	if (err)

You also need to change
 mv88e6393x_phylink_get_caps in chip.c
to add RGMII interface types to the supported bit field if port == 0,
because the mv88e6xxx_translate_cmode() call does not fill RGMII as
supported there if cmode isn't RGMII at the beginning.

Also this should have Fixes tag?

Marek

      parent reply	other threads:[~2022-08-19 18:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-19 13:56 [PATCH v2] net: dsa: mv88e6xxx: support RGMII cmode Marcus Carlberg
2022-08-19 17:39 ` Andrew Lunn
2022-08-19 18:19 ` Marek Behún [this message]

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=20220819201943.5f6a4d09@thinkpad \
    --to=kabel@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=f.fainelli@gmail.com \
    --cc=kernel@axis.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcus.carlberg@axis.com \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=pabeni@redhat.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).