net: dsa: microchip: Always set regmap stride to 1
authorMarek Vasut <[email protected]>
Wed, 25 Sep 2019 22:08:42 +0000 (00:08 +0200)
committerDavid S. Miller <[email protected]>
Fri, 27 Sep 2019 18:21:07 +0000 (20:21 +0200)
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.

Signed-off-by: Marek Vasut <[email protected]>
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]>
Fixes: 46558d601cb6 ("net: dsa: microchip: Initial SPI regmap support")
Fixes: 255b59ad0db2 ("net: dsa: microchip: Factor out regmap config generation into common header")
Reviewed-by: George McCollister <[email protected]>
Tested-by: George McCollister <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
drivers/net/dsa/microchip/ksz_common.h

index a24d8e61fbe7b6739e9de6764db26ba876f982ac..dd60d0837fc6db51f744db06fb26f1eeefb83673 100644 (file)
@@ -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,                       \