ar7 misc fixes:
[openwrt.git] / target / linux / magicbox-2.6 / patches / 002-flash_map.patch
index 5b45bca..5d29a04 100644 (file)
@@ -1,6 +1,6 @@
-diff -Nur linux-2.6.17/drivers/mtd/maps/Kconfig linux-2.6.17-owrt/drivers/mtd/maps/Kconfig
---- linux-2.6.17/drivers/mtd/maps/Kconfig      2006-06-18 03:49:35.000000000 +0200
-+++ linux-2.6.17-owrt/drivers/mtd/maps/Kconfig 2006-08-25 23:33:05.000000000 +0200
+diff -urN linux.old/drivers/mtd/maps/Kconfig linux.dev/drivers/mtd/maps/Kconfig
+--- linux.old/drivers/mtd/maps/Kconfig 2006-08-30 06:30:59.000000000 +0200
++++ linux.dev/drivers/mtd/maps/Kconfig 2006-08-30 06:11:51.000000000 +0200
 @@ -323,6 +323,15 @@
          Walnut board. If you have one of these boards and would like to
          use the flash chips on it, say 'Y'.
@@ -17,10 +17,10 @@ diff -Nur linux-2.6.17/drivers/mtd/maps/Kconfig linux-2.6.17-owrt/drivers/mtd/ma
  config MTD_EBONY
        tristate "Flash devices mapped on IBM 440GP Ebony"
        depends on MTD_JEDECPROBE && EBONY
-diff -Nur linux-2.6.17/drivers/mtd/maps/magicmap.c linux-2.6.17-owrt/drivers/mtd/maps/magicmap.c
---- linux-2.6.17/drivers/mtd/maps/magicmap.c   1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.17-owrt/drivers/mtd/maps/magicmap.c      2006-08-25 23:33:05.000000000 +0200
-@@ -0,0 +1,102 @@
+diff -urN linux.old/drivers/mtd/maps/magicmap.c linux.dev/drivers/mtd/maps/magicmap.c
+--- linux.old/drivers/mtd/maps/magicmap.c      1970-01-01 01:00:00.000000000 +0100
++++ linux.dev/drivers/mtd/maps/magicmap.c      2006-08-30 06:52:34.000000000 +0200
+@@ -0,0 +1,113 @@
 +/*
 + * magicmap.c: Copyleft 2005  Karol Lewandowski
 + *
@@ -43,7 +43,7 @@ diff -Nur linux-2.6.17/drivers/mtd/maps/magicmap.c linux-2.6.17-owrt/drivers/mtd
 +#include <linux/mtd/mtd.h>
 +#include <linux/mtd/map.h>
 +#include <linux/mtd/partitions.h>
-+#include <linux/config.h>
++#include <linux/autoconf.h>
 +#include <asm/io.h>
 +
 +static struct mtd_info *flash;
@@ -57,21 +57,16 @@ diff -Nur linux-2.6.17/drivers/mtd/maps/magicmap.c linux-2.6.17-owrt/drivers/mtd
 +
 +static struct mtd_partition magic_partitions[] = {
 +      {
-+              .name =   "kernel",
++              .name =   "linux",
 +              .offset = 0x0,
-+              .size =   0x0e0000,
++              .size =   0x3c0000,
 +      },
 +      {
-+              .name =   "ramdisk",
-+              .offset = 0x0e0000,
++              .name =   "rootfs",
++              .offset = 0x100000,
 +              .size =   0x2c0000,
 +      },
 +      {
-+              .name =   "persistent",
-+              .offset = 0x3a0000,
-+              .size =   0x020000,
-+      },
-+      {
 +              .name =   "bootloader",
 +              .offset = 0x3c0000,
 +              .size =   0x040000,
@@ -81,6 +76,8 @@ diff -Nur linux-2.6.17/drivers/mtd/maps/magicmap.c linux-2.6.17-owrt/drivers/mtd
 +
 +int __init init_magic(void)
 +{
++      u32 size, len;
++      
 +      magic_map.virt =
 +              (void __iomem *)ioremap(magic_map.phys, magic_map.size);
 +
@@ -94,6 +91,20 @@ diff -Nur linux-2.6.17/drivers/mtd/maps/magicmap.c linux-2.6.17-owrt/drivers/mtd
 +      flash = do_map_probe("cfi_probe", &magic_map);
 +      if (flash) {
 +              flash->owner = THIS_MODULE;
++              if (flash->read(flash, 12, sizeof(u32), &len, (char *) &size) ||
++                      len != 4)
++                      return -ENXIO;
++              size += 0x40; /* header size of the uImage */
++              if (size < 0x400000) {
++                      /* skip to next erase block */
++                      if (size & (flash->erasesize - 1)) {
++                              size |= (flash->erasesize - 1);
++                              size += 1;
++                      }
++                      magic_partitions[1].offset = size;
++                      magic_partitions[1].size = magic_partitions[2].offset - size;
++              }
++              
 +              add_mtd_partitions(flash, magic_partitions,
 +                                      ARRAY_SIZE(magic_partitions));
 +      } else {
@@ -123,9 +134,9 @@ diff -Nur linux-2.6.17/drivers/mtd/maps/magicmap.c linux-2.6.17-owrt/drivers/mtd
 +MODULE_LICENSE("GPL");
 +MODULE_AUTHOR("Karol Lewandowski");
 +MODULE_DESCRIPTION("MTD map and partitions for IBM 405EP MagicBox boards");
-diff -Nur linux-2.6.17/drivers/mtd/maps/Makefile linux-2.6.17-owrt/drivers/mtd/maps/Makefile
---- linux-2.6.17/drivers/mtd/maps/Makefile     2006-06-18 03:49:35.000000000 +0200
-+++ linux-2.6.17-owrt/drivers/mtd/maps/Makefile        2006-08-25 23:33:05.000000000 +0200
+diff -urN linux.old/drivers/mtd/maps/Makefile linux.dev/drivers/mtd/maps/Makefile
+--- linux.old/drivers/mtd/maps/Makefile        2006-08-30 06:30:59.000000000 +0200
++++ linux.dev/drivers/mtd/maps/Makefile        2006-08-30 06:11:51.000000000 +0200
 @@ -58,6 +58,7 @@
  obj-$(CONFIG_MTD_BEECH)               += beech-mtd.o
  obj-$(CONFIG_MTD_ARCTIC)      += arctic-mtd.o
@@ -134,4 +145,3 @@ diff -Nur linux-2.6.17/drivers/mtd/maps/Makefile linux-2.6.17-owrt/drivers/mtd/m
  obj-$(CONFIG_MTD_H720X)               += h720x-flash.o
  obj-$(CONFIG_MTD_SBC8240)     += sbc8240.o
  obj-$(CONFIG_MTD_NOR_TOTO)    += omap-toto-flash.o
-
This page took 0.025523 seconds and 4 git commands to generate.