aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/macb.c
diff options
context:
space:
mode:
authorAndrew Victor <andrew@sanpeople.com>2007-02-07 16:40:44 +0100
committerJeff Garzik <jeff@garzik.org>2007-02-07 18:50:53 -0500
commit0cc8674f2be3078fb586add1900c7835c977f384 (patch)
treea27d665a8e859755f2c8974e5e90e83f6fea85c2 /drivers/net/macb.c
parent683349a3fae4896d91b1fe507ebbadb866587cd8 (diff)
AT91: MACB support
The Atmel MACB Ethernet peripheral is also integrated in the AT91SAM9260 and AT91SAM9263 processors. The differences from the AVR32 version are: * Single peripheral clock. * MII/RMII selection bit is inverted. * Clock enable bit. Original patch from Patrice Vilchez. Signed-off-by: Andrew Victor <andrew@sanpeople.com> Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/macb.c')
-rw-r--r--drivers/net/macb.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index 25b559b5d5e..5eb7a3536f2 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1046,6 +1046,14 @@ static int __devinit macb_probe(struct platform_device *pdev)
spin_lock_init(&bp->lock);
+#if defined(CONFIG_ARCH_AT91)
+ bp->pclk = clk_get(&pdev->dev, "macb_clk");
+ if (IS_ERR(bp->pclk)) {
+ dev_err(&pdev->dev, "failed to get macb_clk\n");
+ goto err_out_free_dev;
+ }
+ clk_enable(bp->pclk);
+#else
bp->pclk = clk_get(&pdev->dev, "pclk");
if (IS_ERR(bp->pclk)) {
dev_err(&pdev->dev, "failed to get pclk\n");
@@ -1059,6 +1067,7 @@ static int __devinit macb_probe(struct platform_device *pdev)
clk_enable(bp->pclk);
clk_enable(bp->hclk);
+#endif
bp->regs = ioremap(regs->start, regs->end - regs->start + 1);
if (!bp->regs) {
@@ -1119,9 +1128,17 @@ static int __devinit macb_probe(struct platform_device *pdev)
pdata = pdev->dev.platform_data;
if (pdata && pdata->is_rmii)
+#if defined(CONFIG_ARCH_AT91)
+ macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) );
+#else
macb_writel(bp, USRIO, 0);
+#endif
else
+#if defined(CONFIG_ARCH_AT91)
+ macb_writel(bp, USRIO, MACB_BIT(CLKEN));
+#else
macb_writel(bp, USRIO, MACB_BIT(MII));
+#endif
bp->tx_pending = DEF_TX_RING_PENDING;
@@ -1148,9 +1165,11 @@ err_out_free_irq:
err_out_iounmap:
iounmap(bp->regs);
err_out_disable_clocks:
+#ifndef CONFIG_ARCH_AT91
clk_disable(bp->hclk);
- clk_disable(bp->pclk);
clk_put(bp->hclk);
+#endif
+ clk_disable(bp->pclk);
err_out_put_pclk:
clk_put(bp->pclk);
err_out_free_dev:
@@ -1173,9 +1192,11 @@ static int __devexit macb_remove(struct platform_device *pdev)
unregister_netdev(dev);
free_irq(dev->irq, dev);
iounmap(bp->regs);
+#ifndef CONFIG_ARCH_AT91
clk_disable(bp->hclk);
- clk_disable(bp->pclk);
clk_put(bp->hclk);
+#endif
+ clk_disable(bp->pclk);
clk_put(bp->pclk);
free_netdev(dev);
platform_set_drvdata(pdev, NULL);