netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries
@ 2025-02-06 12:22 Thorsten Scherer
  2025-02-08  1:00 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Scherer @ 2025-02-06 12:22 UTC (permalink / raw)
  To: netdev
  Cc: Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Rasmus Villemoes, kernel, t.scherer

Even though there is no errata for the KSZ8563 the device shows the same
error as the one fixed in commit 5af53577c64f ("net: dsa: microchip:
KSZ9896 register regmap alignment to 32 bit boundaries").

ksz-switch spi1.0: can't rmw 32bit reg 0x113c: -EIO
ksz-switch spi1.0: can't rmw 32bit reg 0x1134: -EIO
ksz-switch spi1.0 lan0 (uninitialized): failed to connect to PHY: -EIO
ksz-switch spi1.0 lan0 (uninitialized): error -5 setting up PHY for tree 0, switch 0, port 0
ksz-switch spi1.0: can't rmw 32bit reg 0x213c: -EIO
ksz-switch spi1.0: can't rmw 32bit reg 0x2134: -EIO
ksz-switch spi1.0 lan1 (uninitialized): failed to connect to PHY: -EIO
ksz-switch spi1.0 lan1 (uninitialized): error -5 setting up PHY for tree 0, switch 0, port 1

So apply the same changes to the ksz8563_valid_regs struct to fix this
issue.

Fixes: 5c844d57aa78 ("net: dsa: microchip: fix writes to phy registers >= 0x10")
Signed-off-by: Thorsten Scherer <t.scherer@eckelmann.de>
---
 drivers/net/dsa/microchip/ksz_common.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 89f0796894af..25226490d467 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -717,10 +717,9 @@ static const struct regmap_range ksz8563_valid_regs[] = {
 	regmap_reg_range(0x1030, 0x1030),
 	regmap_reg_range(0x1100, 0x1111),
 	regmap_reg_range(0x111a, 0x111d),
-	regmap_reg_range(0x1122, 0x1127),
-	regmap_reg_range(0x112a, 0x112b),
-	regmap_reg_range(0x1136, 0x1139),
-	regmap_reg_range(0x113e, 0x113f),
+	regmap_reg_range(0x1120, 0x112b),
+	regmap_reg_range(0x1134, 0x113b),
+	regmap_reg_range(0x113c, 0x113f),
 	regmap_reg_range(0x1400, 0x1401),
 	regmap_reg_range(0x1403, 0x1403),
 	regmap_reg_range(0x1410, 0x1417),
@@ -747,10 +746,9 @@ static const struct regmap_range ksz8563_valid_regs[] = {
 	regmap_reg_range(0x2030, 0x2030),
 	regmap_reg_range(0x2100, 0x2111),
 	regmap_reg_range(0x211a, 0x211d),
-	regmap_reg_range(0x2122, 0x2127),
-	regmap_reg_range(0x212a, 0x212b),
-	regmap_reg_range(0x2136, 0x2139),
-	regmap_reg_range(0x213e, 0x213f),
+	regmap_reg_range(0x2120, 0x212b),
+	regmap_reg_range(0x2134, 0x213b),
+	regmap_reg_range(0x213c, 0x213f),
 	regmap_reg_range(0x2400, 0x2401),
 	regmap_reg_range(0x2403, 0x2403),
 	regmap_reg_range(0x2410, 0x2417),
-- 
2.39.5


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

* Re: [PATCH] net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries
  2025-02-06 12:22 [PATCH] net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries Thorsten Scherer
@ 2025-02-08  1:00 ` Jakub Kicinski
  2025-02-10 17:13   ` Thorsten Scherer
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2025-02-08  1:00 UTC (permalink / raw)
  To: Thorsten Scherer
  Cc: netdev, Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	Rasmus Villemoes, kernel

On Thu,  6 Feb 2025 13:22:45 +0100 Thorsten Scherer wrote:
> -	regmap_reg_range(0x1122, 0x1127),
> -	regmap_reg_range(0x112a, 0x112b),
> -	regmap_reg_range(0x1136, 0x1139),
> -	regmap_reg_range(0x113e, 0x113f),
> +	regmap_reg_range(0x1120, 0x112b),
> +	regmap_reg_range(0x1134, 0x113b),
> +	regmap_reg_range(0x113c, 0x113f),

can these two not be merged?

>  	regmap_reg_range(0x1400, 0x1401),
>  	regmap_reg_range(0x1403, 0x1403),
>  	regmap_reg_range(0x1410, 0x1417),
> @@ -747,10 +746,9 @@ static const struct regmap_range ksz8563_valid_regs[] = {
>  	regmap_reg_range(0x2030, 0x2030),
>  	regmap_reg_range(0x2100, 0x2111),
>  	regmap_reg_range(0x211a, 0x211d),
> -	regmap_reg_range(0x2122, 0x2127),
> -	regmap_reg_range(0x212a, 0x212b),
> -	regmap_reg_range(0x2136, 0x2139),
> -	regmap_reg_range(0x213e, 0x213f),
> +	regmap_reg_range(0x2120, 0x212b),
> +	regmap_reg_range(0x2134, 0x213b),
> +	regmap_reg_range(0x213c, 0x213f),

and these?
-- 
pw-bot: cr

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

* Re: [PATCH] net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries
  2025-02-08  1:00 ` Jakub Kicinski
@ 2025-02-10 17:13   ` Thorsten Scherer
  2025-02-10 17:50     ` Tristram.Ha
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Scherer @ 2025-02-10 17:13 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: netdev, Woojung Huh, UNGLinuxDriver, Andrew Lunn, Vladimir Oltean,
	David S. Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
	Rasmus Villemoes, kernel

Hello,

On Fri, Feb 07, 2025 at 05:00:37PM -0800, Jakub Kicinski wrote:
> On Thu,  6 Feb 2025 13:22:45 +0100 Thorsten Scherer wrote:
> > -	regmap_reg_range(0x1122, 0x1127),
> > -	regmap_reg_range(0x112a, 0x112b),
> > -	regmap_reg_range(0x1136, 0x1139),
> > -	regmap_reg_range(0x113e, 0x113f),
> > +	regmap_reg_range(0x1120, 0x112b),
> > +	regmap_reg_range(0x1134, 0x113b),
> > +	regmap_reg_range(0x113c, 0x113f),
> 
> can these two not be merged?

I am not 100% sure.   But atm I don't see a reason why they could not.

> >  	regmap_reg_range(0x1400, 0x1401),
> >  	regmap_reg_range(0x1403, 0x1403),
> >  	regmap_reg_range(0x1410, 0x1417),
> > @@ -747,10 +746,9 @@ static const struct regmap_range ksz8563_valid_regs[] = {
> >  	regmap_reg_range(0x2030, 0x2030),
> >  	regmap_reg_range(0x2100, 0x2111),
> >  	regmap_reg_range(0x211a, 0x211d),
> > -	regmap_reg_range(0x2122, 0x2127),
> > -	regmap_reg_range(0x212a, 0x212b),
> > -	regmap_reg_range(0x2136, 0x2139),
> > -	regmap_reg_range(0x213e, 0x213f),
> > +	regmap_reg_range(0x2120, 0x212b),
> > +	regmap_reg_range(0x2134, 0x213b),
> > +	regmap_reg_range(0x213c, 0x213f),
> 
> and these?

Dito.

Will send a v2 as soon as I can get my hands on the test board again
(next few days).

> -- 
> pw-bot: cr

Best regards
Thorsten

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

* RE: [PATCH] net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries
  2025-02-10 17:13   ` Thorsten Scherer
@ 2025-02-10 17:50     ` Tristram.Ha
  0 siblings, 0 replies; 4+ messages in thread
From: Tristram.Ha @ 2025-02-10 17:50 UTC (permalink / raw)
  To: T.Scherer
  Cc: netdev, Woojung.Huh, UNGLinuxDriver, andrew, olteanv, davem, kuba,
	edumazet, pabeni, horms, linux, kernel

> Subject: Re: [PATCH] net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit
> boundaries
> 
> [Some people who received this message don't often get email from
> t.scherer@eckelmann.de. Learn why this is important at
> https://aka.ms/LearnAboutSenderIdentification ]
> 
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content
> is safe
> 
> Hello,
> 
> On Fri, Feb 07, 2025 at 05:00:37PM -0800, Jakub Kicinski wrote:
> > On Thu,  6 Feb 2025 13:22:45 +0100 Thorsten Scherer wrote:
> > > -   regmap_reg_range(0x1122, 0x1127),
> > > -   regmap_reg_range(0x112a, 0x112b),
> > > -   regmap_reg_range(0x1136, 0x1139),
> > > -   regmap_reg_range(0x113e, 0x113f),
> > > +   regmap_reg_range(0x1120, 0x112b),
> > > +   regmap_reg_range(0x1134, 0x113b),
> > > +   regmap_reg_range(0x113c, 0x113f),
> >
> > can these two not be merged?
> 
> I am not 100% sure.   But atm I don't see a reason why they could not.

When KSZ9896 register mapping was changed I already explained that
0xN100-0xN13F ranges map to PHY registers 0-0x1F, so it is safe to assign
only 2 ranges: regmap_reg_range(0x1100, 0x111f),
regmap_reg_range(0x0x1120, 0x113f).

The formula for accessing PHY register through port register is
0xN100 + reg * 2.

There is a bug in which high range 0xN120-0xN13f write has to be 32-bit.

> > >     regmap_reg_range(0x1400, 0x1401),
> > >     regmap_reg_range(0x1403, 0x1403),
> > >     regmap_reg_range(0x1410, 0x1417),
> > > @@ -747,10 +746,9 @@ static const struct regmap_range ksz8563_valid_regs[] =
> {
> > >     regmap_reg_range(0x2030, 0x2030),
> > >     regmap_reg_range(0x2100, 0x2111),
> > >     regmap_reg_range(0x211a, 0x211d),
> > > -   regmap_reg_range(0x2122, 0x2127),
> > > -   regmap_reg_range(0x212a, 0x212b),
> > > -   regmap_reg_range(0x2136, 0x2139),
> > > -   regmap_reg_range(0x213e, 0x213f),
> > > +   regmap_reg_range(0x2120, 0x212b),
> > > +   regmap_reg_range(0x2134, 0x213b),
> > > +   regmap_reg_range(0x213c, 0x213f),
> >
> > and these?
> 
> Dito.
> 
> Will send a v2 as soon as I can get my hands on the test board again
> (next few days).


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

end of thread, other threads:[~2025-02-10 17:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-06 12:22 [PATCH] net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries Thorsten Scherer
2025-02-08  1:00 ` Jakub Kicinski
2025-02-10 17:13   ` Thorsten Scherer
2025-02-10 17:50     ` Tristram.Ha

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).