Re: [PATCH v2 net-next 4/9] net: dsa: microchip: add DSA support for microchip lan937x

From: Andrew Lunn
Date: Mon Apr 26 2021 - 08:34:34 EST


> What do you think on the following code?
>
> struct dsa_port *dp = dsa_to_port(dev->ds, port);
> struct phy_device *phy_dev = dp->slave->phydev;
> .
> .
> .
>
> if (!phydev || phy_driver_is_genphy(phydev)) {
> /*Add RGMII internal delay*/
> }


phy_driver_is_genphy(phydev) is probably a bad idea. If you get a
delay depends on if they driver is available? I would prefer you
assume the PHY can do delays. So you only need to consider when the
MII port is used for connecting to the CPU. So make use of
dsa_is_cpu_port().

Andrew