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