- 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;