summaryrefslogtreecommitdiff
path: root/packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch
diff options
context:
space:
mode:
authorRod Whitby <rod@whitby.id.au>2006-04-14 06:39:54 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-04-14 06:39:54 +0000
commitc9cadd074271be3812dfc501d98ae93df22d7bd0 (patch)
tree5817ca1378e5e20cae845cfe0dfe48764529e6c5 /packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch
parent5c26c1237a294e04c6a8542d11d15a4200f70a8a (diff)
ixp4xx-kernel: Removed obsolete patches, and refreshed patchset from the nslu2-linux kernel CVS repo.
Diffstat (limited to 'packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch')
-rw-r--r--packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch85
1 files changed, 85 insertions, 0 deletions
diff --git a/packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch b/packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch
new file mode 100644
index 0000000000..59715a024e
--- /dev/null
+++ b/packages/linux/ixp4xx-kernel/2.6.16/92-nas100d-mac.patch
@@ -0,0 +1,85 @@
+ arch/arm/mach-ixp4xx/nas100d-setup.c | 64 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 64 insertions(+)
+
+--- linux-ixp4xx.orig/arch/arm/mach-ixp4xx/nas100d-setup.c 2006-03-27 03:03:47.000000000 +0200
++++ linux-ixp4xx/arch/arm/mach-ixp4xx/nas100d-setup.c 2006-03-27 03:37:23.000000000 +0200
+@@ -15,6 +15,9 @@
+ #include <linux/kernel.h>
+ #include <linux/serial.h>
+ #include <linux/serial_8250.h>
++#include <linux/mtd/mtd.h>
++#include <linux/netdevice.h>
++#include <linux/etherdevice.h>
+
+ #include <asm/mach-types.h>
+ #include <asm/mach/arch.h>
+@@ -110,8 +113,69 @@ static void nas100d_power_off(void)
+ gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
+ }
+
++/*
++ * When the RedBoot config partition is added the MAC address is read from
++ * it.
++ */
++static struct sockaddr mac;
++
++static void nas100d_flash_add(struct mtd_info *mtd) {
++ if (strcmp(mtd->name, "RedBoot config") == 0) {
++ size_t retlen;
++ int err;
++ /* the mac addr is at a known offset */
++ err = mtd->read(mtd, 0x0FD8, 6, &retlen, (u8 *) &mac.sa_data);
++ if (err != 0 || retlen != 6)
++ printk(KERN_ERR "nas100d: mac addr read failed\n");
++ else
++ printk(KERN_INFO
++ "nas100d: mac %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
++ mac.sa_data[0], mac.sa_data[1], mac.sa_data[2],
++ mac.sa_data[3], mac.sa_data[4], mac.sa_data[5]);
++ }
++}
++
++/*
++ * Nothing to do on remove at present.
++ */
++static void nas100d_flash_remove(struct mtd_info *mtd) {
++}
++
++static struct mtd_notifier nas100d_flash_notifier = {
++ .add = nas100d_flash_add,
++ .remove = nas100d_flash_remove,
++};
++
++static int nas100d_netdev_event(struct notifier_block *this,
++ unsigned long event, void *ptr)
++{
++ struct net_device *dev = ptr;
++
++ /* identify the ixp4xx eth, port 1 */
++ if (dev->dev_addr[1] != 0x02 || dev->dev_addr[2] != 0xB3
++ || dev->dev_addr[5] != 0x01)
++ return NOTIFY_DONE;
++
++ if (event == NETDEV_REGISTER && is_valid_ether_addr(mac.sa_data)) {
++ mac.sa_family = dev->type;
++ dev_set_mac_address(dev, &mac);
++ }
++
++ return NOTIFY_DONE;
++}
++
++static struct notifier_block nas100d_netdev_notifier = {
++ .notifier_call = nas100d_netdev_event,
++};
++
+ static void __init nas100d_init(void)
+ {
++ /* The flash has an ethernet MAC embedded in it which we need,
++ * that is all this notifier does.
++ */
++ register_mtd_user(&nas100d_flash_notifier);
++ register_netdevice_notifier(&nas100d_netdev_notifier);
++
+ ixp4xx_sys_init();
+
+ /* gpio 14 and 15 are _not_ clocks */