kernel: add OF support to rtl8355 driver
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		| @@ -20,6 +20,7 @@ | |||||||
| #include <linux/of_gpio.h> | #include <linux/of_gpio.h> | ||||||
| #include <linux/rtl8366.h> | #include <linux/rtl8366.h> | ||||||
| #include <linux/version.h> | #include <linux/version.h> | ||||||
|  | #include <linux/of_mdio.h> | ||||||
|  |  | ||||||
| #ifdef CONFIG_RTL8366_SMI_DEBUG_FS | #ifdef CONFIG_RTL8366_SMI_DEBUG_FS | ||||||
| #include <linux/debugfs.h> | #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) | static int rtl8366_smi_mii_init(struct rtl8366_smi *smi) | ||||||
| { | { | ||||||
| 	int ret; | 	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(); | 	smi->mii_bus = mdiobus_alloc(); | ||||||
| 	if (smi->mii_bus == NULL) { | 	if (smi->mii_bus == NULL) { | ||||||
| @@ -939,6 +945,9 @@ static int rtl8366_smi_mii_init(struct rtl8366_smi *smi) | |||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | 	if (np) | ||||||
|  | 		ret = of_mdiobus_register(smi->mii_bus, np); | ||||||
|  | 	else | ||||||
| 		ret = mdiobus_register(smi->mii_bus); | 		ret = mdiobus_register(smi->mii_bus); | ||||||
| 	if (ret) | 	if (ret) | ||||||
| 		goto err_free; | 		goto err_free; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin