summaryrefslogtreecommitdiff
path: root/packages/linux
diff options
context:
space:
mode:
Diffstat (limited to 'packages/linux')
-rw-r--r--packages/linux/ixp4xx-kernel.inc121
-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.bb3
4 files changed, 321 insertions, 130 deletions
diff --git a/packages/linux/ixp4xx-kernel.inc b/packages/linux/ixp4xx-kernel.inc
index 452c8c956b..0f3717c7d3 100644
--- a/packages/linux/ixp4xx-kernel.inc
+++ b/packages/linux/ixp4xx-kernel.inc
@@ -9,20 +9,6 @@
#
# IXP4XX_PATCHES - full list of patches to apply, to add files
# generate a patch against /dev/null
-# IXP4XX_SUFFIX - the suffix to add after 'zImage-' in the
-# deploy/images directory, should identify the machines the
-# kernel will run on, ixp4xx[lb] for generic kernels (le or
-# be). Controls the package architecture of the ipk.
-# IXP4XX_MACHID - if set the kernel will be forced to use this
-# machine id and be forced to LE on LE systems - please always
-# remember to override IXP4XX_SUFFIX if this is done, the kernel
-# will simply not work on other machines.
-# IXP4XX_LEFIXUP - if set prepend the LE fixup code to the kernel
-# and byte swap (quad word) the whole kernel image for a BE
-# boot loader
-#
-# If you set CMDLINE_ROOT you should *also* change IXP4XX_SUFFIX
-# because the resultant kernel may not work on other systems.
#
# DEFAULT_PREFERENCE is set automagically in this file as
# follows:
@@ -41,10 +27,6 @@ DESCRIPTION = "Linux kernel for the Intel IXP4xx device"
LICENSE = "GPL"
MAINTAINER = "NSLU2-Linux <www.nslu2-linux.org>"
-# Defaults for the prefix flags
-IXP4XX_MACHID ?= ""
-IXP4XX_LEFIXUP ?= ""
-
# Linux kernel source has the general form linux-X.Y.Z-patchP,
# X.Y is the major version number, Z (which may have multiple
# parts) is a sub-version and 'patch' is something like 'mm' or
@@ -169,12 +151,6 @@ COMPATIBLE_HOST = 'arm.*-linux'
inherit kernel
-# PACKAGE_ARCH must reliably identify what machines this kernel
-# will run on
-PACKAGE_ARCH_kernel-image = "${IXP4XX_SUFFIX}"
-PACKAGE_ARCH_kernel-dev = "${IXP4XX_SUFFIX}"
-PACKAGE_ARCH_kernel = "${IXP4XX_SUFFIX}"
-
ARCH = "arm"
KERNEL_IMAGETYPE = "zImage"
@@ -188,7 +164,7 @@ KERNEL_IMAGETYPE = "zImage"
# CMDLINE_KERNEL_OPTIONS: overridable in local.conf
# MACH_KERNEL_OPTIONS: the default, added to so additional stuff can be
# put in from local.conf etc.
-MACH_KERNEL_OPTIONS += "rtc-x1205.hctosys=1 rtc-x1205.probe=0,0x6f"
+MACH_KERNEL_OPTIONS += "rtc-x1205.probe=0,0x6f rtc-x1205.hctosys=1"
MACH_KERNEL_OPTIONS += "rtc-ds1672.probe=0,0x68 rtc-ds1672.hctosys=1"
MACH_KERNEL_OPTIONS += "pcf8563.hctosys=1"
#
@@ -196,7 +172,9 @@ CMDLINE_KERNEL_OPTIONS ?= "${MACH_KERNEL_OPTIONS}"
# CMDLINE_ROOT: machine specific boot options - should not be set on a
# generic kernel!
-CMDLINE_ROOT ?= ""
+#FIXME: this is to make NSLU2 work (temporary!)
+CMDLINE_ROOT ?= "root=/dev/mtdblock4 rootfstype=jffs2 init=/linuxrc mem=32M"
+#CMDLINE_ROOT ?= "mem=32M"
# CMDLINE_DEBUG: debug options such as noirqdebug, defaults to empty
# override in local.conf etc
@@ -246,7 +224,7 @@ do_configure_prepend() {
${S}/include/asm-arm/.proc ${S}/include/asm-arm/.arch
}
-# IXP4XX_MACHID and IXP4XX_LEFIXUP handling
+# MACHID and LE handling
#
# This mach_fixup function adds the required prefix to the image to
# force the machine id in the kernel to be a particular value. For
@@ -272,38 +250,99 @@ do_configure_prepend() {
#
# The argument to the function is the destination directory
-#SETMACH: set the machine id (register 1) to IXP4XX_MACHID
-SETMACH = '${@["", ".= ${IXP4XX_MACHID} .256/ 255& 0xe3a01c00+; ${WRITE}; .= 255& 0xe3811000+; ${WRITE};"][bb.data.getVar("IXP4XX_MACHID", d, 1) and 1]}'
+# The generic package only includes the generic image, the other
+# packages are made below (they are kernel-image packages but
+# with a different ARCH).
+FILES_kernel-image = "/boot/${KERNEL_IMAGETYPE}-${IXP4XX_SUFFIX}-${KERNEL_RELEASE}"
-#FIXUP: the correct instructions to copy the kernel prepended with the le fixup
-FIXUP_armeb = 'cp$'
-FIXUP_arm = '${@["cp$", "wb 0xee110f10,4;wb 0xe3c00080,4;wb 0xee010f10,4;xp $,4"][bb.data.getVar("IXP4XX_LEFIXUP", d, 1) and 1]}'
+# MACHINE DEFINITIONS: one block for each machine
+
+# The correct settings for the NSLU2 board:
+nslu2_CMDLINE_ROOT = "root=/dev/mtdblock4 rw rootfstype=jffs2 mem=32M init=/linuxrc"
+nslu2_MACHID = "597"
+PACKAGES += "kernel-image-nslu2"
+PKG_kernel-image-nslu2 = "kernel-image-${KERNEL_VERSION}"
+PACKAGE_ARCH_kernel-image-nslu2 = "nslu2${ARCH_BYTE_SEX}"
+DESCRIPTION_kernel-image-nas100d = "Linux kernel for the LinkSys NSLU2"
+FILES_kernel-image-nslu2 = "/boot/${KERNEL_IMAGETYPE}-nslu2${ARCH_BYTE_SEX}-${KERNEL_RELEASE}"
-#WRITE: the correct way to write a single ARM instruction (wb unless LE and !LEFIXUP).
-WRITE_armeb = 'wb 4'
-WRITE_arm = '${@["wl 4", "wb 4"][bb.data.getVar("IXP4XX_LEFIXUP", d, 1) and 1]}'
+# The correct settings for Loft:
+loft_CMDLINE_ROOT = "root=/dev/mtdblock2 rw rootfstype=jffs2 mem=64M init=/linuxrc"
+loft_MACHID = "849"
+PACKAGES += "kernel-image-loft"
+PKG_kernel-image-loft = "kernel-image-${KERNEL_VERSION}"
+PACKAGE_ARCH_kernel-image-loft = "loft${ARCH_BYTE_SEX}"
+DESCRIPTION_kernel-image-loft = "Linux kernel for the Giant Shoulder Inc. Loft board"
+FILES_kernel-image-loft = "/boot/${KERNEL_IMAGETYPE}-loft${ARCH_BYTE_SEX}-${KERNEL_RELEASE}"
+
+# The correct settings for the NAS100D board:
+nas100d_CMDLINE_ROOT = "root=/dev/mtdblock2 rw rootfstype=jffs2 mem=64M init=/linuxrc"
+nas100d_MACHID = "865"
+PACKAGES += "kernel-image-nas100d"
+PKG_kernel-image-nas100d = "kernel-image-${KERNEL_VERSION}"
+PACKAGE_ARCH_kernel-image-nas100d = "nas100d${ARCH_BYTE_SEX}"
+DESCRIPTION_kernel-image-nas100d = "Linux kernel for the IOMega NAS100D"
+FILES_kernel-image-nas100d = "/boot/${KERNEL_IMAGETYPE}-nas100d${ARCH_BYTE_SEX}-${KERNEL_RELEASE}"
+
+#FIXUP: the correct instructions to copy the kernel prepended with the le fixup
+#FIXME: do a fixup for BE too...
+FIXUP_armeb = "cp$"
+FIXUP_arm = "wb 0xee110f10,4;wb 0xe3c00080,4;wb 0xee010f10,4;xp $,4"
DEPENDS += "devio-native"
-# ${SETMACH}${FIXUP} is a sequence of devio commands to copy the image,
-# in the standard (generic) case it is just 'cp$'
+# copy_image <dest> <cmdline> <machine-id>
+# copy the zImage and append the appropriate shim
+# dest: where to copy to
+# cmdline: command line to pass to image
+# machine-id: decimal machine id to prepend, empty for none
copy_image() {
+ local cmdline setmach
+
+ cmdline=""
+ test -n "$2" && cmdline="$2"' ${CMDLINE_KERNEL_OPTIONS} ${CMDLINE_DEBUG} ${CMDLINE_CONSOLE}'
+
+ setmach=""
+ test -n "$3" && setmach="wb $3 . 256/ 255& 0xe3a01c00+, 4; wb 255& 0xe3811000+, 4;"
+
rm -f "$1".new
- devio '<<arch/${ARCH}/boot/${KERNEL_IMAGETYPE}' >"$1".new '${SETMACH}${FIXUP}' || {
- echo 'ERROR: arch/${ARCH}/boot/${KERNEL_IMAGETYPE}: failed to copy zImage' >&2
+ devio '<<${KERNEL_OUTPUT}' >"$1".new "$setmach"'${FIXUP}' || {
+ echo 'ERROR: ${KERNEL_OUTPUT}: failed to copy zImage' >&2
return 1
}
mv "$1".new "$1"
}
+install_image() {
+ copy_image '${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-'"$1"'-${KERNEL_RELEASE}' "$2" "$3"
+}
+
do_install_append() {
- copy_image '${STAGING_KERNEL_DIR}/${KERNEL_IMAGETYPE}'
+ # Overwrite the unshimmed generic image with a shimmed one (but without
+ # any command line or machine id override).
+ rm -f '${D}/${KERNEL_IMAGEDEST}/${KERNEL_IMAGETYPE}-${KERNEL_RELEASE}'
+ install_image '${IXP4XX_SUFFIX}'
+
+ # Add the machine specific images, with appropriate suffixes
+ install_image 'nslu2${ARCH_BYTE_SEX}' '${nslu2_CMDLINE_ROOT}' '${nslu2_MACHID}'
+ install_image 'loft${ARCH_BYTE_SEX}' '${loft_CMDLINE_ROOT}' '${loft_MACHID}'
+ install_image 'nas100d${ARCH_BYTE_SEX}' '${nas100d_CMDLINE_ROOT}' '${nas100d_MACHID}'
}
do_deploy[dirs] = "${S}"
+
+deploy_image() {
+ copy_image '${DEPLOY_DIR}/images/${KERNEL_IMAGETYPE}-'"$1" "$2" "$3"
+}
+
do_deploy() {
install -d ${DEPLOY_DIR}/images
- copy_image '${DEPLOY_DIR}/images/${KERNEL_IMAGETYPE}-${IXP4XX_SUFFIX}'
+ deploy_image '${IXP4XX_SUFFIX}'
+
+ # And the machine specific images
+ deploy_image 'nslu2${ARCH_BYTE_SEX}' '${nslu2_CMDLINE_ROOT}' '${nslu2_MACHID}'
+ deploy_image 'loft${ARCH_BYTE_SEX}' '${loft_CMDLINE_ROOT}' '${loft_MACHID}'
+ deploy_image 'nas100d${ARCH_BYTE_SEX}' '${nas100d_CMDLINE_ROOT}' '${nas100d_MACHID}'
}
addtask deploy before do_build after do_compile
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.bb b/packages/linux/ixp4xx-kernel_2.6.15.bb
index 6da130772c..745e04ee8d 100644
--- a/packages/linux/ixp4xx-kernel_2.6.15.bb
+++ b/packages/linux/ixp4xx-kernel_2.6.15.bb
@@ -8,7 +8,7 @@ PR_CONFIG = "1"
# Increment the number below (i.e. the digits after PR) when
# making changes within this file or for changes to the patches
# applied to the kernel.
-PR = "r5.${PR_CONFIG}"
+PR = "r6.${PR_CONFIG}"
include ixp4xx-kernel.inc
@@ -17,6 +17,7 @@ IXP4XX_PATCHES = ""
IXP4XX_PATCHES += "file://00-memory-h-page-shift.patch;patch=1"
IXP4XX_PATCHES += "file://10-mtdpart-redboot-fis-byteswap.patch;patch=1"
+IXP4XX_PATCHES += "file://11-mtdpart-redboot-config-byteswap.patch;patch=1"
IXP4XX_PATCHES += "file://15-jffs2-endian-config.patch;patch=1"
IXP4XX_PATCHES += "file://40-rtc-class.patch;patch=1"
IXP4XX_PATCHES += "file://50-nas100d-arch.patch;patch=1"