If the switch is directly controlled by the mdio bus, we must ensure
that the mdio bus is ready instead of trying GPIO simulated bus.
Fixes: d4ac26ec4920 ("kernel: rtl8366-smi: add Realtek switch management via mii-bus")
Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/21143
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
if (!smi->ext_mbus) {
dev_info(&pdev->dev,
"cannot find mdio bus from bus handle (yet)");
- goto try_gpio;
+ return -EPROBE_DEFER;
}
if (of_property_read_u32(np, "phy-id", &smi->phy_id))
try_gpio:
if (!gpio_is_valid(sck) || !gpio_is_valid(sda)) {
- if (!mdio_node) {
- dev_err(&pdev->dev, "gpios missing in devictree\n");
- return -EINVAL;
- } else {
- return -EPROBE_DEFER;
- }
+ dev_err(&pdev->dev, "gpios missing in devictree\n");
+ return -EINVAL;
}
smi->gpio_sda = sda;