major target cleanup. it is now possible to have subtargets that can override many...
[openwrt-10.03/.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/maps/Makefile linux-2.6.19.new/drivers/mtd/maps/Makefile
19 --- linux-2.6.19/drivers/mtd/maps/Makefile      2006-11-29 22:57:37.000000000 +0100
20 +++ linux-2.6.19.new/drivers/mtd/maps/Makefile  2006-12-18 17:21:07.000000000 +0100
21 @@ -72,3 +72,4 @@
22  obj-$(CONFIG_MTD_OMAP_NOR)     += omap_nor.o
23  obj-$(CONFIG_MTD_MTX1)         += mtx-1_flash.o
24  obj-$(CONFIG_MTD_TQM834x)      += tqm834x.o
25 +obj-$(CONFIG_MTD_BCM963XX)      += bcm963xx-flash.o
26 diff -urN linux-2.6.19/drivers/mtd/redboot.c linux-2.6.19.new/drivers/mtd/redboot.c
27 --- linux-2.6.19/drivers/mtd/redboot.c  2006-12-18 17:09:14.000000000 +0100
28 +++ linux-2.6.19.new/drivers/mtd/redboot.c      2006-12-18 17:14:26.000000000 +0100
29 @@ -39,7 +39,7 @@
30         return 1;
31  }
32  
33 -static int parse_redboot_partitions(struct mtd_info *master,
34 +int parse_redboot_partitions(struct mtd_info *master,
35                               struct mtd_partition **pparts,
36                               unsigned long fis_origin)
37  {
38 @@ -146,6 +146,14 @@
39                 goto out;
40         }
41  
42 +       if (!fis_origin) {
43 +               for (i = 0; i < numslots; i++) {
44 +                       if (!strncmp(buf[i].name, "RedBoot", 8)) {
45 +                               fis_origin = (buf[i].flash_base & (master->size << 1) - 1);
46 +                       }
47 +               }
48 +       }
49 +
50         for (i = 0; i < numslots; i++) {
51                 struct fis_list *new_fl, **prev;
52  
53 @@ -168,9 +176,8 @@
54                 new_fl->img = &buf[i];
55                  if (fis_origin) {
56                          buf[i].flash_base -= fis_origin;
57 -                } else {
58 -                        buf[i].flash_base &= master->size-1;
59                  }
60 +               buf[i].flash_base &= (master->size << 1) - 1;
61  
62                 /* I'm sure the JFFS2 code has done me permanent damage.
63                  * I now think the following is _normal_