All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marek Behún" <kabel@kernel.org>
To: netdev@vger.kernel.org
Cc: "Jakub Kicinski" <kuba@kernel.org>,
	"Vladimir Oltean" <olteanv@gmail.com>,
	"Klaus Kudielka" <klaus.kudielka@gmail.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Marek Behún" <kabel@kernel.org>
Subject: [PATCH net-next] net: dsa: mv88e6xxx: fix mdio bus' phy_mask member
Date: Sun, 19 Mar 2023 15:02:38 +0100	[thread overview]
Message-ID: <20230319140238.9470-1-kabel@kernel.org> (raw)

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(-)

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);
-- 
2.39.2


             reply	other threads:[~2023-03-19 14:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-19 14:02 Marek Behún [this message]
2023-03-19 14:40 ` [PATCH net-next] net: dsa: mv88e6xxx: fix mdio bus' phy_mask member Klaus Kudielka
2023-03-19 17:53 ` Vladimir Oltean
2023-03-21 12:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230319140238.9470-1-kabel@kernel.org \
    --to=kabel@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=klaus.kudielka@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.