[PATCH V4 09/11] NET: mv643xx: Get clk from device tree.

Jason Cooper jason at lakedaemon.net
Sat Jan 26 15:50:18 EST 2013


From: Andrew Lunn <andrew at lunn.ch>

If we are passed a device tree node pointer, get the clock from it.
This avoids problems with con_id when using clk_get().

Signed-off-by: Andrew Lunn <andrew at lunn.ch>
Signed-off-by: Jason Cooper <jason at lakedaemon.net>
---
 drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 7048d7c..296beec 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2955,7 +2955,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
 	 */
 	mp->t_clk = 133000000;
 #if defined(CONFIG_HAVE_CLK)
-	mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
+	if (pdev->dev.of_node)
+		mp->clk = of_clk_get(pdev->dev.of_node, 0);
+	else
+		mp->clk = clk_get(&pdev->dev, (pdev->id ? "1" : "0"));
 	if (!IS_ERR(mp->clk)) {
 		clk_prepare_enable(mp->clk);
 		mp->t_clk = clk_get_rate(mp->clk);
-- 
1.8.1.1




More information about the linux-arm-kernel mailing list