ipq806x: Fix the 8033 mii init
This change is ported based on commit b83c56c4d4d974bdb3f9b0706b8fab3c667b2228
Change-Id: Ia4cdf26368d238ea3fcdb808f1446f010408a78c
Signed-off-by: Kathiravan T <kathirav@codeaurora.org>
diff --git a/drivers/net/ipq806x/ipq_gmac_eth.c b/drivers/net/ipq806x/ipq_gmac_eth.c
index be297d7..6caa4a2 100644
--- a/drivers/net/ipq806x/ipq_gmac_eth.c
+++ b/drivers/net/ipq806x/ipq_gmac_eth.c
@@ -881,6 +881,24 @@
}
}
+ ar8033_gpio_node = fdt_path_offset(gd->fdt_blob, "/ar8033_gpio");
+
+ if (ar8033_gpio_node != 0) {
+ bb_nodes[i] = malloc(sizeof(struct bitbang_nodes));
+ memset(bb_nodes[i], 0, sizeof(struct bitbang_nodes));
+
+ offset = fdt_first_subnode(gd->fdt_blob, ar8033_gpio_node);
+ bb_nodes[i]->mdio = fdtdec_get_uint(gd->fdt_blob, offset, "gpio", 0);
+
+ offset = fdt_next_subnode(gd->fdt_blob, offset);
+ bb_nodes[i]->mdc = fdtdec_get_uint(gd->fdt_blob, offset, "gpio", 0);
+
+ bb_miiphy_buses[i].priv = bb_nodes[i];
+ strlcpy(bb_miiphy_buses[i].name, "8033",
+ sizeof(bb_miiphy_buses[i].name));
+ miiphy_register(bb_miiphy_buses[i].name, bb_miiphy_read, bb_miiphy_write);
+ }
+
/* set the mac address in environment for unconfigured GMAC */
if (ret >= 0) {
for (; i < CONFIG_IPQ_NO_MACS; i++) {
@@ -901,24 +919,6 @@
}
}
- ar8033_gpio_node = fdt_path_offset(gd->fdt_blob, "/ar8033_gpio");
-
- if (ar8033_gpio_node != 0) {
- bb_nodes[i] = malloc(sizeof(struct bitbang_nodes));
- memset(bb_nodes[i], 0, sizeof(struct bitbang_nodes));
-
- offset = fdt_first_subnode(gd->fdt_blob, ar8033_gpio_node);
- bb_nodes[i]->mdio = fdtdec_get_uint(gd->fdt_blob, offset, "gpio", 0);
-
- offset = fdt_next_subnode(gd->fdt_blob, offset);
- bb_nodes[i]->mdc = fdtdec_get_uint(gd->fdt_blob, offset, "gpio", 0);
-
- bb_miiphy_buses[i].priv = bb_nodes[i];
- strncpy(bb_miiphy_buses[i].name, "8033",
- sizeof(bb_miiphy_buses[i].name));
- miiphy_register(bb_miiphy_buses[i].name, bb_miiphy_read, bb_miiphy_write);
- }
-
return 0;
failed: