Skip to content

Commit

Permalink
net-next: stmmac: dwmac-sun8i: ensure the EPHY is properly reseted
Browse files Browse the repository at this point in the history
The EPHY may be already enabled by bootloaders which have Ethernet
capability (e.g. current U-Boot). Thus it should be reseted properly
before doing the enabling sequence in the dwmac-sun8i driver, otherwise
the EMAC reset process may fail if no cable is plugged, and then fail
the dwmac-sun8i probing.

Tested on Orange Pi PC, One and Zero. All the boards fail to have
dwmac-sun8i probed with "EMAC reset timeout" without cable plugged
before, and with this fix they're now all able to successfully probe the
EMAC without cable plugged and then use the connection after a cable is
hot-plugged in.

Fixes: 9f93ac8 ("net-next: stmmac: Add dwmac-sun8i")
Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Reviewed-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Acked-by: is not as formal as Signed-off-by:.  It is a record that the acker
Reviewed-by: is similar.
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Icenowy Zheng authored and David S. Miller committed Jun 5, 2017
1 parent 697dae1 commit 2f87849
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,11 @@ static int sun8i_dwmac_power_internal_phy(struct stmmac_priv *priv)
return ret;
}

/* Make sure the EPHY is properly reseted, as U-Boot may leave
* it at deasserted state, and thus it may fail to reset EMAC.
*/
reset_control_assert(gmac->rst_ephy);

ret = reset_control_deassert(gmac->rst_ephy);
if (ret) {
dev_err(priv->device, "Cannot deassert ephy\n");
Expand Down

0 comments on commit 2f87849

Please sign in to comment.