Skip to contentSkip to conversation

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

PATCH In review Arnaud Patard (Rtp) 2 participants 4 messages Oct 15, 2020 – Oct 16, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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

commit d934423ac26ed373dfe089734d505dca5ff679b6 upstream.

Orion5.x systems are still using machine files and not device-tree. Commit 96cb4342382290c9 ("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.

Fixes 96cb4342382290c9 ("net: mvmdio: allow up to three clocks to be specified for orion-mdio")
drivers/net/ethernet/marvell/mvmdio.c +16 -6
Index: linux/drivers/net/ethernet/marvell/mvmdio.c
===================================================================
@@ -319,15 +319,25 @@ static int orion_mdio_probe(struct platf
 
 	init_waitqueue_head(&dev->smi_busy_wait);
 
-	for (i = 0; i < ARRAY_SIZE(dev->clk); i++) {
-		dev->clk[i] = of_clk_get(pdev->dev.of_node, i);
-		if (PTR_ERR(dev->clk[i]) == -EPROBE_DEFER) {
+	if (pdev->dev.of_node) {
+		for (i = 0; i < ARRAY_SIZE(dev->clk); i++) {
+			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]);
+		}
+	} else {
+		dev->clk[0] = clk_get(&pdev->dev, NULL);
+		if (PTR_ERR(dev->clk[0]) == -EPROBE_DEFER) {
 			ret = -EPROBE_DEFER;
 			goto out_clk;
 		}
-		if (IS_ERR(dev->clk[i]))
-			break;
-		clk_prepare_enable(dev->clk[i]);
+		if (!IS_ERR(dev->clk[0]))
+			clk_prepare_enable(dev->clk[0]);
 	}
 
 	dev->err_interrupt = platform_get_irq(pdev, 0);
maintainer
#1 lore raw
Quoted 9 lines · Arnaud Patard

commit d934423ac26ed373dfe089734d505dca5ff679b6 upstream.

Orion5.x systems are still using machine files and not device-tree. Commit 96cb4342382290c9 ("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.

Quoted 6 lines
Fixes 96cb4342382290c9 ("net: mvmdio: allow up to three clocks to be specified for orion-mdio")

What stable tree(s) are you asking for this to be backported to?

thanks,

greg k-h

#2 lore raw
Quoted 10 lines · Greg KH
Quoted 9 lines · Arnaud Patard

commit d934423ac26ed373dfe089734d505dca5ff679b6 upstream.

Orion5.x systems are still using machine files and not device-tree. Commit 96cb4342382290c9 ("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.

Quoted 8 lines
Quoted 6 lines
Fixes 96cb4342382290c9 ("net: mvmdio: allow up to three clocks to be specified for orion-mdio")

What stable tree(s) are you asking for this to be backported to?

oops, forgot to put it in the mail subject. It's for 4.19.X, which is used in Debian stable.

Arnaud

maintainer
#3 lore raw
Quoted 19 lines · Arnaud Patard
Quoted 17 lines · Greg KH
Quoted 15 lines · Arnaud Patard

commit d934423ac26ed373dfe089734d505dca5ff679b6 upstream.

Orion5.x systems are still using machine files and not device-tree. Commit 96cb4342382290c9 ("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.

Fixes 96cb4342382290c9 ("net: mvmdio: allow up to three clocks to be specified for orion-mdio")
Quoted 4 lines
Quoted 1 line

What stable tree(s) are you asking for this to be backported to?

oops, forgot to put it in the mail subject. It's for 4.19.X, which is used in Debian stable.

Also works on 4.14.y, so I've put it there as well.

thanks,

greg k-h