Skip to contentSkip to conversation

net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries

PATCH In review Thorsten Scherer 3 participants 4 messages Feb 6, 2025 – Feb 10, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: microchip: KSZ8563 register regmap alignment to 32 bit boundaries

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")
---
 drivers/net/dsa/microchip/ksz_common.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/net/dsa/microchip/ksz_common.c +6 -8
index 89f0796894af..25226490d467 100644
@@ -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),
Signature · 1 line
2.39.5
maintainer
#1 lore raw

drivers/net/dsa/microchip/ksz_common.c static const struct regmap_range ksz8563_valid_regs[] = { · line 722

Quoted 7 lines · On Thu, 6 Feb 2025 13:22:45 +0100 Thorsten Scherer wrote:
drivers/net/dsa/microchip/ksz_common.c +3 -4
-	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?

Quoted 4 lines
drivers/net/dsa/microchip/ksz_common.c +0 -0
 	regmap_reg_range(0x1400, 0x1401),
 	regmap_reg_range(0x1403, 0x1403),
 	regmap_reg_range(0x1410, 0x1417),

drivers/net/dsa/microchip/ksz_common.c static const struct regmap_range ksz8563_valid_regs[] = { · line 751

Quoted 10 lines
drivers/net/dsa/microchip/ksz_common.c +3 -4
@@ -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?

Signature · 1 line
pw-bot: cr
#2 lore raw

Hello,

Quoted 10 lines · Jakub Kicinski

drivers/net/dsa/microchip/ksz_common.c static const struct regmap_range ksz8563_valid_regs[] = { · line 722

Quoted 7 lines · On Thu, 6 Feb 2025 13:22:45 +0100 Thorsten Scherer wrote:
drivers/net/dsa/microchip/ksz_common.c +3 -4
-	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.

Quoted 8 lines
Quoted 8 lines
drivers/net/dsa/microchip/ksz_common.c +0 -1
 	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),
Quoted 8 lines

drivers/net/dsa/microchip/ksz_common.c static const struct regmap_range ksz8563_valid_regs[] = { · line 751

Quoted 6 lines
drivers/net/dsa/microchip/ksz_common.c +3 -3
-	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).

Quoted 2 lines
Signature · 1 line
pw-bot: cr

Best regards
Thorsten

#3 lore raw
Quoted 22 lines

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 [email protected]. 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,

Quoted 9 lines · Jakub Kicinski
Quoted 7 lines · On Thu, 6 Feb 2025 13:22:45 +0100 Thorsten Scherer wrote:
drivers/net/dsa/microchip/ksz_common.c +3 -4
-   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),
Quoted 3 lines
Quoted 1 line

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.

Quoted 22 lines
Quoted 4 lines

Review static const struct regmap_range ksz8563_valid_regs[] =

Quoted 4 lines
    regmap_reg_range(0x1400, 0x1401),
    regmap_reg_range(0x1403, 0x1403),
    regmap_reg_range(0x1410, 0x1417),
(quoted diff) +0 -0
@@ -747,10 +746,9 @@ static const struct regmap_range ksz8563_valid_regs[] =

{

Quoted 11 lines

drivers/net/dsa/microchip/ksz_common.c static const struct regmap_range ksz8563_valid_regs[] = { · line 751

Quoted 10 lines
drivers/net/dsa/microchip/ksz_common.c +3 -4
    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),
Quoted 1 line

and these?

Dito.

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