Commit 1ca518b6 authored by Sriram's avatar Sriram Committed by David S. Miller

TI DaVinci EMAC: Handle emac module clock correctly.

In the driver probe function the emac module clock needs to
be enabled before calling register_netdev(). As soon as the
device is registered the driver get_stats function can be invoked
by the core - the module clock must be switched on to be able to
read from stats registers. Also explicitly call matching clk_disable
for failure conditions in probe function.
Signed-off-by: default avatarSriramakrishnan <srk@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4d907069
...@@ -2711,6 +2711,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -2711,6 +2711,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
SET_ETHTOOL_OPS(ndev, &ethtool_ops); SET_ETHTOOL_OPS(ndev, &ethtool_ops);
netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT);
clk_enable(emac_clk);
/* register the network device */ /* register the network device */
SET_NETDEV_DEV(ndev, &pdev->dev); SET_NETDEV_DEV(ndev, &pdev->dev);
rc = register_netdev(ndev); rc = register_netdev(ndev);
...@@ -2720,7 +2722,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -2720,7 +2722,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
goto netdev_reg_err; goto netdev_reg_err;
} }
clk_enable(emac_clk);
/* MII/Phy intialisation, mdio bus registration */ /* MII/Phy intialisation, mdio bus registration */
emac_mii = mdiobus_alloc(); emac_mii = mdiobus_alloc();
...@@ -2760,6 +2761,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev) ...@@ -2760,6 +2761,7 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
netdev_reg_err: netdev_reg_err:
mdio_alloc_err: mdio_alloc_err:
clk_disable(emac_clk);
no_irq_res: no_irq_res:
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, res->end - res->start + 1); release_mem_region(res->start, res->end - res->start + 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment