[PATCH net-next v2 4/6] net: mdio: scan bus based on bus capabilities for C22 and C45

Klaus Kudielka klaus.kudielka at gmail.com
Sat Mar 11 09:32:54 PST 2023


On Sat, 2023-03-11 at 17:11 +0100, Klaus Kudielka wrote:
> On Sat, 2023-03-11 at 16:39 +0100, Andrew Lunn wrote:
> 
> > If there is no DT node, by default, all 32 addresses on the bus are
> > scanned. However, DSA makes another assumption. There is a one to one
> > mapping between port number and PHY address on the MDIO bus. Port 0
> > uses MDIO address 0. Port 7 uses MDIO address 7 etc. If you have an 8
> > port switch, there is no point scanning addresses 8 to 31, they will
> > never be used.
> > 
> > The mdio bus structure has a member phy_mask. This is a bitmap. If bit
> > N is set, address N is not scanned. So i suggest you extend
> > mv88e6xxx_mdio_register() to set phy_mask based on
> > mv88e6xxx_num_ports(chip).
> > 
> 
> What you are proposing here would not show any improvement on the
> Omnia, as only the 6 ports would be scanned - right? 
> 

Well, maybe I misunderstood the argument with DT completely, so I gave it a try:

--- a/drivers/net/dsa/mv88e6xxx/chip.c
+++ b/drivers/net/dsa/mv88e6xxx/chip.c
@@ -3797,6 +3797,7 @@ 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));
 
        if (!external) {
                err = mv88e6xxx_g2_irq_mdio_setup(chip, bus);

> 

Now THAT one makes a difference! With this on top, I'm back at normal boot time!
I hope this is what you had in mind?

Best regards, Klaus




More information about the Linux-mediatek mailing list