Add the infrastructure to support different flash sizes/address
[openwrt.git] / target / linux / magicbox-2.6 / patches / 002-flash_map.patch
index 8038230..5d29a04 100644 (file)
@@ -20,7 +20,7 @@ diff -urN linux.old/drivers/mtd/maps/Kconfig linux.dev/drivers/mtd/maps/Kconfig
 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,112 @@
+@@ -0,0 +1,113 @@
 +/*
 + * magicmap.c: Copyleft 2005  Karol Lewandowski
 + *
@@ -43,7 +43,7 @@ diff -urN linux.old/drivers/mtd/maps/magicmap.c linux.dev/drivers/mtd/maps/magic
 +#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;
@@ -91,10 +91,11 @@ diff -urN linux.old/drivers/mtd/maps/magicmap.c linux.dev/drivers/mtd/maps/magic
 +      flash = do_map_probe("cfi_probe", &magic_map);
 +      if (flash) {
 +              flash->owner = THIS_MODULE;
-+              if (MTD_READ(flash, 12, sizeof(u32), &len, (char *) &size) ||
++              if (flash->read(flash, 12, sizeof(u32), &len, (char *) &size) ||
 +                      len != 4)
 +                      return -ENXIO;
-+              if ((size > 0) && (size < 0x400000)) {
++              size += 0x40; /* header size of the uImage */
++              if (size < 0x400000) {
 +                      /* skip to next erase block */
 +                      if (size & (flash->erasesize - 1)) {
 +                              size |= (flash->erasesize - 1);
This page took 0.022327 seconds and 4 git commands to generate.