diff options
-rw-r--r-- | drivers/net/Kconfig | 2 | ||||
-rw-r--r-- | drivers/net/macb.c | 25 | ||||
-rw-r--r-- | drivers/net/macb.h | 8 |
3 files changed, 31 insertions, 4 deletions
diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig index a005517a4184..ad92b6a76ee6 100644 --- a/drivers/net/Kconfig +++ b/drivers/net/Kconfig | |||
@@ -190,7 +190,7 @@ config MII | |||
190 | 190 | ||
191 | config MACB | 191 | config MACB |
192 | tristate "Atmel MACB support" | 192 | tristate "Atmel MACB support" |
193 | depends on NET_ETHERNET && AVR32 | 193 | depends on NET_ETHERNET && (AVR32 || ARCH_AT91SAM9260 || ARCH_AT91SAM9263) |
194 | select MII | 194 | select MII |
195 | help | 195 | help |
196 | The Atmel MACB ethernet interface is found on many AT32 and AT91 | 196 | The Atmel MACB ethernet interface is found on many AT32 and AT91 |
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 25b559b5d5ed..5eb7a3536f29 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -1046,6 +1046,14 @@ static int __devinit macb_probe(struct platform_device *pdev) | |||
1046 | 1046 | ||
1047 | spin_lock_init(&bp->lock); | 1047 | spin_lock_init(&bp->lock); |
1048 | 1048 | ||
1049 | #if defined(CONFIG_ARCH_AT91) | ||
1050 | bp->pclk = clk_get(&pdev->dev, "macb_clk"); | ||
1051 | if (IS_ERR(bp->pclk)) { | ||
1052 | dev_err(&pdev->dev, "failed to get macb_clk\n"); | ||
1053 | goto err_out_free_dev; | ||
1054 | } | ||
1055 | clk_enable(bp->pclk); | ||
1056 | #else | ||
1049 | bp->pclk = clk_get(&pdev->dev, "pclk"); | 1057 | bp->pclk = clk_get(&pdev->dev, "pclk"); |
1050 | if (IS_ERR(bp->pclk)) { | 1058 | if (IS_ERR(bp->pclk)) { |
1051 | dev_err(&pdev->dev, "failed to get pclk\n"); | 1059 | dev_err(&pdev->dev, "failed to get pclk\n"); |
@@ -1059,6 +1067,7 @@ static int __devinit macb_probe(struct platform_device *pdev) | |||
1059 | 1067 | ||
1060 | clk_enable(bp->pclk); | 1068 | clk_enable(bp->pclk); |
1061 | clk_enable(bp->hclk); | 1069 | clk_enable(bp->hclk); |
1070 | #endif | ||
1062 | 1071 | ||
1063 | bp->regs = ioremap(regs->start, regs->end - regs->start + 1); | 1072 | bp->regs = ioremap(regs->start, regs->end - regs->start + 1); |
1064 | if (!bp->regs) { | 1073 | if (!bp->regs) { |
@@ -1119,9 +1128,17 @@ static int __devinit macb_probe(struct platform_device *pdev) | |||
1119 | 1128 | ||
1120 | pdata = pdev->dev.platform_data; | 1129 | pdata = pdev->dev.platform_data; |
1121 | if (pdata && pdata->is_rmii) | 1130 | if (pdata && pdata->is_rmii) |
1131 | #if defined(CONFIG_ARCH_AT91) | ||
1132 | macb_writel(bp, USRIO, (MACB_BIT(RMII) | MACB_BIT(CLKEN)) ); | ||
1133 | #else | ||
1122 | macb_writel(bp, USRIO, 0); | 1134 | macb_writel(bp, USRIO, 0); |
1135 | #endif | ||
1123 | else | 1136 | else |
1137 | #if defined(CONFIG_ARCH_AT91) | ||
1138 | macb_writel(bp, USRIO, MACB_BIT(CLKEN)); | ||
1139 | #else | ||
1124 | macb_writel(bp, USRIO, MACB_BIT(MII)); | 1140 | macb_writel(bp, USRIO, MACB_BIT(MII)); |
1141 | #endif | ||
1125 | 1142 | ||
1126 | bp->tx_pending = DEF_TX_RING_PENDING; | 1143 | bp->tx_pending = DEF_TX_RING_PENDING; |
1127 | 1144 | ||
@@ -1148,9 +1165,11 @@ err_out_free_irq: | |||
1148 | err_out_iounmap: | 1165 | err_out_iounmap: |
1149 | iounmap(bp->regs); | 1166 | iounmap(bp->regs); |
1150 | err_out_disable_clocks: | 1167 | err_out_disable_clocks: |
1168 | #ifndef CONFIG_ARCH_AT91 | ||
1151 | clk_disable(bp->hclk); | 1169 | clk_disable(bp->hclk); |
1152 | clk_disable(bp->pclk); | ||
1153 | clk_put(bp->hclk); | 1170 | clk_put(bp->hclk); |
1171 | #endif | ||
1172 | clk_disable(bp->pclk); | ||
1154 | err_out_put_pclk: | 1173 | err_out_put_pclk: |
1155 | clk_put(bp->pclk); | 1174 | clk_put(bp->pclk); |
1156 | err_out_free_dev: | 1175 | err_out_free_dev: |
@@ -1173,9 +1192,11 @@ static int __devexit macb_remove(struct platform_device *pdev) | |||
1173 | unregister_netdev(dev); | 1192 | unregister_netdev(dev); |
1174 | free_irq(dev->irq, dev); | 1193 | free_irq(dev->irq, dev); |
1175 | iounmap(bp->regs); | 1194 | iounmap(bp->regs); |
1195 | #ifndef CONFIG_ARCH_AT91 | ||
1176 | clk_disable(bp->hclk); | 1196 | clk_disable(bp->hclk); |
1177 | clk_disable(bp->pclk); | ||
1178 | clk_put(bp->hclk); | 1197 | clk_put(bp->hclk); |
1198 | #endif | ||
1199 | clk_disable(bp->pclk); | ||
1179 | clk_put(bp->pclk); | 1200 | clk_put(bp->pclk); |
1180 | free_netdev(dev); | 1201 | free_netdev(dev); |
1181 | platform_set_drvdata(pdev, NULL); | 1202 | platform_set_drvdata(pdev, NULL); |
diff --git a/drivers/net/macb.h b/drivers/net/macb.h index 27bf0ae0f0bb..b3bb2182edd1 100644 --- a/drivers/net/macb.h +++ b/drivers/net/macb.h | |||
@@ -200,7 +200,7 @@ | |||
200 | #define MACB_SOF_OFFSET 30 | 200 | #define MACB_SOF_OFFSET 30 |
201 | #define MACB_SOF_SIZE 2 | 201 | #define MACB_SOF_SIZE 2 |
202 | 202 | ||
203 | /* Bitfields in USRIO */ | 203 | /* Bitfields in USRIO (AVR32) */ |
204 | #define MACB_MII_OFFSET 0 | 204 | #define MACB_MII_OFFSET 0 |
205 | #define MACB_MII_SIZE 1 | 205 | #define MACB_MII_SIZE 1 |
206 | #define MACB_EAM_OFFSET 1 | 206 | #define MACB_EAM_OFFSET 1 |
@@ -210,6 +210,12 @@ | |||
210 | #define MACB_TX_PAUSE_ZERO_OFFSET 3 | 210 | #define MACB_TX_PAUSE_ZERO_OFFSET 3 |
211 | #define MACB_TX_PAUSE_ZERO_SIZE 1 | 211 | #define MACB_TX_PAUSE_ZERO_SIZE 1 |
212 | 212 | ||
213 | /* Bitfields in USRIO (AT91) */ | ||
214 | #define MACB_RMII_OFFSET 0 | ||
215 | #define MACB_RMII_SIZE 1 | ||
216 | #define MACB_CLKEN_OFFSET 1 | ||
217 | #define MACB_CLKEN_SIZE 1 | ||
218 | |||
213 | /* Bitfields in WOL */ | 219 | /* Bitfields in WOL */ |
214 | #define MACB_IP_OFFSET 0 | 220 | #define MACB_IP_OFFSET 0 |
215 | #define MACB_IP_SIZE 16 | 221 | #define MACB_IP_SIZE 16 |