Re: [PATCH net v1] net: dsa: mv88e6xxx: Make unsupported C45 reads return 0xffff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Does that mean if there's a device there but it doesn't support C45 (no
> phy_read_c45), it will now return ENODEV?

Yes, mv88e6xxx_mdio_read_c45() will return -ENODEV if
chip->info->ops->phy_read_c45 is NULL. That will cause the scan of
that address to immediately skip to the next address. This is old
behaviour for C22:

commit 02a6efcab675fe32815d824837784c3f42a7d892
Author: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
Date:   Tue Apr 24 18:09:04 2018 +0200

    net: phy: allow scanning busses with missing phys
    
    Some MDIO busses will error out when trying to read a phy address with no
    phy present at that address. In that case, probing the bus will fail
    because __mdiobus_register() is scanning the bus for all possible phys
    addresses.
    
    In case MII_PHYSID1 returns -EIO or -ENODEV, consider there is no phy at
    this address and set the phy ID to 0xffffffff which is then properly
    handled in get_phy_device().

And there are a few MDIO bus drivers which make use of this, e.g.

static int lan9303_phy_read(struct dsa_switch *ds, int phy, int regnum)
{
        struct lan9303 *chip = ds->priv;
        int phy_base = chip->phy_addr_base;

        if (phy == phy_base)
                return lan9303_virt_phy_reg_read(chip, regnum);
        if (phy > phy_base + 2)
                return -ENODEV;

        return chip->ops->phy_read(chip, phy, regnum);

This Ethernet switch supports only a number of PHY addresses, and
returns -ENODEV for the rest.

So its a legitimate way to say there is nothing here.

You suggestion of allowing ENOPSUPP for C45 would of fixed the
problem, but C22 and C45 would support different error codes, which i
don't like. Its better to be uniform.

	Andrew




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux