malbon has contributed to flash map driver as well, update the driver description
[openwrt/openwrt.git] / target / linux / brcm63xx-2.6 / patches / 040-bcm963xx_flashmap.patch
index 6dd4bf8164afac6cb7845502f7514d847d40f2dd..83414c844aca45960cac8c3a0e3764fce24caf2e 100644 (file)
@@ -1,10 +1,36 @@
-diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/drivers/mtd/maps/bcm963xx-flash.c
---- linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c     1970-01-01 01:00:00.000000000 +0100
-+++ linux-2.6.17-brcm63xx/drivers/mtd/maps/bcm963xx-flash.c      2006-11-06 22:43:59.000000000 +0000
-@@ -0,0 +1,276 @@
+diff -urN linux-2.6.19/drivers/mtd/maps/Kconfig linux-2.6.19.new/drivers/mtd/maps/Kconfig
+--- linux-2.6.19/drivers/mtd/maps/Kconfig      2006-11-29 22:57:37.000000000 +0100
++++ linux-2.6.19.new/drivers/mtd/maps/Kconfig  2006-12-18 17:21:07.000000000 +0100
+@@ -224,6 +224,13 @@
+         Flash memory access on 4G Systems MTX-1 Board. If you have one of
+         these boards and would like to use the flash chips on it, say 'Y'.
++config MTD_BCM963XX
++        tristate "BCM963xx Flash device"
++        depends on MIPS && BCM963XX
++        help
++        Flash memory access on BCM963xx boards. Currently only works with
++        RedBoot and CFE.
++
+ config MTD_DILNETPC
+       tristate "CFI Flash device mapped on DIL/Net PC"
+       depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
+diff -urN linux-2.6.19/drivers/mtd/maps/Makefile linux-2.6.19.new/drivers/mtd/maps/Makefile
+--- linux-2.6.19/drivers/mtd/maps/Makefile     2006-11-29 22:57:37.000000000 +0100
++++ linux-2.6.19.new/drivers/mtd/maps/Makefile 2006-12-18 17:21:07.000000000 +0100
+@@ -70,3 +70,4 @@
+ obj-$(CONFIG_MTD_OMAP_NOR)    += omap_nor.o
+ obj-$(CONFIG_MTD_MTX1)                += mtx-1_flash.o
+ obj-$(CONFIG_MTD_TQM834x)     += tqm834x.o
++obj-$(CONFIG_MTD_BCM963XX)      += bcm963xx-flash.o
+diff -urN linux-2.6.19/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.19.new/drivers/mtd/maps/bcm963xx-flash.c
+--- linux-2.6.19/drivers/mtd/maps/bcm963xx-flash.c     1970-01-01 01:00:00.000000000 +0100
++++ linux-2.6.19.new/drivers/mtd/maps/bcm963xx-flash.c 2006-12-18 17:21:07.000000000 +0100
+@@ -0,0 +1,277 @@
 +/*
 + * $Id$
-+ * Copyright (C) 2006  Florian Fainelli
++ * Copyright (C) 2006  Florian Fainelli <florian@openwrt.org>
++ *                    Mike Albon <malbon@openwrt.org>
 + * Copyright (C) $Date$  $Author$
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -29,7 +55,7 @@ diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/d
 + *  - this bootloader allows us to parse partitions and therefore deduce the MTD partition table
 + *
 + * CFE :
-+ *   - we have to use a "physically mapped flash" defined bellow
++ *   - CFE partitionning can be detected as for BCM947xx devices 
 + *
 + */
 +
@@ -42,7 +68,7 @@ diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/d
 +#include <linux/vmalloc.h>
 +#include <board.h>
 +
-+#define WINDOW_ADDR 0x1FC00000                 /* Real address of the flash */
++#define WINDOW_ADDR 0x1FC00000         /* Real address of the flash */
 +#define WINDOW_SIZE 0x400000           /* Size of flash */
 +#define BUSWIDTH 2                     /* Buswidth */
 +#define EXTENDED_SIZE 0xBFC00000       /* Extended flash address */
@@ -277,35 +303,10 @@ diff -urN linux-2.6.17/drivers/mtd/maps/bcm963xx-flash.c linux-2.6.17-brcm63xx/d
 +module_exit(bcm963xx_mtd_cleanup);
 +
 +MODULE_LICENSE("GPL");
