aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ath79/files
diff options
context:
space:
mode:
authorChuanhong Guo <gch981213@gmail.com>2019-01-09 22:02:09 +0800
committerDaniel Golle <daniel@makrotopia.org>2019-03-05 03:02:34 +0100
commit596a5325cd7255faa94aa5e13ae97a6ee64f0bd2 (patch)
tree4ad3117cfc2562225401c168b6d83385450077c5 /target/linux/ath79/files
parentf92bbdcc93d9c25d14112da57c5aa63169a4840f (diff)
downloadupstream-596a5325cd7255faa94aa5e13ae97a6ee64f0bd2.tar.gz
upstream-596a5325cd7255faa94aa5e13ae97a6ee64f0bd2.tar.bz2
upstream-596a5325cd7255faa94aa5e13ae97a6ee64f0bd2.zip
ath79: ag71xx: register mdio using of_platform_populate
remove the hacky checking of "simple-mfd" compatible also add some comments explaining that piece of code. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target/linux/ath79/files')
-rw-r--r--target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
index 83f41196a1..bf9239163d 100644
--- a/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
+++ b/target/linux/ath79/files/drivers/net/ethernet/atheros/ag71xx/ag71xx_main.c
@@ -1321,7 +1321,6 @@ static const struct net_device_ops ag71xx_netdev_ops = {
static int ag71xx_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
- struct device_node *mdio_node;
struct net_device *dev;
struct resource *res;
struct ag71xx *ag;
@@ -1500,10 +1499,18 @@ static int ag71xx_probe(struct platform_device *pdev)
ag71xx_dump_regs(ag);
- if (!of_device_is_compatible(np, "simple-mfd")) {
- mdio_node = of_get_child_by_name(np, "mdio-bus");
- if (!IS_ERR(mdio_node))
- of_platform_device_create(mdio_node, NULL, NULL);
+ /*
+ * populate current node to register mdio-bus as a subdevice.
+ * the mdio bus works independently on ar7241 and later chips
+ * and we need to load mdio1 before gmac0, which can be done
+ * by adding a "simple-mfd" compatible to gmac node. The
+ * following code checks OF_POPULATED_BUS flag before populating
+ * to avoid duplicated population.
+ */
+ if (!of_node_check_flag(np, OF_POPULATED_BUS)) {
+ err = of_platform_populate(np, NULL, NULL, &pdev->dev);
+ if (err)
+ return err;
}
err = ag71xx_phy_connect(ag);