Fix for the hardware reset hang problem - shut down the flash memory
authorJohn Bowler <jbowler@nslu2-linux.org>
Mon, 18 Jul 2005 00:21:27 +0000 (00:21 +0000)
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>
Mon, 18 Jul 2005 00:21:27 +0000 (00:21 +0000)
device (ensure it is in read mode, not write) on halt/reboot.

packages/linux/nslu2-kernel.inc
packages/linux/nslu2-kernel_2.6.12.2.bb
packages/linux/nslu2-kernel_2.6.12.bb
packages/linux/openslug-kernel-2.6.11.2/mtd-shutdown.patch [new file with mode: 0644]
packages/linux/openslug-kernel_2.6.11.2.bb

index 991805e..44f466e 100644 (file)
@@ -25,6 +25,7 @@
 #   file://ixp4xx_copy_from.patch;patch=1
 #   file://anonymiser.patch;patch=1
 #   file://xscale-reset.patch;patch=1
+#   file://mtd-shutdown.patch;patch=1
 #   ${N2K_EXTRA_PATCHES}
 #
 # N2K_SUFFIX - the suffix to add after 'zImage-' in the
@@ -194,6 +195,7 @@ N2K_PATCHES ?= "\
     file://ixp4xx_copy_from.patch;patch=1 \
     file://anonymiser.patch;patch=1 \
     file://xscale-reset.patch;patch=1 \
+    file://mtd-shutdown.patch;patch=1 \
     ${N2K_EXTRA_PATCHES}"
 
 N2K_SUFFIX ?= "openslug"
index afd0ec8..6fbb5d0 100644 (file)
@@ -1,5 +1,5 @@
 # Kernel for NSLU2
-PR = "r2"
+PR = "r3"
 include nslu2-kernel.inc
 
 # N2K_EXTRA_PATCHES - list of patches to apply (can include
@@ -20,4 +20,5 @@ N2K_PATCHES = "\
        file://anonymiser.patch;patch=1 \
        file://xscale-reset.patch;patch=1 \
        file://x1205-rtc.c-id.patch;patch=1 \
+       file://mtd-shutdown.patch;patch=1 \
 "
index 8ab9379..6cea8a4 100644 (file)
@@ -1,5 +1,5 @@
 # Kernel for NSLU2
-PR = "r1"
+PR = "r2"
 include nslu2-kernel.inc
 
 # N2K_EXTRA_PATCHES - list of patches to apply (can include
@@ -20,4 +20,5 @@ N2K_PATCHES = "\
        file://anonymiser.patch;patch=1 \
        file://xscale-reset.patch;patch=1 \
        file://x1205-rtc.c-id.patch;patch=1 \
+       file://mtd-shutdown.patch;patch=1 \
 "
diff --git a/packages/linux/openslug-kernel-2.6.11.2/mtd-shutdown.patch b/packages/linux/openslug-kernel-2.6.11.2/mtd-shutdown.patch
new file mode 100644 (file)
index 0000000..e7cce4e
--- /dev/null
@@ -0,0 +1,66 @@
+# Ensure that the MTD is shut down on halt/reboot, otherwise the
+# hardware reset hangs
+
+--- linux-2.6.12.2/drivers/mtd/maps/ixp4xx.c.orig      2005-07-17 15:07:47.790388300 -0700
++++ linux-2.6.12.2/drivers/mtd/maps/ixp4xx.c   2005-07-17 17:00:08.082672710 -0700
+@@ -144,6 +144,52 @@
+       return 0;
+ }
++static void ixp4xx_flash_shutdown(struct device *_dev)
++{
++      struct platform_device *dev = to_platform_device(_dev);
++      struct flash_platform_data *plat = dev->dev.platform_data;
++      struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
++      map_word d;
++
++      dev_set_drvdata(&dev->dev, NULL);
++
++      if(!info)
++              return;
++
++      /*
++       * This is required for a soft reboot to work.
++       */
++      d.x[0] = 0xff;
++      ixp4xx_write16(&info->map, d, 0x55 * 0x2);
++
++#if 0
++      /* This is commented out because it seems to cause a kernel
++       * panic (at least if it isn't commented out the kernel fails
++       * to shut down).  Should be investigated.
++       */
++      if (info->mtd) {
++              del_mtd_partitions(info->mtd);
++              map_destroy(info->mtd);
++      }
++#endif
++      if (info->map.map_priv_1)
++              iounmap((void *) info->map.map_priv_1);
++
++      if (info->partitions)
++              kfree(info->partitions);
++
++      if (info->res) {
++              release_resource(info->res);
++              kfree(info->res);
++      }
++
++      if (plat->exit)
++              plat->exit();
++
++      /* Disable flash write */
++      *IXP4XX_EXP_CS0 &= ~IXP4XX_FLASH_WRITABLE;
++}
++
+ static int ixp4xx_flash_probe(struct device *_dev)
+ {
+       struct platform_device *dev = to_platform_device(_dev);
+@@ -243,6 +289,7 @@
+       .bus            = &platform_bus_type,
+       .probe          = ixp4xx_flash_probe,
+       .remove         = ixp4xx_flash_remove,
++      .shutdown       = ixp4xx_flash_shutdown,
+ };
+ static int __init ixp4xx_flash_init(void)
index 1fe7da7..8e2555d 100644 (file)
@@ -2,7 +2,7 @@ SECTION = "kernel"
 DESCRIPTION = "Linux kernel for the Linksys NSLU2 device"
 LICENSE = "GPL"
 MAINTAINER = "Chris Larson <kergoth@handhelds.org>"
-PR = "r14"
+PR = "r15"
 
 KERNEL_SUFFIX = "openslug"
 
@@ -12,6 +12,7 @@ SRC_URI = "ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.11.2.tar.bz2 \
           file://ixp4xx_copy_from.patch;patch=1 \
           file://anonymiser.patch;patch=1 \
           file://xscale-reset.patch;patch=1 \
+          file://mtd-shutdown.patch;patch=1 \
            file://defconfig \
            file://x1205-rtc.c \
            file://nslu2-io.c \