The to-be-merged RTL83xx devices have only 1G ports. Thus the MDIO bus always runs with C22 mode. For now it makes no sense to add those devices with C45 helpers that are not used at all. Add a consistency check in the mapping helper so that it aborts setup if devicetree defines a C45 PHY for a device that has no such read/write functions. Signed-off-by: Markus Stockhausen --- drivers/net/mdio/mdio-realtek-rtl9300.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/mdio/mdio-realtek-rtl9300.c b/drivers/net/mdio/mdio-realtek-rtl9300.c index f8577aedf08d..368166061aef 100644 --- a/drivers/net/mdio/mdio-realtek-rtl9300.c +++ b/drivers/net/mdio/mdio-realtek-rtl9300.c @@ -779,8 +779,13 @@ static int otto_emdio_map_ports(struct device *dev) * (i.e. clause 45). Select 10GPHY mode if there is at least one PHY that * declares compatible = "ethernet-phy-ieee802.3-c45". */ - if (of_device_is_compatible(phy_dn, "ethernet-phy-ieee802.3-c45")) + if (of_device_is_compatible(phy_dn, "ethernet-phy-ieee802.3-c45")) { + if (!priv->info->read_c45 || !priv->info->write_c45) { + err = -EOPNOTSUPP; + goto put_nodes; + } priv->smi_bus_is_c45[bus] = true; + } __set_bit(pn, priv->valid_ports); priv->smi_bus[pn] = bus; -- 2.55.0