mirror of
https://github.com/openwrt/openwrt.git
synced 2025-03-12 07:24:22 +00:00
generic: rtl836x: support defered probe on mdio-bus
On the WNDAP620, the mdio and mdc lines are controlled by the EMAC ethernet device. This results in a hen-vs-egg problem. The rtl8367b driver is probed before the ethernet driver and the mdio-bus is not available yet, which caused the rtl8367b driver to fail. This patch changes the rtl8366_smi_probe_of() function to return -EPROBE_DEFER if the mdio-bus lookup failed and changes rtl8366_smi_probe()'s signature to return the error code back to the callee, so it can propagate back to the kernel. Which, will retry the switch probe at a later time. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
This commit is contained in:
parent
fb4bed5fe9
commit
910c2f9e68
@ -1553,8 +1553,8 @@ int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi *smi)
|
|||||||
|
|
||||||
smi->ext_mbus = of_mdio_find_bus(mdio_node);
|
smi->ext_mbus = of_mdio_find_bus(mdio_node);
|
||||||
if (!smi->ext_mbus) {
|
if (!smi->ext_mbus) {
|
||||||
dev_err(&pdev->dev,
|
dev_info(&pdev->dev,
|
||||||
"cannot find mdio bus from bus handle");
|
"cannot find mdio bus from bus handle (yet)");
|
||||||
goto try_gpio;
|
goto try_gpio;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1562,8 +1562,12 @@ int rtl8366_smi_probe_of(struct platform_device *pdev, struct rtl8366_smi *smi)
|
|||||||
|
|
||||||
try_gpio:
|
try_gpio:
|
||||||
if (!gpio_is_valid(sck) || !gpio_is_valid(sda)) {
|
if (!gpio_is_valid(sck) || !gpio_is_valid(sda)) {
|
||||||
|
if (!mdio_node) {
|
||||||
dev_err(&pdev->dev, "gpios missing in devictree\n");
|
dev_err(&pdev->dev, "gpios missing in devictree\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
} else {
|
||||||
|
return -EPROBE_DEFER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
smi->gpio_sda = sda;
|
smi->gpio_sda = sda;
|
||||||
@ -1619,7 +1623,7 @@ struct rtl8366_smi *rtl8366_smi_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
free_smi:
|
free_smi:
|
||||||
kfree(smi);
|
kfree(smi);
|
||||||
return NULL;
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(rtl8366_smi_probe);
|
EXPORT_SYMBOL_GPL(rtl8366_smi_probe);
|
||||||
|
|
||||||
|
@ -1445,8 +1445,8 @@ static int rtl8366rb_probe(struct platform_device *pdev)
|
|||||||
" version " RTL8366RB_DRIVER_VER"\n");
|
" version " RTL8366RB_DRIVER_VER"\n");
|
||||||
|
|
||||||
smi = rtl8366_smi_probe(pdev);
|
smi = rtl8366_smi_probe(pdev);
|
||||||
if (!smi)
|
if (IS_ERR(smi))
|
||||||
return -ENODEV;
|
return PTR_ERR(smi);
|
||||||
|
|
||||||
smi->clk_delay = 10;
|
smi->clk_delay = 10;
|
||||||
smi->cmd_read = 0xa9;
|
smi->cmd_read = 0xa9;
|
||||||
|
@ -1233,8 +1233,8 @@ static int rtl8366s_probe(struct platform_device *pdev)
|
|||||||
" version " RTL8366S_DRIVER_VER"\n");
|
" version " RTL8366S_DRIVER_VER"\n");
|
||||||
|
|
||||||
smi = rtl8366_smi_probe(pdev);
|
smi = rtl8366_smi_probe(pdev);
|
||||||
if (!smi)
|
if (IS_ERR(smi))
|
||||||
return -ENODEV;
|
return PTR_ERR(smi);
|
||||||
|
|
||||||
smi->clk_delay = 10;
|
smi->clk_delay = 10;
|
||||||
smi->cmd_read = 0xa9;
|
smi->cmd_read = 0xa9;
|
||||||
|
@ -1752,8 +1752,8 @@ static int rtl8367_probe(struct platform_device *pdev)
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
smi = rtl8366_smi_probe(pdev);
|
smi = rtl8366_smi_probe(pdev);
|
||||||
if (!smi)
|
if (IS_ERR(smi))
|
||||||
return -ENODEV;
|
return PTR_ERR(smi);
|
||||||
|
|
||||||
smi->clk_delay = 1500;
|
smi->clk_delay = 1500;
|
||||||
smi->cmd_read = 0xb9;
|
smi->cmd_read = 0xb9;
|
||||||
|
@ -1527,8 +1527,8 @@ static int rtl8367b_probe(struct platform_device *pdev)
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
smi = rtl8366_smi_probe(pdev);
|
smi = rtl8366_smi_probe(pdev);
|
||||||
if (!smi)
|
if (IS_ERR(smi))
|
||||||
return -ENODEV;
|
return PTR_ERR(smi);
|
||||||
|
|
||||||
smi->clk_delay = 1500;
|
smi->clk_delay = 1500;
|
||||||
smi->cmd_read = 0xb9;
|
smi->cmd_read = 0xb9;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user