-+MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
-diff -urN linux-2.6.17/drivers/mtd/maps/Kconfig linux-2.6.17-brcm63xx/drivers/mtd/maps/Kconfig
---- linux-2.6.17/drivers/mtd/maps/Kconfig      2006-06-18 03:49:35.000000000 +0200
-+++ linux-2.6.17-brcm63xx/drivers/mtd/maps/Kconfig     2006-08-30 13:03:06.000000000 +0200
-@@ -224,6 +224,13 @@
-         Flash memory access on 4G Systems MTX-1 Board. If you have one of
-         these boards and would like to use the flash chips on it, say 'Y'.
-+config MTD_BCM963XX
-+        tristate "BCM963xx Flash device"
-+        depends on MIPS && MIPS_BRCM
-+        help
-+        Flash memory access on BCM963xx boards. Currently only works with
-+        RedBoot, CFE support coming soon.
-+
- config MTD_DILNETPC
-       tristate "CFI Flash device mapped on DIL/Net PC"
-       depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
-diff -urN linux-2.6.17/drivers/mtd/maps/Makefile linux-2.6.17-brcm63xx/drivers/mtd/maps/Makefile
---- linux-2.6.17/drivers/mtd/maps/Makefile     2006-06-18 03:49:35.000000000 +0200
-+++ linux-2.6.17-brcm63xx/drivers/mtd/maps/Makefile    2006-08-30 13:03:06.000000000 +0200
-@@ -71,3 +71,4 @@
- obj-$(CONFIG_MTD_OMAP_NOR)    += omap_nor.o
- obj-$(CONFIG_MTD_MTX1)                += mtx-1_flash.o
- obj-$(CONFIG_MTD_TQM834x)     += tqm834x.o
-+obj-$(CONFIG_MTD_BCM963XX)      += bcm963xx-flash.o
-diff -urN linux-2.6.17/drivers/mtd/redboot.c linux-2.6.17-brcm63xx/drivers/mtd/redboot.c
---- linux-2.6.17/drivers/mtd/redboot.c 2006-06-18 03:49:35.000000000 +0200
-+++ linux-2.6.17-brcm63xx/drivers/mtd/redboot.c        2006-08-30 13:03:06.000000000 +0200
++MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org> Mike Albon <malbon@openwrt.org>");
+diff -urN linux-2.6.19/drivers/mtd/redboot.c linux-2.6.19.new/drivers/mtd/redboot.c
+--- linux-2.6.19/drivers/mtd/redboot.c 2006-12-18 17:09:14.000000000 +0100
++++ linux-2.6.19.new/drivers/mtd/redboot.c     2006-12-18 17:14:26.000000000 +0100
 @@ -39,7 +39,7 @@
        return 1;
  }
@@ -315,7 +316,7 @@ diff -urN linux-2.6.17/drivers/mtd/redboot.c linux-2.6.17-brcm63xx/drivers/mtd/r
                               struct mtd_partition **pparts,
                               unsigned long fis_origin)
  {
-@@ -120,11 +120,19 @@
+@@ -132,6 +132,14 @@
                goto out;
        }
  
@@ -330,24 +331,13 @@ diff -urN linux-2.6.17/drivers/mtd/redboot.c linux-2.6.17-brcm63xx/drivers/mtd/r
        for (i = 0; i < numslots; i++) {
                struct fis_list *new_fl, **prev;
  
-               if (buf[i].name[0] == 0xff)
--                      continue;
-+                      break;
-               if (!redboot_checksum(&buf[i]))
-                       break;
-@@ -135,11 +143,10 @@
-                       goto out;
-               }
+@@ -154,9 +162,8 @@
                new_fl->img = &buf[i];
--                if (fis_origin) {
--                        buf[i].flash_base -= fis_origin;
+                 if (fis_origin) {
+                         buf[i].flash_base -= fis_origin;
 -                } else {
 -                        buf[i].flash_base &= master->size-1;
--                }
-+              if (fis_origin) {
-+                              buf[i].flash_base -= fis_origin;
-+              }
+                 }
 +              buf[i].flash_base &= (master->size << 1) - 1;
  
                /* I'm sure the JFFS2 code has done me permanent damage.