summaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorJohn Crispin <john@phrozen.org>2018-05-06 10:15:48 +0200
committerJohn Crispin <john@phrozen.org>2018-05-07 08:06:51 +0200
commit3dc523f232ff01d31d59345f5fa6de508d5059ef (patch)
tree65f13ac2fd36f1ef1f1ac6ee5c6cc1922498433e /target/linux
parented00387dc550695f2b9d690b7a8e5a1567e175ee (diff)
downloadopenwrt-3dc523f232ff01d31d59345f5fa6de508d5059ef.tar.gz
openwrt-3dc523f232ff01d31d59345f5fa6de508d5059ef.tar.bz2
openwrt-3dc523f232ff01d31d59345f5fa6de508d5059ef.zip
kernel: add OF support to rtl8355 driver
Signed-off-by: John Crispin <john@phrozen.org>
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366_smi.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
index ae045970db..0873224225 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366_smi.c
@@ -20,6 +20,7 @@
#include <linux/of_gpio.h>
#include <linux/rtl8366.h>
#include <linux/version.h>
+#include <linux/of_mdio.h>
#ifdef CONFIG_RTL8366_SMI_DEBUG_FS
#include <linux/debugfs.h>
@@ -915,6 +916,11 @@ static inline void rtl8366_debugfs_remove(struct rtl8366_smi *smi) {}
static int rtl8366_smi_mii_init(struct rtl8366_smi *smi)
{
int ret;
+ struct device_node *np = NULL;
+
+#ifdef CONFIG_OF
+ np = of_get_child_by_name(smi->parent->of_node, "mdio-bus");
+#endif
smi->mii_bus = mdiobus_alloc();
if (smi->mii_bus == NULL) {
@@ -939,7 +945,10 @@ static int rtl8366_smi_mii_init(struct rtl8366_smi *smi)
}
#endif
- ret = mdiobus_register(smi->mii_bus);
+ if (np)
+ ret = of_mdiobus_register(smi->mii_bus, np);
+ else
+ ret = mdiobus_register(smi->mii_bus);
if (ret)
goto err_free;