From nobody Mon Sep 17 00:00:00 2001
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
Date: Thu, 29 Jun 2006 15:02:49 +0200
Subject: [PATCH] Atmel MACB ethernet driver
This is a network device driver for the Atmel MACB interface, which
is present on the AT32AP7000 device from Atmel. I think it's basically
the same as the EMAC interface on AT91, so it should possibly be
merged with the at91_ether driver some time in the future. At the
moment, however, the at91_ether driver has quite a lot of at91-
specific dependencies so it's hard to reuse on AVR32.
This is basically the same patch as the one distributed with the
AT32STK1000 BSP version 1.0, converted to use platform_device and
struct clk instead of at32_device.
---
drivers/net/Kconfig | 11
drivers/net/Makefile | 2
drivers/net/macb.c | 1159 +++++++++++++++++++++++++++++++++++++++++++++++++++
drivers/net/macb.h | 387 +++++++++++++++++
4 files changed, 1559 insertions(+)
Index: linux-2.6.18-avr32/drivers/net/Kconfig
===================================================================
--- linux-2.6.18-avr32.orig/drivers/net/Kconfig 2006-11-02 14:16:07.000000000 +0100
+++ linux-2.6.18-avr32/drivers/net/Kconfig 2006-11-02 14:17:29.000000000 +0100
@@ -185,6 +185,17 @@ config MII
or internal device. It is safe to say Y or M here even if your
ethernet card lack MII.
+config MACB
+ tristate "Atmel MACB support"
+ depends on NET_ETHERNET && AVR32
+ select MII
+ help
+ The Atmel MACB ethernet interface is found on many AT32 and AT91
+ parts. Say Y to include support for the MACB chip.
+
+ To compile this driver as a module, choose M here: the module
+ will be called macb.
+
source "drivers/net/arm/Kconfig"
config MACE
Index: linux-2.6.18-avr32/drivers/net/Makefile
===================================================================
--- linux-2.6.18-avr32.orig/drivers/net/Makefile 2006-11-02 14:16:07.000000000 +0100
+++ linux-2.6.18-avr32/drivers/net/Makefile 2006-11-02 14:17:29.000000000 +0100
@@ -202,6 +202,8 @@ obj-$(CONFIG_SMC911X) += smc911x.o
obj-$(CONFIG_DM9000) += dm9000.o
obj-$(CONFIG_FEC_8XX) += fec_8xx/
+obj-$(CONFIG_MACB) += macb.o
+
obj-$(CONFIG_ARM) += arm/
obj-$(CONFIG_DEV_APPLETALK) += appletalk/
obj-$(CONFIG_TR) += tokenring/
Index: linux-2.6.18-avr32/drivers/net/macb.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6.18-avr32/drivers/net/macb.c 2006-11-02 16:33:48.000000000 +0100
@@ -0,0 +1,1159 @@
+/*
+ * Atmel MACB Ethernet Controller driver
+ *
+ * Copyright (C) 2004-2006 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/clk.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/slab.h>
+#include <linux/init.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/mii.h>
+#include <linux/mutex.h>
+#include <linux/dma-mapping.h>
+#include <linux/ethtool.h>
+#include <linux/platform_device.h>
+
+#include <asm/arch/board.h>
+
+#include "macb.h"
+
+#define to_net_dev(class) container_of(class, struct net_device, class
|