Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46599
b: refs/heads/master
c: 0cc8674
h: refs/heads/master
i:
  46597: 598b3b5
  46595: 4d18989
  46591: 94c827b
v: v3
  • Loading branch information
Andrew Victor authored and Jeff Garzik committed Feb 7, 2007
1 parent 650f29b commit 3f2610f
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 683349a3fae4896d91b1fe507ebbadb866587cd8
refs/heads/master: 0cc8674f2be3078fb586add1900c7835c977f384
2 changes: 1 addition & 1 deletion trunk/drivers/net/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ config MII

config MACB
tristate "Atmel MACB support"
depends on NET_ETHERNET && AVR32
depends on NET_ETHERNET && (AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263)
select MII
help
The Atmel MACB ethernet interface is found on many AT32 and AT91
Expand Down
25 changes: 23 additions & 2 deletions trunk/drivers/net/macb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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) {
Expand Down Expand Up @@ -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;

Expand All @@ -1148,9 +1165,11 @@ static int __devinit macb_probe(struct platform_device *pdev)
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:
Expand All @@ -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);
Expand Down
8 changes: 7 additions & 1 deletion trunk/drivers/net/macb.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@
#define MACB_SOF_OFFSET 30
#define MACB_SOF_SIZE 2

/* Bitfields in USRIO */
/* Bitfields in USRIO (AVR32) */
#define MACB_MII_OFFSET 0
#define MACB_MII_SIZE 1
#define MACB_EAM_OFFSET 1
Expand All @@ -210,6 +210,12 @@
#define MACB_TX_PAUSE_ZERO_OFFSET 3
#define MACB_TX_PAUSE_ZERO_SIZE 1

/* Bitfields in USRIO (AT91) */
#define MACB_RMII_OFFSET 0
#define MACB_RMII_SIZE 1
#define MACB_CLKEN_OFFSET 1
#define MACB_CLKEN_SIZE 1

/* Bitfields in WOL */
#define MACB_IP_OFFSET 0
#define MACB_IP_SIZE 16
Expand Down

0 comments on commit 3f2610f

Please sign in to comment.