aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch
diff options
context:
space:
mode:
authorJonas Gorski <jonas.gorski@gmail.com>2017-12-06 14:12:06 +0100
committerJonas Gorski <jonas.gorski@gmail.com>2017-12-16 12:57:06 +0100
commit054c0d4e31932abeee6d92904642ebb9fd186638 (patch)
tree7760c3b143585d565a4999ce8e1554013b8abab4 /target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch
parent49c3b1c4555db688c4c514d1284254f954e46180 (diff)
downloadupstream-054c0d4e31932abeee6d92904642ebb9fd186638.tar.gz
upstream-054c0d4e31932abeee6d92904642ebb9fd186638.tar.bz2
upstream-054c0d4e31932abeee6d92904642ebb9fd186638.zip
brcm63xx: backport mdio-bus reset gpio support
Backport the mdio-bus reset gpio support from 4.12 and use it instead of toggling the reset ourself. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Diffstat (limited to 'target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch')
-rw-r--r--target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch b/target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch
new file mode 100644
index 0000000000..d7ac6234cf
--- /dev/null
+++ b/target/linux/brcm63xx/patches-4.4/001-4.13-03-mdio_bus-use-devm_gpiod_get_optional.patch
@@ -0,0 +1,39 @@
+From fe0e4052fb11d5c713961ab7e136520be40052a3 Mon Sep 17 00:00:00 2001
+From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Date: Mon, 12 Jun 2017 23:55:39 +0300
+Subject: [PATCH] mdio_bus: use devm_gpiod_get_optional()
+
+The MDIO reset GPIO is really a classical optional GPIO property case,
+so devm_gpiod_get_optional() should have been used, not devm_gpiod_get().
+Doing this saves several LoCs...
+
+Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+---
+ drivers/net/phy/mdio_bus.c | 14 +++++---------
+ 1 file changed, 5 insertions(+), 9 deletions(-)
+
+--- a/drivers/net/phy/mdio_bus.c
++++ b/drivers/net/phy/mdio_bus.c
+@@ -280,16 +280,12 @@ int __mdiobus_register(struct mii_bus *b
+ mutex_init(&bus->mdio_lock);
+
+ /* de-assert bus level PHY GPIO reset */
+- gpiod = devm_gpiod_get(&bus->dev, "reset", GPIOD_OUT_LOW);
++ gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR(gpiod)) {
+- err = PTR_ERR(gpiod);
+- if (err != -ENOENT) {
+- dev_err(&bus->dev,
+- "mii_bus %s couldn't get reset GPIO\n",
+- bus->id);
+- return err;
+- }
+- } else {
++ dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n",
++ bus->id);
++ return PTR_ERR(gpiod);
++ } else if (gpiod) {
+ bus->reset_gpiod = gpiod;
+
+ gpiod_set_value_cansleep(gpiod, 1);