Commit d934423a authored by Arnaud Patard (Rtp)'s avatar Arnaud Patard (Rtp) Committed by David S. Miller

drivers/net/ethernet/marvell/mvmdio.c: Fix non OF case

Orion5.x systems are still using machine files and not device-tree.
Commit 96cb4342 ("net: mvmdio: allow up to three clocks to be
specified for orion-mdio") has replaced devm_clk_get() with of_clk_get(),
leading to a oops at boot and not working network, as reported in
https://lists.debian.org/debian-arm/2019/07/msg00088.html and possibly in
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=908712.

Link: https://lists.debian.org/debian-arm/2019/07/msg00088.html
Fixes: 96cb4342 ("net: mvmdio: allow up to three clocks to be specified for orion-mdio")
Signed-off-by: default avatarArnaud Patard <arnaud.patard@rtp-net.org>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cd206360
...@@ -319,20 +319,33 @@ static int orion_mdio_probe(struct platform_device *pdev) ...@@ -319,20 +319,33 @@ static int orion_mdio_probe(struct platform_device *pdev)
init_waitqueue_head(&dev->smi_busy_wait); init_waitqueue_head(&dev->smi_busy_wait);
for (i = 0; i < ARRAY_SIZE(dev->clk); i++) { if (pdev->dev.of_node) {
dev->clk[i] = of_clk_get(pdev->dev.of_node, i); for (i = 0; i < ARRAY_SIZE(dev->clk); i++) {
if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) { dev->clk[i] = of_clk_get(pdev->dev.of_node, i);
if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER;
goto out_clk;
}
if (IS_ERR(dev->clk[i]))
break;
clk_prepare_enable(dev->clk[i]);
}
if (!IS_ERR(of_clk_get(pdev->dev.of_node,
ARRAY_SIZE(dev->clk))))
dev_warn(&pdev->dev,
"unsupported number of clocks, limiting to the first "
__stringify(ARRAY_SIZE(dev->clk)) "\n");
} else {
dev->clk[0] = clk_get(&pdev->dev, NULL);
if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) {
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
goto out_clk; goto out_clk;
} }
if (IS_ERR(dev->clk[i])) if (!IS_ERR(dev->clk[0]))
break; clk_prepare_enable(dev->clk[0]);
clk_prepare_enable(dev->clk[i]);
} }
if (!IS_ERR(of_clk_get(pdev->dev.of_node, ARRAY_SIZE(dev->clk))))
dev_warn(&pdev->dev, "unsupported number of clocks, limiting to the first "
__stringify(ARRAY_SIZE(dev->clk)) "\n");
dev->err_interrupt = platform_get_irq(pdev, 0); dev->err_interrupt = platform_get_irq(pdev, 0);
if (dev->err_interrupt > 0 && if (dev->err_interrupt > 0 &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment