ipq806x: Reset all PHYs and wait for settling down
Allow some time for the phy reset to finish and ready for link negotiation.
Change-Id: I72474b7e55ed0d8a091b2b454fe9c3d24c80786b
Signed-off-by: Sham Muthayyan <smuthayy@codeaurora.org>
diff --git a/drivers/net/ipq806x/ipq_gmac_eth.c b/drivers/net/ipq806x/ipq_gmac_eth.c
index ade6092..877d9be 100644
--- a/drivers/net/ipq806x/ipq_gmac_eth.c
+++ b/drivers/net/ipq806x/ipq_gmac_eth.c
@@ -725,7 +725,7 @@
uchar *mac_addr;
char ethaddr[32] = "ethaddr";
char mac[64];
- int i;
+ int i, phy_idx;
int ret;
int gmac_gpio_node = 0, ar8033_gpio_node = 0, offset = 0;
memset(enet_addr, 0, sizeof(enet_addr));
@@ -867,9 +867,12 @@
strncpy(bb_miiphy_buses[i].name, gmac_cfg->phy_name,
sizeof(bb_miiphy_buses[i].name));
miiphy_register(bb_miiphy_buses[i].name, bb_miiphy_read, bb_miiphy_write);
- miiphy_write(bb_miiphy_buses[i].name,
- (uintptr_t)ipq_gmac_macs[i]->phy_address, PHY_CONTROL_REG,
- BMCR_RESET | AUTO_NEG_ENABLE);
+ for (phy_idx = 0; phy_idx < ipq_gmac_macs[i]->no_of_phys; phy_idx++) {
+ miiphy_write(bb_miiphy_buses[i].name,
+ ipq_gmac_macs[i]->phy_address[phy_idx], PHY_CONTROL_REG,
+ BMCR_RESET | AUTO_NEG_ENABLE);
+ mdelay(100);
+ }
}
eth_register(dev[i]);