netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] TI DaVinci EMAC: Handle emac module clock correctly.
@ 2010-01-07 10:22 Sriramakrishnan
  2010-01-08  1:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Sriramakrishnan @ 2010-01-07 10:22 UTC (permalink / raw)
  To: netdev; +Cc: davinci-linux-open-source, Sriramakrishnan

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>
---
This patch has been generated against tip of net-2.6.git

 drivers/net/davinci_emac.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index 34e0310..33c4fe2 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)
 	SET_ETHTOOL_OPS(ndev, &ethtool_ops);
 	netif_napi_add(ndev, &priv->napi, emac_poll, EMAC_POLL_WEIGHT);
 
+	clk_enable(emac_clk);
+
 	/* register the network device */
 	SET_NETDEV_DEV(ndev, &pdev->dev);
 	rc = register_netdev(ndev);
@@ -2720,7 +2722,6 @@ static int __devinit davinci_emac_probe(struct platform_device *pdev)
 		goto netdev_reg_err;
 	}
 
-	clk_enable(emac_clk);
 
 	/* MII/Phy intialisation, mdio bus registration */
 	emac_mii = mdiobus_alloc();
@@ -2760,6 +2761,7 @@ mdiobus_quit:
 
 netdev_reg_err:
 mdio_alloc_err:
+	clk_disable(emac_clk);
 no_irq_res:
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	release_mem_region(res->start, res->end - res->start + 1);
-- 
1.6.2.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] TI DaVinci EMAC: Handle emac module clock correctly.
  2010-01-07 10:22 [PATCH] TI DaVinci EMAC: Handle emac module clock correctly Sriramakrishnan
@ 2010-01-08  1:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-01-08  1:28 UTC (permalink / raw)
  To: srk; +Cc: netdev, davinci-linux-open-source

From: Sriramakrishnan <srk@ti.com>
Date: Thu,  7 Jan 2010 15:52:37 +0530

> 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>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-01-08  1:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-07 10:22 [PATCH] TI DaVinci EMAC: Handle emac module clock correctly Sriramakrishnan
2010-01-08  1:28 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).