aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSriram <srk@ti.com>2010-01-06 19:22:37 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-07 20:27:31 -0500
commit1ca518b64b4b5865b677f292322e893fa89997d4 (patch)
treef59d31d88810e021e66e073adb26d766f6ec204d
parent4d907069bc1b745f4abd4745c332d33098e733b8 (diff)
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: Sriramakrishnan <srk@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/davinci_emac.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 34e03104c3c1..33c4fe26178c 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -2711,6 +2711,8 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
2711 SET_ETHTOOL_OPS(ndev, &ethtool_ops); 2711 SET_ETHTOOL_OPS(ndev, &ethtool_ops);
2712 netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT); 2712 netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT);
2713 2713
2714 clk_enable(emac_clk);
2715
2714 /* register the network device */ 2716 /* register the network device */
2715 SET_NETDEV_DEV(ndev, &pdev->dev); 2717 SET_NETDEV_DEV(ndev, &pdev->dev);
2716 rc = register_netdev(ndev); 2718 rc = register_netdev(ndev);
@@ -2720,7 +2722,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
2720 goto netdev_reg_err; 2722 goto netdev_reg_err;
2721 } 2723 }
2722 2724
2723 clk_enable(emac_clk);
2724 2725
2725 /* MII/Phy intialisation, mdio bus registration */ 2726 /* MII/Phy intialisation, mdio bus registration */
2726 emac_mii = mdiobus_alloc(); 2727 emac_mii = mdiobus_alloc();
@@ -2760,6 +2761,7 @@ mdiobus_quit:
2760 2761
2761netdev_reg_err: 2762netdev_reg_err:
2762mdio_alloc_err: 2763mdio_alloc_err:
2764 clk_disable(emac_clk);
2763no_irq_res: 2765no_irq_res:
2764 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 2766 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
2765 release_mem_region(res->start, res->end - res->start + 1); 2767 release_mem_region(res->start, res->end - res->start + 1);