3884dc1ce1a4a5b956a3d76b6ba33fe393de5b61
[openwrt.git] / target / linux / brcm63xx / patches / 040-bcm963xx_flashmap.patch
1 diff -urN linux-2.6.19/drivers/mtd/maps/Kconfig linux-2.6.19.new/drivers/mtd/maps/Kconfig
2 --- linux-2.6.19/drivers/mtd/maps/Kconfig       2006-11-29 22:57:37.000000000 +0100
3 +++ linux-2.6.19.new/drivers/mtd/maps/Kconfig   2006-12-18 17:21:07.000000000 +0100
4 @@ -283,6 +283,13 @@
5           Flash memory access on 4G Systems MTX-1 Board. If you have one of
6           these boards and would like to use the flash chips on it, say 'Y'.
7  
8 +config MTD_BCM963XX
9 +        tristate "BCM963xx Flash device"
10 +        depends on MIPS && BCM963XX
11 +        help
12 +         Flash memory access on BCM963xx boards. Currently only works with
13 +         RedBoot and CFE.
14 +
15  config MTD_DILNETPC
16         tristate "CFI Flash device mapped on DIL/Net PC"
17         depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
18 diff -urN linux-2.6.19/drivers/mtd/redboot.c linux-2.6.19.new/drivers/mtd/redboot.c
19 --- linux-2.6.19/drivers/mtd/redboot.c  2006-12-18 17:09:14.000000000 +0100
20 +++ linux-2.6.19.new/drivers/mtd/redboot.c      2006-12-18 17:14:26.000000000 +0100
21 @@ -39,7 +39,7 @@
22         return 1;
23  }
24  
25 -static int parse_redboot_partitions(struct mtd_info *master,
26 +int parse_redboot_partitions(struct mtd_info *master,
27                               struct mtd_partition **pparts,
28                               unsigned long fis_origin)
29  {
30 @@ -146,6 +146,14 @@
31                 goto out;
32         }
33  
34 +       if (!fis_origin) {
35 +               for (i = 0; i < numslots; i++) {
36 +                       if (!strncmp(buf[i].name, "RedBoot", 8)) {
37 +                               fis_origin = (buf[i].flash_base & (master->size << 1) - 1);
38 +                       }
39 +               }
40 +       }
41 +
42         for (i = 0; i < numslots; i++) {
43                 struct fis_list *new_fl, **prev;
44  
45 @@ -168,9 +176,8 @@
46                 new_fl->img = &buf[i];
47                  if (fis_origin) {
48                          buf[i].flash_base -= fis_origin;
49 -                } else {
50 -                        buf[i].flash_base &= master->size-1;
51                  }
52 +               buf[i].flash_base &= (master->size << 1) - 1;
53  
54                 /* I'm sure the JFFS2 code has done me permanent damage.
55                  * I now think the following is _normal_
56 diff -urN linux-2.6.24/drivers/mtd/maps/Makefile linux-2.6.24.new/drivers/mtd/maps/Makefile
57 --- linux-2.6.24/drivers/mtd/maps/Makefile      2008-01-24 23:58:37.000000000 +0100
58 +++ linux-2.6.24.new/drivers/mtd/maps/Makefile  2008-02-13 16:30:02.000000000 +0100
59 @@ -69,3 +69,4 @@
60  obj-$(CONFIG_MTD_OMAP_NOR)     += omap_nor.o
61  obj-$(CONFIG_MTD_MTX1)         += mtx-1_flash.o
62  obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o
63 +obj-$(CONFIG_MTD_BCM963XX)     += bcm963xx-flash.o