Hardware polling breaks C45 over C22 PHY access. Currently this is accepted by the driver but it silently fails with undefined results. Make the situation clear to the caller by adding checks, returning an error and giving a one-time warning message. Suggested-by: Andrew Lunn Signed-off-by: Markus Stockhausen --- drivers/net/mdio/mdio-realtek-rtl9300.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c index 73ac5fdcd267..69565a87f99d 100644 --- a/drivers/net/mdio/mdio-realtek-rtl9300.c +++ b/drivers/net/mdio/mdio-realtek-rtl9300.c @@ -115,6 +115,7 @@ #include #include #include +#include #include #include #include @@ -453,6 +454,12 @@ static int otto_emdio_read_c22(struct mii_bus *bus, int phy_id, int regnum) int ret, port; u32 value; + if (regnum == MII_MMD_CTRL || regnum == MII_MMD_DATA) { + dev_warn_once(&bus->dev, + "C45 over C22 read access broken due to polling\n"); + return -EOPNOTSUPP; + } + port = otto_emdio_phy_to_port(bus, phy_id); if (port < 0) return port; @@ -463,11 +470,18 @@ static int otto_emdio_read_c22(struct mii_bus *bus, int phy_id, int regnum) return ret ? ret : value; } -static int otto_emdio_write_c22(struct mii_bus *bus, int phy_id, int regnum, u16 value) +static int otto_emdio_write_c22(struct mii_bus *bus, int phy_id, int regnum, + u16 value) { struct otto_emdio_priv *priv = otto_emdio_bus_to_priv(bus); int ret, port; + if (regnum == MII_MMD_CTRL || regnum == MII_MMD_DATA) { + dev_warn_once(&bus->dev, + "C45 over C22 write access broken due to polling\n"); + return -EOPNOTSUPP; + } + port = otto_emdio_phy_to_port(bus, phy_id); if (port < 0) return port; -- 2.55.0