diff mbox series

[net-next] net: dsa: mv88e6xxx: fix mdio bus' phy_mask member

Message ID 20230319140238.9470-1-kabel@kernel.org (mailing list archive)
State Accepted
Commit a4926c2943dd17f84b552ba6fb754df0dc6a2fa8
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: dsa: mv88e6xxx: fix mdio bus' phy_mask member | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 18 this patch: 18
netdev/cc_maintainers fail 1 blamed authors not CCed: andrew@lunn.ch; 4 maintainers not CCed: edumazet@google.com pabeni@redhat.com davem@davemloft.net andrew@lunn.ch
netdev/build_clang success Errors and warnings before: 18 this patch: 18
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 18 this patch: 18
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Marek Behún March 19, 2023, 2:02 p.m. UTC
Commit 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing
phys during probing") added non-trivial bus->phy_mask in
mv88e6xxx_mdio_register() in order to avoid excessive mdio bus
transactions during probing.

But the mask is incorrect for switches with non-zero phy_base_addr (such
as 88E6341).

Fix this.

Fixes: 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing phys during probing")
Signed-off-by: Marek Behún <kabel@kernel.org>
---
I was unable to test this now, so this change needs testing.
---
 drivers/net/dsa/mv88e6xxx/chip.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Klaus Kudielka March 19, 2023, 2:40 p.m. UTC | #1
On Sun, 2023-03-19 at 15:02 +0100, Marek Behún wrote:
> Commit 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing
> phys during probing") added non-trivial bus->phy_mask in
> mv88e6xxx_mdio_register() in order to avoid excessive mdio bus
> transactions during probing.
> 
> But the mask is incorrect for switches with non-zero phy_base_addr (such
> as 88E6341).
> 
> Fix this.
> 
> Fixes: 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing phys during probing")
> Signed-off-by: Marek Behún <kabel@kernel.org>
> ---
> I was unable to test this now, so this change needs testing.

Thanks for spotting.
I can only test this on Turris Omnia with 88E6176.
All 5 ports Ok, phy probe time unchanged.

Tested-by: Klaus Kudielka <klaus.kudielka@gmail.com>
Vladimir Oltean March 19, 2023, 5:53 p.m. UTC | #2
On Sun, Mar 19, 2023 at 03:02:38PM +0100, Marek Behún wrote:
> Commit 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing
> phys during probing") added non-trivial bus->phy_mask in
> mv88e6xxx_mdio_register() in order to avoid excessive mdio bus
> transactions during probing.
> 
> But the mask is incorrect for switches with non-zero phy_base_addr (such
> as 88E6341).
> 
> Fix this.
> 
> Fixes: 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing phys during probing")
> Signed-off-by: Marek Behún <kabel@kernel.org>
> ---
> I was unable to test this now, so this change needs testing.

You should be able to test it if you remove the phy-handles and the mdio
subnode from the device tree.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
patchwork-bot+netdevbpf@kernel.org March 21, 2023, 12:10 p.m. UTC | #3
Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Sun, 19 Mar 2023 15:02:38 +0100 you wrote:
> Commit 2c7e46edbd03 ("net: dsa: mv88e6xxx: mask apparently non-existing
> phys during probing") added non-trivial bus->phy_mask in
> mv88e6xxx_mdio_register() in order to avoid excessive mdio bus
> transactions during probing.
> 
> But the mask is incorrect for switches with non-zero phy_base_addr (such
> as 88E6341).
> 
> [...]

Here is the summary with links:
  - [net-next] net: dsa: mv88e6xxx: fix mdio bus' phy_mask member
    https://git.kernel.org/netdev/net-next/c/a4926c2943dd

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c
index 260e38c5c6e6..b73d1d6747b7 100644
--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3805,7 +3805,9 @@  static int mv88e6xxx_mdio_register(struct mv88e6xxx_chip *chip,
 	bus->read_c45 = mv88e6xxx_mdio_read_c45;
 	bus->write_c45 = mv88e6xxx_mdio_write_c45;
 	bus->parent = chip->dev;
-	bus->phy_mask = GENMASK(31, mv88e6xxx_num_ports(chip));
+	bus->phy_mask = ~GENMASK(chip->info->phy_base_addr +
+				 mv88e6xxx_num_ports(chip) - 1,
+				 chip->info->phy_base_addr);
 
 	if (!external) {
 		err = mv88e6xxx_g2_irq_mdio_setup(chip, bus);