Skip to contentSkip to conversation

net: dsa: microchip: Always set regmap stride to 1

PATCH Superseded Marek Vasut 3 participants 4 messages Sep 21, 2019 – Sep 25, 2019

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: microchip: Always set regmap stride to 1

The regmap stride is set to 1 for regmap describing 8bit registers already. However, for 16/32/64bit registers, the stride is 2/4/8 respectively. This is not correct, as the switch protocol supports unaligned register reads and writes and the KSZ87xx even uses such unaligned register accesses to read e.g. MIB counter.

This patch fixes MIB counter access on KSZ87xx.

Cc Andrew Lunn <[email protected]>
Cc David S. Miller <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc George McCollister <[email protected]>
Cc Tristram Ha <[email protected]>
Cc Vivien Didelot <[email protected]>
Cc Woojung Huh <[email protected]>
---
 drivers/net/dsa/microchip/ksz_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz_common.h +1 -1
index a24d8e61fbe7..dd60d0837fc6 100644
@@ -303,7 +303,7 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset,
 	{								\
 		.name = #width,						\
 		.val_bits = (width),					\
-		.reg_stride = (width) / 8,				\
+		.reg_stride = 1,					\
 		.reg_bits = (regbits) + (regalign),			\
 		.pad_bits = (regpad),					\
 		.max_register = BIT(regbits) - 1,			\
Signature · 1 line
2.23.0.rc1
#1 lore raw
Quoted 7 lines · Marek Vasut

The regmap stride is set to 1 for regmap describing 8bit registers already. However, for 16/32/64bit registers, the stride is 2/4/8 respectively. This is not correct, as the switch protocol supports unaligned register reads and writes and the KSZ87xx even uses such unaligned register accesses to read e.g. MIB counter.

This patch fixes MIB counter access on KSZ87xx.

Should that be having the following Fixes tag(s):

Fixes 46558d601cb6 ("net: dsa: microchip: Initial SPI regmap support")

and where relevant:

Fixes 255b59ad0db2 ("net: dsa: microchip: Factor out regmap config

generation into common header")

Quoted 27 lines
Cc Andrew Lunn <[email protected]>
Cc David S. Miller <[email protected]>
Cc Florian Fainelli <[email protected]>
Cc George McCollister <[email protected]>
Cc Tristram Ha <[email protected]>
Cc Vivien Didelot <[email protected]>
Cc Woojung Huh <[email protected]>
---
 drivers/net/dsa/microchip/ksz_common.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/microchip/ksz_common.h +1 -1
index a24d8e61fbe7..dd60d0837fc6 100644
@@ -303,7 +303,7 @@ static inline void ksz_pwrite32(struct ksz_device *dev, int port, int offset,
 	{								\
 		.name = #width,						\
 		.val_bits = (width),					\
-		.reg_stride = (width) / 8,				\
+		.reg_stride = 1,					\
 		.reg_bits = (regbits) + (regalign),			\
 		.pad_bits = (regpad),					\
 		.max_register = BIT(regbits) - 1,			\
Signature · 1 line
Florian
maintainer
#2 lore raw
In reply to Marek Vasut

From: Marek Vasut <[email protected]>
Date: Sat, 21 Sep 2019 19:53:09 +0200

Quoted 9 lines

The regmap stride is set to 1 for regmap describing 8bit registers already. However, for 16/32/64bit registers, the stride is 2/4/8 respectively. This is not correct, as the switch protocol supports unaligned register reads and writes and the KSZ87xx even uses such unaligned register accesses to read e.g. MIB counter.

This patch fixes MIB counter access on KSZ87xx.

Please resubmit with an appropriate Fixes: tag as per Florian's feedback.

Thank you.

#3 lore raw
Quoted 9 lines · David Miller

From: Marek Vasut <[email protected]>
Date: Sat, 21 Sep 2019 19:53:09 +0200

Quoted 6 lines

The regmap stride is set to 1 for regmap describing 8bit registers already. However, for 16/32/64bit registers, the stride is 2/4/8 respectively. This is not correct, as the switch protocol supports unaligned register reads and writes and the KSZ87xx even uses such unaligned register accesses to read e.g. MIB counter.

Quoted 5 lines
Quoted 3 lines

This patch fixes MIB counter access on KSZ87xx.

Please resubmit with an appropriate Fixes: tag as per Florian's feedback.

Done