All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next PATCH] net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled
@ 2021-11-02 17:56 Ansuel Smith
  2021-11-02 18:26 ` Vladimir Oltean
  0 siblings, 1 reply; 4+ messages in thread
From: Ansuel Smith @ 2021-11-02 17:56 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
	David S. Miller, Jakub Kicinski, netdev, linux-kernel
  Cc: Ansuel Smith

Some device set MAC06 exchange in the bootloader. This cause some
problem as we don't support this strange mode and we just set the port6
as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6
instead of port0. Add an extra check and explicitly disable MAC06 exchange
to correctly configure the port PAD config.

Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
---
 drivers/net/dsa/qca8k.c | 8 ++++++++
 drivers/net/dsa/qca8k.h | 1 +
 2 files changed, 9 insertions(+)

Some comments here:
Resetting the switch using the sw reg doesn't reset the port PAD
configuration. I was thinking if it would be better to clear all the
pad configuration but considering that the entire reg is set by phylink
mac config, I think it's not necessary as the PAD related to the port will
be reset anyway with the new values. Have a dirty configuration on PAD6
doesn't cause any problem as we have that port disabled and it would be
reset and configured anyway if defined.

diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
index ea7f12778922..a429c9750add 100644
--- a/drivers/net/dsa/qca8k.c
+++ b/drivers/net/dsa/qca8k.c
@@ -1109,6 +1109,14 @@ qca8k_setup(struct dsa_switch *ds)
 	if (ret)
 		return ret;
 
+	/* Make sure MAC06 is disabled */
+	ret = qca8k_reg_clear(priv, QCA8K_REG_PORT0_PAD_CTRL,
+			      QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN);
+	if (ret) {
+		dev_err(priv->dev, "failed disabling MAC06 exchange");
+		return ret;
+	}
+
 	/* Enable CPU Port */
 	ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0,
 			    QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN);
diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
index e10571a398c9..128b8cf85e08 100644
--- a/drivers/net/dsa/qca8k.h
+++ b/drivers/net/dsa/qca8k.h
@@ -34,6 +34,7 @@
 #define   QCA8K_MASK_CTRL_DEVICE_ID_MASK		GENMASK(15, 8)
 #define   QCA8K_MASK_CTRL_DEVICE_ID(x)			((x) >> 8)
 #define QCA8K_REG_PORT0_PAD_CTRL			0x004
+#define   QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN		BIT(31)
 #define   QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE	BIT(19)
 #define   QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE	BIT(18)
 #define QCA8K_REG_PORT5_PAD_CTRL			0x008
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [net-next PATCH] net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled
  2021-11-02 17:56 [net-next PATCH] net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled Ansuel Smith
@ 2021-11-02 18:26 ` Vladimir Oltean
  2021-11-02 18:28   ` Ansuel Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Vladimir Oltean @ 2021-11-02 18:26 UTC (permalink / raw)
  To: Ansuel Smith
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel

On Tue, Nov 02, 2021 at 06:56:29PM +0100, Ansuel Smith wrote:
> Some device set MAC06 exchange in the bootloader. This cause some
> problem as we don't support this strange mode and we just set the port6
> as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6
> instead of port0. Add an extra check and explicitly disable MAC06 exchange
> to correctly configure the port PAD config.
> 
> Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> ---

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>

Since net-next has closed, please add

Fixes: 3fcf734aa482 ("net: dsa: qca8k: add support for cpu port 6")

and resend to the "net" tree.

>  drivers/net/dsa/qca8k.c | 8 ++++++++
>  drivers/net/dsa/qca8k.h | 1 +
>  2 files changed, 9 insertions(+)
> 
> Some comments here:
> Resetting the switch using the sw reg doesn't reset the port PAD
> configuration. I was thinking if it would be better to clear all the
> pad configuration but considering that the entire reg is set by phylink
> mac config, I think it's not necessary as the PAD related to the port will
> be reset anyway with the new values. Have a dirty configuration on PAD6
> doesn't cause any problem as we have that port disabled and it would be
> reset and configured anyway if defined.
> 
> diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
> index ea7f12778922..a429c9750add 100644
> --- a/drivers/net/dsa/qca8k.c
> +++ b/drivers/net/dsa/qca8k.c
> @@ -1109,6 +1109,14 @@ qca8k_setup(struct dsa_switch *ds)
>  	if (ret)
>  		return ret;
>  
> +	/* Make sure MAC06 is disabled */
> +	ret = qca8k_reg_clear(priv, QCA8K_REG_PORT0_PAD_CTRL,
> +			      QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN);
> +	if (ret) {
> +		dev_err(priv->dev, "failed disabling MAC06 exchange");
> +		return ret;
> +	}
> +
>  	/* Enable CPU Port */
>  	ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0,
>  			    QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN);
> diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
> index e10571a398c9..128b8cf85e08 100644
> --- a/drivers/net/dsa/qca8k.h
> +++ b/drivers/net/dsa/qca8k.h
> @@ -34,6 +34,7 @@
>  #define   QCA8K_MASK_CTRL_DEVICE_ID_MASK		GENMASK(15, 8)
>  #define   QCA8K_MASK_CTRL_DEVICE_ID(x)			((x) >> 8)
>  #define QCA8K_REG_PORT0_PAD_CTRL			0x004
> +#define   QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN		BIT(31)
>  #define   QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE	BIT(19)
>  #define   QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE	BIT(18)
>  #define QCA8K_REG_PORT5_PAD_CTRL			0x008
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [net-next PATCH] net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled
  2021-11-02 18:26 ` Vladimir Oltean
@ 2021-11-02 18:28   ` Ansuel Smith
  2021-11-02 18:38     ` Vladimir Oltean
  0 siblings, 1 reply; 4+ messages in thread
