diff options
author | Tom Rini <trini@konsulko.com> | 2019-04-11 14:29:22 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2019-04-11 14:29:22 -0400 |
commit | f95fdf237d8de9bf4dac4e4449015692c2283ac4 (patch) | |
tree | 385fc22a0f83526b1d5a900bbae6a5895af8ddbe /drivers/net/sh_eth.c | |
parent | 48ff1bc4f0a97c3291d0c87c2717fc1d79da5ef5 (diff) | |
parent | c8630bb09674e2b8496753929ac4d0a610583f1e (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-sh
- Various rmobile fixes
Diffstat (limited to 'drivers/net/sh_eth.c')
-rw-r--r-- | drivers/net/sh_eth.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c index 2e1123c488..4646f2ba4e 100644 --- a/drivers/net/sh_eth.c +++ b/drivers/net/sh_eth.c @@ -769,19 +769,9 @@ static int sh_ether_start(struct udevice *dev) struct sh_eth_dev *eth = &priv->shdev; int ret; - ret = clk_enable(&priv->clk); - if (ret) - return ret; - ret = sh_eth_init_common(eth, pdata->enetaddr); if (ret) - goto err_clk; - - ret = sh_eth_phy_config(dev); - if (ret) { - printf(SHETHER_NAME ": phy config timeout\n"); - goto err_start; - } + return ret; ret = sh_eth_start_common(eth); if (ret) @@ -792,17 +782,17 @@ static int sh_ether_start(struct udevice *dev) err_start: sh_eth_tx_desc_free(eth); sh_eth_rx_desc_free(eth); -err_clk: - clk_disable(&priv->clk); return ret; } static void sh_ether_stop(struct udevice *dev) { struct sh_ether_priv *priv = dev_get_priv(dev); + struct sh_eth_dev *eth = &priv->shdev; + struct sh_eth_info *port_info = ð->port_info[eth->port]; + phy_shutdown(port_info->phydev); sh_eth_stop(&priv->shdev); - clk_disable(&priv->clk); } static int sh_ether_probe(struct udevice *udev) @@ -853,8 +843,20 @@ static int sh_ether_probe(struct udevice *udev) eth->port_info[eth->port].iobase = (void __iomem *)(BASE_IO_ADDR + 0x800 * eth->port); + ret = clk_enable(&priv->clk); + if (ret) + goto err_mdio_register; + + ret = sh_eth_phy_config(udev); + if (ret) { + printf(SHETHER_NAME ": phy config timeout\n"); + goto err_phy_config; + } + return 0; +err_phy_config: + clk_disable(&priv->clk); err_mdio_register: mdio_free(mdiodev); return ret; @@ -866,6 +868,7 @@ static int sh_ether_remove(struct udevice *udev) struct sh_eth_dev *eth = &priv->shdev; struct sh_eth_info *port_info = ð->port_info[eth->port]; + clk_disable(&priv->clk); free(port_info->phydev); mdio_unregister(priv->bus); mdio_free(priv->bus); |