set the correct MAC on NSLU2

svn path=/dists/trunk/linux-2.6/; revision=7666
This commit is contained in:
Martin Michlmayr 2006-10-31 16:13:50 +00:00
parent c85d3b6b20
commit ce9d0ba5d2
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,57 @@
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c 2006-10-31 15:39:50.000000000 +0100
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c 2006-10-31 15:43:35.000000000 +0100
@@ -17,6 +17,7 @@
#include <linux/kernel.h>
#include <linux/serial.h>
#include <linux/serial_8250.h>
+#include <linux/mtd/mtd.h>
#include <linux/leds.h>
#include <asm/mach-types.h>
@@ -180,10 +181,46 @@
gpio_line_set(NSLU2_PO_GPIO, IXP4XX_GPIO_HIGH);
}
+/*
+ * When the RedBoot partition is added the MAC address is read from
+ * it.
+ */
+static void nslu2_flash_add(struct mtd_info *mtd) {
+ if (strcmp(mtd->name, "RedBoot") == 0) {
+ size_t retlen;
+ u_char mac[6];
+
+ /* The MAC is at a known offset... */
+ if (mtd->read(mtd, 0x3FFB0, 6, &retlen, mac) == 0 && retlen == 6) {
+ printk(KERN_INFO "NSLU2 MAC: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
+ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
+ memcpy(&plat_mac0.hwaddr, mac, 6);
+ } else {
+ printk(KERN_ERR "NSLU2 MAC: read failed\n");
+ }
+ }
+}
+
+/*
+ * Nothing to do on remove at present.
+ */
+static void nslu2_flash_remove(struct mtd_info *mtd) {
+}
+
+static struct mtd_notifier nslu2_flash_notifier = {
+ .add = nslu2_flash_add,
+ .remove = nslu2_flash_remove,
+};
+
static void __init nslu2_init(void)
{
ixp4xx_timer_freq = NSLU2_FREQ;
+ /* The flash has an ethernet MAC embedded in it which we need,
+ * that is all this notifier does.
+ */
+ register_mtd_user(&nslu2_flash_notifier);
+
ixp4xx_sys_init();
nslu2_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);

View File

@ -16,6 +16,7 @@
+ bugfix/net-r8169-no_mac_adress_change.patch
+ bugfix/x86-64-c3_timer.patch
+ features/arm/nslu2-setup-mac.patch
+ features/arm/nslu2-eth-mac.patch
+ features/arm/ixp4xx-0.2.1-driver.patch
+ features/arm/ixp4xx-net-driver-fix-qmgr.patch
+ features/arm/ixp4xx-net-driver-improve-mac-handling.patch