From: Ansuel Smith @ 2021-11-02 18:28 UTC (permalink / raw)
  To: Vladimir Oltean
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel

On Tue, Nov 02, 2021 at 08:26:55PM +0200, Vladimir Oltean wrote:
> On Tue, Nov 02, 2021 at 06:56:29PM +0100, Ansuel Smith wrote:
> > Some device set MAC06 exchange in the bootloader. This cause some
> > problem as we don't support this strange mode and we just set the port6
> > as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6
> > instead of port0. Add an extra check and explicitly disable MAC06 exchange
> > to correctly configure the port PAD config.
> > 
> > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> > ---
> 
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
> 
> Since net-next has closed, please add
> 
> Fixes: 3fcf734aa482 ("net: dsa: qca8k: add support for cpu port 6")
> 
> and resend to the "net" tree.
>

Oh sorry! I checked http://vger.kernel.org/~davem/net-next.html
before posting and it does say it's open. Will resend sorry.

> >  drivers/net/dsa/qca8k.c | 8 ++++++++
> >  drivers/net/dsa/qca8k.h | 1 +
> >  2 files changed, 9 insertions(+)
> > 
> > Some comments here:
> > Resetting the switch using the sw reg doesn't reset the port PAD
> > configuration. I was thinking if it would be better to clear all the
> > pad configuration but considering that the entire reg is set by phylink
> > mac config, I think it's not necessary as the PAD related to the port will
> > be reset anyway with the new values. Have a dirty configuration on PAD6
> > doesn't cause any problem as we have that port disabled and it would be
> > reset and configured anyway if defined.
> > 
> > diff --git a/drivers/net/dsa/qca8k.c b/drivers/net/dsa/qca8k.c
> > index ea7f12778922..a429c9750add 100644
> > --- a/drivers/net/dsa/qca8k.c
> > +++ b/drivers/net/dsa/qca8k.c
> > @@ -1109,6 +1109,14 @@ qca8k_setup(struct dsa_switch *ds)
> >  	if (ret)
> >  		return ret;
> >  
> > +	/* Make sure MAC06 is disabled */
> > +	ret = qca8k_reg_clear(priv, QCA8K_REG_PORT0_PAD_CTRL,
> > +			      QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN);
> > +	if (ret) {
> > +		dev_err(priv->dev, "failed disabling MAC06 exchange");
> > +		return ret;
> > +	}
> > +
> >  	/* Enable CPU Port */
> >  	ret = qca8k_reg_set(priv, QCA8K_REG_GLOBAL_FW_CTRL0,
> >  			    QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN);
> > diff --git a/drivers/net/dsa/qca8k.h b/drivers/net/dsa/qca8k.h
> > index e10571a398c9..128b8cf85e08 100644
> > --- a/drivers/net/dsa/qca8k.h
> > +++ b/drivers/net/dsa/qca8k.h
> > @@ -34,6 +34,7 @@
> >  #define   QCA8K_MASK_CTRL_DEVICE_ID_MASK		GENMASK(15, 8)
> >  #define   QCA8K_MASK_CTRL_DEVICE_ID(x)			((x) >> 8)
> >  #define QCA8K_REG_PORT0_PAD_CTRL			0x004
> > +#define   QCA8K_PORT0_PAD_MAC06_EXCHANGE_EN		BIT(31)
> >  #define   QCA8K_PORT0_PAD_SGMII_RXCLK_FALLING_EDGE	BIT(19)
> >  #define   QCA8K_PORT0_PAD_SGMII_TXCLK_FALLING_EDGE	BIT(18)
> >  #define QCA8K_REG_PORT5_PAD_CTRL			0x008
> > -- 
> > 2.32.0
> > 

-- 
	Ansuel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [net-next PATCH] net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled
  2021-11-02 18:28   ` Ansuel Smith
@ 2021-11-02 18:38     ` Vladimir Oltean
  0 siblings, 0 replies; 4+ messages in thread
From: Vladimir Oltean @ 2021-11-02 18:38 UTC (permalink / raw)
  To: Ansuel Smith
  Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
	Jakub Kicinski, netdev, linux-kernel

On Tue, Nov 02, 2021 at 07:28:50PM +0100, Ansuel Smith wrote:
> On Tue, Nov 02, 2021 at 08:26:55PM +0200, Vladimir Oltean wrote:
> > On Tue, Nov 02, 2021 at 06:56:29PM +0100, Ansuel Smith wrote:
> > > Some device set MAC06 exchange in the bootloader. This cause some
> > > problem as we don't support this strange mode and we just set the port6
> > > as the primary CPU port. With MAC06 exchange, PAD0 reg configure port6
> > > instead of port0. Add an extra check and explicitly disable MAC06 exchange
> > > to correctly configure the port PAD config.
> > > 
> > > Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
> > > ---
> > 
> > Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
> > 
> > Since net-next has closed, please add
> > 
> > Fixes: 3fcf734aa482 ("net: dsa: qca8k: add support for cpu port 6")
> > 
> > and resend to the "net" tree.
> >
> 
> Oh sorry! I checked http://vger.kernel.org/~davem/net-next.html
> before posting and it does say it's open. Will resend sorry.

Closed or not, the point is that Jakub sent the "[GIT PULL] Networking for 5.16"
email today, so this code is no longer in net-next only.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-02 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-02 17:56 [net-next PATCH] net: dsa: qca8k: make sure PAD0 MAC06 exchange is disabled Ansuel Smith
2021-11-02 18:26 ` Vladimir Oltean
2021-11-02 18:28   ` Ansuel Smith
2021-11-02 18:38     ` Vladimir Oltean

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.