Skip to content

Commit 8d7ae22

Browse files
Lukasz Majewskidavem330
authored andcommitted
net: dsa: microchip: KSZ9477 register regmap alignment to 32 bit boundaries
The commit (SHA1: 5c844d5) provided code to apply "Module 6: Certain PHY registers must be written as pairs instead of singly" errata for KSZ9477 as this chip for certain PHY registers (0xN120 to 0xN13F, N=1,2,3,4,5) must be accesses as 32 bit words instead of 16 or 8 bit access. Otherwise, adjacent registers (no matter if reserved or not) are overwritten with 0x0. Without this patch some registers (e.g. 0x113c or 0x1134) required for 32 bit access are out of valid regmap ranges. As a result, following error is observed and KSZ9477 is not properly configured: 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 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 0 The solution is to modify regmap_reg_range to allow accesses with 4 bytes boundaries. Signed-off-by: Lukasz Majewski <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a0b1b20 commit 8d7ae22

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

drivers/net/dsa/microchip/ksz_common.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -635,10 +635,9 @@ static const struct regmap_range ksz9477_valid_regs[] = {
635635
regmap_reg_range(0x1030, 0x1030),
636636
regmap_reg_range(0x1100, 0x1115),
637637
regmap_reg_range(0x111a, 0x111f),
638-
regmap_reg_range(0x1122, 0x1127),
639-
regmap_reg_range(0x112a, 0x112b),
640-
regmap_reg_range(0x1136, 0x1139),
641-
regmap_reg_range(0x113e, 0x113f),
638+
regmap_reg_range(0x1120, 0x112b),
639+
regmap_reg_range(0x1134, 0x113b),
640+
regmap_reg_range(0x113c, 0x113f),
642641
regmap_reg_range(0x1400, 0x1401),
643642
regmap_reg_range(0x1403, 0x1403),
644643
regmap_reg_range(0x1410, 0x1417),
@@ -669,10 +668,9 @@ static const struct regmap_range ksz9477_valid_regs[] = {
669668
regmap_reg_range(0x2030, 0x2030),
670669
regmap_reg_range(0x2100, 0x2115),
671670
regmap_reg_range(0x211a, 0x211f),
672-
regmap_reg_range(0x2122, 0x2127),
673-
regmap_reg_range(0x212a, 0x212b),
674-
regmap_reg_range(0x2136, 0x2139),
675-
regmap_reg_range(0x213e, 0x213f),
671+
regmap_reg_range(0x2120, 0x212b),
672+
regmap_reg_range(0x2134, 0x213b),
673+
regmap_reg_range(0x213c, 0x213f),
676674
regmap_reg_range(0x2400, 0x2401),
677675
regmap_reg_range(0x2403, 0x2403),
678676
regmap_reg_range(0x2410, 0x2417),
@@ -703,10 +701,9 @@ static const struct regmap_range ksz9477_valid_regs[] = {
703701
regmap_reg_range(0x3030, 0x3030),
704702
regmap_reg_range(0x3100, 0x3115),
705703
regmap_reg_range(0x311a, 0x311f),
706-
regmap_reg_range(0x3122, 0x3127),
707-
regmap_reg_range(0x312a, 0x312b),
708-
regmap_reg_range(0x3136, 0x3139),
709-
regmap_reg_range(0x313e, 0x313f),
704+
regmap_reg_range(0x3120, 0x312b),
705+
regmap_reg_range(0x3134, 0x313b),
706+
regmap_reg_range(0x313c, 0x313f),
710707
regmap_reg_range(0x3400, 0x3401),
711708
regmap_reg_range(0x3403, 0x3403),
712709
regmap_reg_range(0x3410, 0x3417),
@@ -737,10 +734,9 @@ static const struct regmap_range ksz9477_valid_regs[] = {
737734
regmap_reg_range(0x4030, 0x4030),
738735
regmap_reg_range(0x4100, 0x4115),
739736
regmap_reg_range(0x411a, 0x411f),
740-
regmap_reg_range(0x4122, 0x4127),
741-
regmap_reg_range(0x412a, 0x412b),
742-
regmap_reg_range(0x4136, 0x4139),
743-
regmap_reg_range(0x413e, 0x413f),
737+
regmap_reg_range(0x4120, 0x412b),
738+
regmap_reg_range(0x4134, 0x413b),
739+
regmap_reg_range(0x413c, 0x413f),
744740
regmap_reg_range(0x4400, 0x4401),
745741
regmap_reg_range(0x4403, 0x4403),
746742
regmap_reg_range(0x4410, 0x4417),
@@ -771,10 +767,9 @@ static const struct regmap_range ksz9477_valid_regs[] = {
771767
regmap_reg_range(0x5030, 0x5030),
772768
regmap_reg_range(0x5100, 0x5115),
773769
regmap_reg_range(0x511a, 0x511f),
774-
regmap_reg_range(0x5122, 0x5127),
775-
regmap_reg_range(0x512a, 0x512b),
776-
regmap_reg_range(0x5136, 0x5139),
777-
regmap_reg_range(0x513e, 0x513f),
770+
regmap_reg_range(0x5120, 0x512b),
771+
regmap_reg_range(0x5134, 0x513b),
772+
regmap_reg_range(0x513c, 0x513f),
778773
regmap_reg_range(0x5400, 0x5401),
779774
regmap_reg_range(0x5403, 0x5403),
780775
regmap_reg_range(0x5410, 0x5417),

0 commit comments

Comments
 (0)