summaryrefslogtreecommitdiff
path: root/packages/linux/ixp4xx-kernel/2.6.15
diff options
context:
space:
mode:
authorJohn Bowler <jbowler@nslu2-linux.org>2006-01-16 09:53:12 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-01-16 09:53:12 +0000
commitf2cfb2628d56ad31d4fe97a08b1012c252109b90 (patch)
tree6a7f8709276df3782879b3b0f02ed6a1699c4882 /packages/linux/ixp4xx-kernel/2.6.15
parent6d6f449a77592d066856c916b660cd52c54f5147 (diff)
parentf99c03dff8ea114ab0bfe297a391a0fa90aa9922 (diff)
merge of 5ea9ec229c4d406638d5639fade5d53798bc6556
and bc3350438c52d7c9d7d4f8eb5b38a213796269cb
Diffstat (limited to 'packages/linux/ixp4xx-kernel/2.6.15')
-rw-r--r--packages/linux/ixp4xx-kernel/2.6.15/11-mtdpart-redboot-config-byteswap.patch74
-rw-r--r--packages/linux/ixp4xx-kernel/2.6.15/40-rtc-class.patch253
-rw-r--r--packages/linux/ixp4xx-kernel/2.6.15/45-eeprom-notifier.patch184
-rw-r--r--packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch96
4 files changed, 519 insertions, 88 deletions
diff --git a/packages/linux/ixp4xx-kernel/2.6.15/11-mtdpart-redboot-config-byteswap.patch b/packages/linux/ixp4xx-kernel/2.6.15/11-mtdpart-redboot-config-byteswap.patch
new file mode 100644
index 0000000000..e258567462
--- /dev/null
+++ b/packages/linux/ixp4xx-kernel/2.6.15/11-mtdpart-redboot-config-byteswap.patch
@@ -0,0 +1,74 @@
+A more robust test for swapped RedBoot FIS directory partitions. This
+changes the test to check the flash_base value for the FIS directory,
+since we know where the FIS directory base is we can work out whether
+the flash address stored in the directory itself is byte swapped under
+most circumstances. If the value is 0 the directory is at the start
+of the flash and the test fails. In this case the fallback is to use
+the original test made slightly more robust.
+
+Signed-off-by: John Bowler <jbowler@acm.org>
+
+--- linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/drivers/mtd/redboot.c 1970-01-01 00:00:00.000000000 +0000
+@@ -91,14 +91,41 @@ static int parse_redboot_partitions(stru
+ }
+ if (!memcmp(buf[i].name, "FIS directory", 14)) {
+ /* This is apparently the FIS directory entry for the
+- * FIS directory itself. The FIS directory size is
+- * one erase block; if the buf[i].size field is
+- * swab32(erasesize) then we know we are looking at
+- * a byte swapped FIS directory - swap all the entries!
+- * (NOTE: this is 'size' not 'data_length'; size is
+- * the full size of the entry.)
++ * FIS directory itself. To discover whether the entries
++ * in this are native byte sex or byte swapped look at
++ * the flash_base field - we know the FIS directory is
++ * at 'offset' within the flash.
+ */
+- if (swab32(buf[i].size) == master->erasesize) {
++ int maybe_native, maybe_swapped;
++ if (fis_origin != 0) {
++ maybe_native =
++ buf[i].flash_base == fis_origin + offset;
++ maybe_swapped =
++ swab32(buf[i].flash_base) == fis_origin + offset;
++ } else if (offset != 0 || buf[i].flash_base != 0) {
++ maybe_native =
++ (buf[i].flash_base & (master->size-1)) == offset;
++ maybe_swapped =
++ (swab32(buf[i].flash_base) & (master->size-1)) == offset;
++ } else {
++ /* The FIS directory is at the start of the flash and
++ * the 'flash_base' field is 0. The critical case is when
++ * we are booting off this flash, but then we don't expect
++ * this because the boot loader is pretty much always at
++ * the start! Since the FIS directory is always less than
++ * or equal to one erase block do the following:
++ */
++ maybe_native = buf[i].size <= master->erasesize;
++ maybe_swapped = swab32(buf[i].size) <= master->erasesize;
++ }
++
++ if (maybe_native && maybe_swapped)
++ printk(KERN_WARNING "RedBoot directory 0x%lx(0x%lx) assumed native\n",
++ buf[i].flash_base, buf[i].size);
++ else if (!maybe_native && !maybe_swapped)
++ printk(KERN_ERR "RedBoot directory 0x%lx(0x%lx) forced native\n",
++ buf[i].flash_base, buf[i].size);
++ else if (maybe_swapped) {
+ int j;
+ for (j = 0; j < numslots && buf[j].name[0] != 0xff; ++j) {
+ /* The unsigned long fields were written with the
+@@ -112,7 +139,11 @@ static int parse_redboot_partitions(stru
+ swab32s(&buf[j].desc_cksum);
+ swab32s(&buf[j].file_cksum);
+ }
+- }
++ printk(KERN_NOTICE "RedBoot directory 0x%lx(0x%lx) swapped\n",
++ buf[i].flash_base, buf[i].size);
++ } else
++ printk(KERN_NOTICE "RedBoot directory 0x%lx(0x%lx) native\n",
++ buf[i].flash_base, buf[i].size);
+ break;
+ }
+ }
diff --git a/packages/linux/ixp4xx-kernel/2.6.15/40-rtc-class.patch b/packages/linux/ixp4xx-kernel/2.6.15/40-rtc-class.patch
index 8e0380bfe5..e10998f8d2 100644
--- a/packages/linux/ixp4xx-kernel/2.6.15/40-rtc-class.patch
+++ b/packages/linux/ixp4xx-kernel/2.6.15/40-rtc-class.patch
@@ -1,5 +1,5 @@
---- linux-nslu2.orig/include/linux/rtc.h 2006-01-03 15:31:18.000000000 +0100
-+++ linux-nslu2/include/linux/rtc.h 2006-01-03 15:34:24.000000000 +0100
+--- linux-nslu2.orig/include/linux/rtc.h 2006-01-08 18:54:58.000000000 +0100
++++ linux-nslu2/include/linux/rtc.h 2006-01-08 18:55:19.000000000 +0100
@@ -91,8 +91,81 @@ struct rtc_pll_info {
#define RTC_PLL_GET _IOR('p', 0x11, struct rtc_pll_info) /* Get PLL correction */
#define RTC_PLL_SET _IOW('p', 0x12, struct rtc_pll_info) /* Set PLL correction */
@@ -38,8 +38,8 @@
+{
+ int id;
+ struct module *owner;
-+ struct rw_semaphore lock;
+ struct class_device class_dev;
++ struct semaphore ops_lock;
+ struct rtc_class_ops *ops;
+ char name[RTC_DEVICE_NAME_SIZE];
+
@@ -82,8 +82,8 @@
typedef struct rtc_task {
void (*func)(void *private_data);
void *private_data;
---- linux-nslu2.orig/drivers/Kconfig 2006-01-03 15:31:19.000000000 +0100
-+++ linux-nslu2/drivers/Kconfig 2006-01-04 01:27:31.000000000 +0100
+--- linux-nslu2.orig/drivers/Kconfig 2006-01-08 18:54:58.000000000 +0100
++++ linux-nslu2/drivers/Kconfig 2006-01-08 18:55:19.000000000 +0100
@@ -66,4 +66,6 @@ source "drivers/infiniband/Kconfig"
source "drivers/sn/Kconfig"
@@ -91,8 +91,8 @@
+source "drivers/rtc/Kconfig"
+
endmenu
---- linux-nslu2.orig/drivers/Makefile 2006-01-03 15:33:32.000000000 +0100
-+++ linux-nslu2/drivers/Makefile 2006-01-04 01:27:31.000000000 +0100
+--- linux-nslu2.orig/drivers/Makefile 2006-01-08 18:54:58.000000000 +0100
++++ linux-nslu2/drivers/Makefile 2006-01-08 18:55:19.000000000 +0100
@@ -54,6 +54,7 @@ obj-$(CONFIG_USB_GADGET) += usb/gadget/
obj-$(CONFIG_GAMEPORT) += input/gameport/
obj-$(CONFIG_INPUT) += input/
@@ -102,8 +102,8 @@
obj-$(CONFIG_W1) += w1/
obj-$(CONFIG_HWMON) += hwmon/
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/class.c 2006-01-03 15:45:19.000000000 +0100
-@@ -0,0 +1,141 @@
++++ linux-nslu2/drivers/rtc/class.c 2006-01-08 18:55:19.000000000 +0100
+@@ -0,0 +1,143 @@
+/*
+ * RTC subsystem, base class
+ *
@@ -178,7 +178,7 @@
+ rtc->class_dev.class = rtc_class;
+ rtc->class_dev.release = rtc_device_release;
+
-+ init_rwsem(&rtc->lock);
++ init_MUTEX(&rtc->ops_lock);
+ spin_lock_init(&rtc->irq_lock);
+ spin_lock_init(&rtc->irq_task_lock);
+
@@ -212,7 +212,9 @@
+ */
+void rtc_device_unregister(struct rtc_device *rtc)
+{
-+ down_write(&rtc->lock);
++ down(&rtc->ops_lock);
++ rtc->ops = NULL;
++ up(&rtc->ops_lock);
+ class_device_unregister(&rtc->class_dev);
+}
+EXPORT_SYMBOL_GPL(rtc_device_unregister);
@@ -246,7 +248,7 @@
+MODULE_DESCRIPTION("RTC class support");
+MODULE_LICENSE("GPL");
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/Kconfig 2006-01-04 01:27:21.000000000 +0100
++++ linux-nslu2/drivers/rtc/Kconfig 2006-01-09 04:17:02.000000000 +0100
@@ -0,0 +1,93 @@
+#
+# RTC class/drivers configuration
@@ -342,7 +344,7 @@
+
+endmenu
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/Makefile 2006-01-04 01:27:21.000000000 +0100
++++ linux-nslu2/drivers/rtc/Makefile 2006-01-09 04:17:02.000000000 +0100
@@ -0,0 +1,15 @@
+#
+# Makefile for RTC class/drivers.
@@ -360,8 +362,8 @@
+obj-$(CONFIG_RTC_DRV_DS1672) += rtc-ds1672.o
+
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/interface.c 2006-01-03 15:34:24.000000000 +0100
-@@ -0,0 +1,189 @@
++++ linux-nslu2/drivers/rtc/interface.c 2006-01-09 03:39:33.000000000 +0100
+@@ -0,0 +1,232 @@
+/*
+ * RTC subsystem, interface functions
+ *
@@ -381,13 +383,22 @@
+
+int rtc_read_time(struct class_device *class_dev, struct rtc_time *tm)
+{
-+ int err = -EINVAL;
-+ struct rtc_class_ops *ops = to_rtc_device(class_dev)->ops;
++ int err;
++ struct rtc_device *rtc = to_rtc_device(class_dev);
++
++ if ((err = down_interruptible(&rtc->ops_lock)))
++ return err;
+
-+ if (ops->read_time) {
++ if (!rtc->ops)
++ err = -ENODEV;
++ else if (!rtc->ops->read_time)
++ err = -EINVAL;
++ else {
+ memset(tm, 0, sizeof(struct rtc_time));
-+ err = ops->read_time(class_dev->dev, tm);
++ err = rtc->ops->read_time(class_dev->dev, tm);
+ }
++
++ up(&rtc->ops_lock);
+ return err;
+}
+EXPORT_SYMBOL(rtc_read_time);
@@ -395,36 +406,64 @@
+int rtc_set_time(struct class_device *class_dev, struct rtc_time *tm)
+{
+ int err;
-+ struct rtc_class_ops *ops = to_rtc_device(class_dev)->ops;
++ struct rtc_device *rtc = to_rtc_device(class_dev);
+
-+ err = rtc_valid_tm(tm);
-+ if (err == 0 && ops->set_time)
-+ err = ops->set_time(class_dev->dev, tm);
++ if ((err = rtc_valid_tm(tm)) != 0)
++ return err;
++
++ if ((err = down_interruptible(&rtc->ops_lock)))
++ return err;
+
++ if (!rtc->ops)
++ err = -ENODEV;
++ else if (!rtc->ops->set_time)
++ err = -EINVAL;
++ else
++ err = rtc->ops->set_time(class_dev->dev, tm);
++
++ up(&rtc->ops_lock);
+ return err;
+}
+EXPORT_SYMBOL(rtc_set_time);
+
+int rtc_read_alarm(struct class_device *class_dev, struct rtc_wkalrm *alarm)
+{
-+ struct rtc_class_ops *ops = to_rtc_device(class_dev)->ops;
-+ int err = -EINVAL;
++ int err;
++ struct rtc_device *rtc = to_rtc_device(class_dev);
++
++ if ((err = down_interruptible(&rtc->ops_lock)))
++ return err;
+
-+ if (ops->read_alarm) {
++ if (rtc->ops == NULL)
++ err = -ENODEV;
++ else if (!rtc->ops->read_alarm)
++ err = -EINVAL;
++ else {
+ memset(alarm, 0, sizeof(struct rtc_wkalrm));
-+ err = ops->read_alarm(class_dev->dev, alarm);
++ err = rtc->ops->read_alarm(class_dev->dev, alarm);
+ }
++
++ up(&rtc->ops_lock);
+ return err;
+}
+EXPORT_SYMBOL(rtc_read_alarm);
+
+int rtc_set_alarm(struct class_device *class_dev, struct rtc_wkalrm *alarm)
+{
-+ int err = -EINVAL;
-+ struct rtc_class_ops *ops = to_rtc_device(class_dev)->ops;
++ int err;
++ struct rtc_device *rtc = to_rtc_device(class_dev);
+
-+ if (ops->set_alarm)
-+ err = ops->set_alarm(class_dev->dev, alarm);
++ if ((err = down_interruptible(&rtc->ops_lock)))
++ return err;
++
++ if (!rtc->ops)
++ err = -ENODEV;
++ else if (!rtc->ops->set_alarm)
++ err = -EINVAL;
++ else
++ err = rtc->ops->set_alarm(class_dev->dev, alarm);
++
++ up(&rtc->ops_lock);
+ return err;
+}
+EXPORT_SYMBOL(rtc_set_alarm);
@@ -460,6 +499,11 @@
+ break;
+ }
+ }
++
++ if (class_dev) {
++ if (!try_module_get(to_rtc_device(class_dev)->owner))
++ class_dev = NULL;
++ }
+ up(&rtc_class->sem);
+
+ return class_dev;
@@ -468,6 +512,7 @@
+
+void rtc_close(struct class_device *class_dev)
+{
++ module_put(to_rtc_device(class_dev)->owner);
+}
+EXPORT_SYMBOL(rtc_close);
+
@@ -552,7 +597,7 @@
+
+}
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/utils.c 2006-01-03 15:34:24.000000000 +0100
++++ linux-nslu2/drivers/rtc/utils.c 2006-01-08 18:55:19.000000000 +0100
@@ -0,0 +1,97 @@
+/*
+ * RTC subsystem, utility functions
@@ -651,8 +696,8 @@
+ return 0;
+}
+EXPORT_SYMBOL(rtc_tm_to_time);
---- linux-nslu2.orig/arch/arm/Kconfig 2006-01-04 01:27:04.000000000 +0100
-+++ linux-nslu2/arch/arm/Kconfig 2006-01-04 01:27:31.000000000 +0100
+--- linux-nslu2.orig/arch/arm/Kconfig 2006-01-09 03:36:04.000000000 +0100
++++ linux-nslu2/arch/arm/Kconfig 2006-01-09 03:39:50.000000000 +0100
@@ -748,6 +748,8 @@ source "drivers/usb/Kconfig"
source "drivers/mmc/Kconfig"
@@ -662,8 +707,8 @@
endmenu
source "fs/Kconfig"
---- linux-nslu2.orig/arch/arm/common/rtctime.c 2006-01-04 01:27:04.000000000 +0100
-+++ linux-nslu2/arch/arm/common/rtctime.c 2006-01-04 01:27:09.000000000 +0100
+--- linux-nslu2.orig/arch/arm/common/rtctime.c 2006-01-09 03:36:04.000000000 +0100
++++ linux-nslu2/arch/arm/common/rtctime.c 2006-01-09 03:39:50.000000000 +0100
@@ -40,89 +40,6 @@ static struct rtc_ops *rtc_ops;
#define rtc_epoch 1900UL
@@ -852,8 +897,8 @@
p += sprintf(p, "alrm_time\t: ");
if ((unsigned int)alrm.time.tm_hour <= 24)
p += sprintf(p, "%02d:", alrm.time.tm_hour);
---- linux-nslu2.orig/include/asm-arm/rtc.h 2006-01-04 01:27:04.000000000 +0100
-+++ linux-nslu2/include/asm-arm/rtc.h 2006-01-04 01:27:09.000000000 +0100
+--- linux-nslu2.orig/include/asm-arm/rtc.h 2006-01-09 03:36:04.000000000 +0100
++++ linux-nslu2/include/asm-arm/rtc.h 2006-01-09 03:39:50.000000000 +0100
@@ -25,9 +25,6 @@ struct rtc_ops {
int (*proc)(char *buf);
};
@@ -865,8 +910,8 @@
void rtc_update(unsigned long, unsigned long);
int register_rtc(struct rtc_ops *);
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/rtc-sysfs.c 2006-01-04 01:27:12.000000000 +0100
-@@ -0,0 +1,125 @@
++++ linux-nslu2/drivers/rtc/rtc-sysfs.c 2006-01-09 03:39:50.000000000 +0100
+@@ -0,0 +1,128 @@
+/*
+ * RTC subsystem, sysfs interface
+ *
@@ -891,58 +936,61 @@
+
+static ssize_t rtc_sysfs_show_date(struct class_device *dev, char *buf)
+{
-+ ssize_t retval = 0;
++ ssize_t retval = -ENODEV;
+ struct rtc_device *rtc = to_rtc_device(dev);
+ struct rtc_time tm;
+
-+ if (down_read_trylock(&rtc->lock) == 0)
-+ return -ENODEV;
++ if ((retval = down_interruptible(&rtc->ops_lock)))
++ return retval;
+
-+ if (rtc_read_time(dev, &tm) == 0) {
++ if (rtc->ops && ((retval = rtc_read_time(dev, &tm)) == 0)) {
+ retval = sprintf(buf, "%04d-%02d-%02d\n",
+ tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
+ }
+
-+ up_read(&rtc->lock);
++ up(&rtc->ops_lock);
++
+ return retval;
+}
+static CLASS_DEVICE_ATTR(date, S_IRUGO, rtc_sysfs_show_date, NULL);
+
+static ssize_t rtc_sysfs_show_time(struct class_device *dev, char *buf)
+{
-+ ssize_t retval = 0;
++ ssize_t retval = -ENODEV;
+ struct rtc_device *rtc = to_rtc_device(dev);
+ struct rtc_time tm;
+
-+ if (down_read_trylock(&rtc->lock) == 0)
-+ return -ENODEV;
++ if ((retval = down_interruptible(&rtc->ops_lock)))
++ return retval;
+
-+ if (rtc_read_time(dev, &tm) == 0) {
++ if (rtc->ops && ((retval = rtc_read_time(dev, &tm)) == 0)) {
+ retval = sprintf(buf, "%02d:%02d:%02d\n",
+ tm.tm_hour, tm.tm_min, tm.tm_sec);
+ }
+
-+ up_read(&rtc->lock);
++ up(&rtc->ops_lock);
++
+ return retval;
+}
+static CLASS_DEVICE_ATTR(time, S_IRUGO, rtc_sysfs_show_time, NULL);
+
+static ssize_t rtc_sysfs_show_since_epoch(struct class_device *dev, char *buf)
+{
-+ ssize_t retval = 0;
++ ssize_t retval = -ENODEV;
+ struct rtc_device *rtc = to_rtc_device(dev);
+ struct rtc_time tm;
+
-+ if (down_read_trylock(&rtc->lock) == 0)
-+ return -ENODEV;
++ if ((retval = down_interruptible(&rtc->ops_lock)))
++ return retval;
+
-+ if (rtc_read_time(dev, &tm) == 0) {
++ if (rtc->ops && ((retval = rtc_read_time(dev, &tm)) == 0)) {
+ unsigned long time;
+ rtc_tm_to_time(&tm, &time);
+ retval = sprintf(buf, "%lu\n", time);
+ }
+
-+ up_read(&rtc->lock);
++ up(&rtc->ops_lock);
++
+ return retval;
+}
+static CLASS_DEVICE_ATTR(since_epoch, S_IRUGO, rtc_sysfs_show_since_epoch, NULL);
@@ -993,7 +1041,7 @@
+MODULE_DESCRIPTION("RTC class sysfs interface");
+MODULE_LICENSE("GPL");
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/rtc-proc.c 2006-01-04 01:27:14.000000000 +0100
++++ linux-nslu2/drivers/rtc/rtc-proc.c 2006-01-09 03:39:50.000000000 +0100
@@ -0,0 +1,158 @@
+/*
+ * RTC subsystem, proc interface
@@ -1154,7 +1202,7 @@
+MODULE_DESCRIPTION("RTC class proc interface");
+MODULE_LICENSE("GPL");
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/rtc-dev.c 2006-01-04 01:27:15.000000000 +0100
++++ linux-nslu2/drivers/rtc/rtc-dev.c 2006-01-09 04:00:16.000000000 +0100
@@ -0,0 +1,372 @@
+/*
+ * RTC subsystem, dev interface
@@ -1529,7 +1577,7 @@
+MODULE_DESCRIPTION("RTC class dev interface");
+MODULE_LICENSE("GPL");
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/rtc-x1205.c 2006-01-04 01:27:17.000000000 +0100
++++ linux-nslu2/drivers/rtc/rtc-x1205.c 2006-01-09 04:17:02.000000000 +0100
@@ -0,0 +1,725 @@
+/*
+ * An i2c driver for the Xicor/Intersil X1205 RTC
@@ -1906,7 +1954,7 @@
+ do_settimeofday(&tv);
+
+ dev_info(&client->dev,
-+ "setting the system clock to %d-%d-%d %d:%d:%d\n",
++ "setting the system clock to %02d-%02d-%d %02d:%02d:%02d\n",
+ tm.tm_year + 1900, tm.tm_mon + 1,
+ tm.tm_mday, tm.tm_hour, tm.tm_min,
+ tm.tm_sec);
@@ -2257,8 +2305,8 @@
+module_init(x1205_init);
+module_exit(x1205_exit);
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/rtc-test.c 2006-01-04 01:27:19.000000000 +0100
-@@ -0,0 +1,189 @@
++++ linux-nslu2/drivers/rtc/rtc-test.c 2006-01-09 04:17:02.000000000 +0100
+@@ -0,0 +1,206 @@
+/*
+ * An RTC test device/driver
+ * Copyright (C) 2005 Tower Technologies
@@ -2275,6 +2323,9 @@
+#include <linux/rtc.h>
+#include <linux/platform_device.h>
+
++struct platform_device *test0 = NULL, *test1 = NULL;
++
++
+static int test_rtc_read_alarm(struct device *dev,
+ struct rtc_wkalrm *alrm)
+{
@@ -2391,7 +2442,7 @@
+ return 0;
+}
+
-+static int test_remove(struct platform_device *plat_dev)
++static int __devexit test_remove(struct platform_device *plat_dev)
+{
+ struct rtc_device *rtc = platform_get_drvdata(plat_dev);
+
@@ -2401,25 +2452,9 @@
+ return 0;
+}
+
-+static void test_release(struct device * dev)
-+{
-+}
-+
-+struct platform_device test_dev_zero = {
-+ .name = "rtc-test",
-+ .id = 0,
-+ .dev.release = test_release,
-+};
-+
-+struct platform_device test_dev_one = {
-+ .name = "rtc-test",
-+ .id = 1,
-+ .dev.release = test_release,
-+};
-+
-+struct platform_driver test_drv = {
++static struct platform_driver test_drv = {
+ .probe = test_probe,
-+ .remove = test_remove,
++ .remove = __devexit_p(test_remove),
+ .driver = {
+ .name = "rtc-test",
+ .owner = THIS_MODULE,
@@ -2428,18 +2463,48 @@
+
+static int __init test_init(void)
+{
-+ platform_device_register(&test_dev_zero);
-+ platform_device_register(&test_dev_one);
-+ platform_driver_register(&test_drv);
++ int err;
++
++ if ((err = platform_driver_register(&test_drv)))
++ return err;
++
++ if ((test0 = platform_device_alloc("rtc-test", 0)) == NULL) {
++ err = -ENOMEM;
++ goto exit_driver_unregister;
++ }
++
++ if ((test1 = platform_device_alloc("rtc-test", 1)) == NULL) {
++ err = -ENOMEM;
++ goto exit_free_test0;
++ }
++
++ if ((err = platform_device_add(test0)))
++ goto exit_free_test1;
++
++ if ((err = platform_device_add(test1)))
++ goto exit_device_unregister;
+
+ return 0;
++
++exit_device_unregister:
++ platform_device_unregister(test0);
++
++exit_free_test1:
++ platform_device_put(test1);
++
++exit_free_test0:
++ platform_device_put(test0);
++
++exit_driver_unregister:
++ platform_driver_unregister(&test_drv);
++ return err;
+}
+
+static void __exit test_exit(void)
+{
++ platform_device_unregister(test0);
++ platform_device_unregister(test1);
+ platform_driver_unregister(&test_drv);
-+ platform_device_unregister(&test_dev_zero);
-+ platform_device_unregister(&test_dev_one);
+}
+
+MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
@@ -2449,8 +2514,8 @@
+module_init(test_init);
+module_exit(test_exit);
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-nslu2/drivers/rtc/rtc-ds1672.c 2006-01-04 01:27:21.000000000 +0100
-@@ -0,0 +1,266 @@
++++ linux-nslu2/drivers/rtc/rtc-ds1672.c 2006-01-12 00:31:05.000000000 +0100
+@@ -0,0 +1,278 @@
+/*
+ * An rtc/i2c driver for the Dallas DS1672
+ * Copyright 2005 Alessandro Zummo
@@ -2465,7 +2530,7 @@
+#include <linux/i2c.h>
+#include <linux/rtc.h>
+
-+#define DRV_VERSION "0.1"
++#define DRV_VERSION "0.2"
+
+/* Addresses to scan: none. This chip cannot be detected. */
+static unsigned short normal_i2c[] = { I2C_CLIENT_END };
@@ -2493,8 +2558,20 @@
+static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
+{
+ unsigned long time;
++ unsigned char addr = DS1672_REG_CNT_BASE;
+ unsigned char buf[4];
+
++ struct i2c_msg msgs[] = {
++ { client->addr, 0, 1, &addr }, /* setup read ptr */
++ { client->addr, I2C_M_RD, 4, buf }, /* read date */
++ };
++
++ /* read date registers */
++ if ((i2c_transfer(client->adapter, &msgs[0], 2)) != 2) {
++ dev_err(&client->dev, "%s: read error\n", __FUNCTION__);
++ return -EIO;
++ }
++
+ dev_dbg(&client->dev,
+ "%s: raw read data - counters=%02x,%02x,%02x,%02x\n"
+ __FUNCTION__,
diff --git a/packages/linux/ixp4xx-kernel/2.6.15/45-eeprom-notifier.patch b/packages/linux/ixp4xx-kernel/2.6.15/45-eeprom-notifier.patch
new file mode 100644
index 0000000000..a3597a9c3f
--- /dev/null
+++ b/packages/linux/ixp4xx-kernel/2.6.15/45-eeprom-notifier.patch
@@ -0,0 +1,184 @@
+Add EEPROM notifiers
+
+These help board level code by allowing a callback when EEPROMs are
+loaded, this permits system level configuration to be loaded from the
+EEPROM. This is particularly useful when the ethernet MAC ids are
+stored in EEPROM and when the ethernet hardware is generic (so it
+has no board level knowledge), then the MACs can be loaded into
+the 'maclist' code and read out by the ethernet config.
+
+Signed-off-by: John Bowler <jbowler@acm.org>
+
+--- linux-2.6.15/drivers/i2c/chips/eeprom.c 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/drivers/i2c/chips/eeprom.c 1970-01-01 00:00:00.000000000 +0000
+@@ -25,7 +25,6 @@
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+-
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/module.h>
+@@ -33,6 +32,9 @@
+ #include <linux/sched.h>
+ #include <linux/jiffies.h>
+ #include <linux/i2c.h>
++#include <linux/notifier.h>
++
++#include <linux/eeprom.h>
+
+ /* Addresses to scan */
+ static unsigned short normal_i2c[] = { 0x50, 0x51, 0x52, 0x53, 0x54,
+@@ -41,6 +43,9 @@ static unsigned short normal_i2c[] = { 0
+ /* Insmod parameters */
+ I2C_CLIENT_INSMOD_1(eeprom);
+
++/* Notifier list */
++static DECLARE_MUTEX(eeprom_notifier_mutex);
++static LIST_HEAD(eeprom_notifiers);
+
+ /* Size of EEPROM in bytes */
+ #define EEPROM_SIZE 256
+@@ -160,6 +165,7 @@ static int eeprom_detect(struct i2c_adap
+ struct i2c_client *new_client;
+ struct eeprom_data *data;
+ int err = 0;
++ struct list_head *this;
+
+ /* There are three ways we can read the EEPROM data:
+ (1) I2C block reads (faster, but unsupported by most adapters)
+@@ -196,7 +202,7 @@ static int eeprom_detect(struct i2c_adap
+
+ /* Detect the Vaio nature of EEPROMs.
+ We use the "PCG-" prefix as the signature. */
+- if (address == 0x57) {
++ if (list_empty(&eeprom_notifiers) && address == 0x57) {
+ if (i2c_smbus_read_byte_data(new_client, 0x80) == 'P'
+ && i2c_smbus_read_byte(new_client) == 'C'
+ && i2c_smbus_read_byte(new_client) == 'G'
+@@ -210,6 +216,14 @@ static int eeprom_detect(struct i2c_adap
+ /* create the sysfs eeprom file */
+ sysfs_create_bin_file(&new_client->dev.kobj, &eeprom_attr);
+
++ /* Call each notifier callback */
++ down(&eeprom_notifier_mutex);
++ list_for_each(this, &eeprom_notifiers) {
++ struct eeprom_notifier *not = list_entry(this, struct eeprom_notifier, list);
++ not->add(address, kind, &new_client->dev.kobj, &eeprom_attr);
++ }
++ up(&eeprom_notifier_mutex);
++
+ return 0;
+
+ exit_kfree:
+@@ -231,6 +245,51 @@ static int eeprom_detach_client(struct i
+ return 0;
+ }
+
++/**
++ * register_eeprom_user - register a 'user' of EEPROM devices.
++ * @new: pointer to notifier info structure
++ *
++ * Registers a callback function to be called upon detection
++ * of an EEPROM device. Detection invokes the 'add' callback
++ * with the kobj of the mutex and a bin_attribute which allows
++ * read from the EEPROM. The intention is that the notifier
++ * will be able to read system configuration from the notifier.
++ *
++ * Only EEPROMs detected *after* the addition of the notifier
++ * are notified. I.e. EEPROMs already known to the system
++ * will not be notified - add the notifier from board level
++ * code!
++ */
++void register_eeprom_user (struct eeprom_notifier *new)
++{
++ down(&eeprom_notifier_mutex);
++
++ list_add(&new->list, &eeprom_notifiers);
++
++ up(&eeprom_notifier_mutex);
++}
++
++/**
++ * unregister_eeprom_user - unregister a 'user' of EEPROM devices.
++ * @old: pointer to notifier info structure
++ *
++ * Removes a callback function from the list of 'users' to be
++ * notified upon detection of EEPROM devices.
++ */
++void unregister_eeprom_user (struct eeprom_notifier *old)
++{
++ down(&eeprom_notifier_mutex);
++
++ list_del(&old->list);
++
++ up(&eeprom_notifier_mutex);
++}
++
++
++EXPORT_SYMBOL(register_eeprom_user);
++EXPORT_SYMBOL(unregister_eeprom_user);
++
++
+ static int __init eeprom_init(void)
+ {
+ return i2c_add_driver(&eeprom_driver);
+--- linux-2.6.15/include/linux/eeprom.h 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/include/linux/eeprom.h 1970-01-01 00:00:00.000000000 +0000
+@@ -0,0 +1,56 @@
++#ifndef _LINUX_EEPROM_H
++#define _LINUX_EEPROM_H
++/*
++ * $Id$
++ *
++ * Copyright (C) 2006 John Bowler
++ */
++
++/*
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
++
++#ifndef __KERNEL__
++#error This is a kernel header
++#endif
++
++#include <linux/list.h>
++#include <linux/kobject.h>
++#include <linux/sysfs.h>
++
++/*
++ * This is very basic.
++ *
++ * If an EEPROM is detected on the I2C bus (this only works for
++ * I2C EEPROMs) the eeprom_notifier::add method is called with
++ * both the I2C information and the kobject for the sysfs
++ * device which has been registers. It is then possible to
++ * read from the device via the bin_attribute::read method
++ * to extract configuration information.
++ *
++ * Register the notifier in the board level code, there is no
++ * need to unregister it but you can if you want (it will save
++ * a little bit or kernel memory to do so).
++ */
++struct eeprom_notifier {
++ void (*add)(int address, int kind, struct kobject *kobj,
++ struct bin_attribute *eeprom_attr);
++ struct list_head list;
++};
++
++extern void register_eeprom_user (struct eeprom_notifier *new);
++extern void unregister_eeprom_user (struct eeprom_notifier *old);
++
++#endif /* _LINUX_EEPROM_H */
diff --git a/packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch b/packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch
new file mode 100644
index 0000000000..ffda1136ef
--- /dev/null
+++ b/packages/linux/ixp4xx-kernel/2.6.15/93-loft-maclist.patch
@@ -0,0 +1,96 @@
+add loft support for setting the maclist from EEPROM
+
+Signed-off-by: John Bowler <jbowler@acm.org>
+
+--- linux-2.6.15/arch/arm/mach-ixp4xx/ixdp425-setup.c 1970-01-01 00:00:00.000000000 +0000
++++ linux-2.6.15/arch/arm/mach-ixp4xx/ixdp425-setup.c 1970-01-01 00:00:00.000000000 +0000
+@@ -14,6 +14,7 @@
+ #include <linux/serial.h>
+ #include <linux/tty.h>
+ #include <linux/serial_8250.h>
++#include <linux/eeprom.h>
+
+ #include <asm/types.h>
+ #include <asm/setup.h>
+@@ -24,6 +25,8 @@
+ #include <asm/mach/arch.h>
+ #include <asm/mach/flash.h>
+
++#include <net/maclist.h>
++
+ static struct flash_platform_data ixdp425_flash_data = {
+ .map_name = "cfi_probe",
+ .width = 2,
+@@ -188,9 +191,62 @@ MACHINE_END
+ /*
+ * Loft is functionally equivalent to Avila except that it has a
+ * different number for the maximum PCI devices. The MACHINE
+- * structure below is identical to Avila except for the comment.
++ * structure below is identical to Avila except for the and
++ * the use of a loft specific init.
++ *
++ * The loft init registers a notifier on the on-board EEPROM to
++ * detect the MAC addresses.
++ * NOTE: this probably works for all Gateworks Avila boards and
++ * maybe the ixdp425 too.
+ */
+ #ifdef CONFIG_MACH_LOFT
++/*
++ * When the EEPROM is added the MAC address are read from it.
++ */
++static void loft_eeprom_add(int address, int kind, struct kobject *kobj,
++ struct bin_attribute *eeprom_attr) {
++ /* The MACs are the first 12 bytes in the eeprom at address 0x51 */
++ if (address == 0x51) {
++ ssize_t retlen;
++ char data[12];
++
++ /* Two Macs, one at 0, the other at 6, maclist_add will
++ * complain if the ID is not a valid MAC.
++ */
++ retlen = eeprom_attr->read(kobj, data, 0, sizeof data);
++ if (retlen >= 6) {
++ u8 mac[6];
++ memcpy(mac, data+0, sizeof mac);
++ printk(KERN_INFO "LOFT MAC[0]: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
++ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
++ maclist_add(mac);
++ }
++ if (retlen >= 12) {
++ u8 mac[6];
++ memcpy(mac, data+6, sizeof mac);
++ printk(KERN_INFO "LOFT MAC[1]: %.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
++ mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
++ maclist_add(mac);
++ }
++ }
++}
++
++static struct eeprom_notifier loft_eeprom_notifier = {
++ .add = loft_eeprom_add
++};
++
++static void __init loft_init(void)
++{
++ /* The EEPROM has two ethernet MACs embedded in it which we need,
++ * that is all this notifier does.
++ */
++ register_eeprom_user(&loft_eeprom_notifier);
++
++ ixp4xx_sys_init();
++
++ platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
++}
++
+ MACHINE_START(LOFT, "Giant Shoulder Inc Loft board")
+ /* Maintainer: Tom Billman <kernel@giantshoulderinc.com> */
+ .phys_ram = PHYS_OFFSET,
+@@ -200,7 +256,7 @@ MACHINE_START(LOFT, "Giant Shoulder Inc
+ .init_irq = ixp4xx_init_irq,
+ .timer = &ixp4xx_timer,
+ .boot_params = 0x0100,
+- .init_machine = ixdp425_init,
++ .init_machine = loft_init,
+ MACHINE_END
+ #endif
+