Fix typo in wpa_supplicant (#4208)
[openwrt.git] / target / linux / brcm63xx / patches-2.6.25 / 040-bcm963xx_flashmap.patch
1 From e734ace5baa04e0e8af1d4483475fbd6bd2b32a1 Mon Sep 17 00:00:00 2001
2 From: Axel Gembe <ago@bastart.eu.org>
3 Date: Mon, 12 May 2008 18:54:09 +0200
4 Subject: [PATCH] bcm963xx: flashmap support
5
6
7 Signed-off-by: Axel Gembe <ago@bastart.eu.org>
8 ---
9  drivers/mtd/maps/Kconfig  |    7 +++++++
10  drivers/mtd/maps/Makefile |    1 +
11  drivers/mtd/redboot.c     |   13 ++++++++++---
12  3 files changed, 18 insertions(+), 3 deletions(-)
13
14 --- a/drivers/mtd/maps/Kconfig
15 +++ b/drivers/mtd/maps/Kconfig
16 @@ -262,6 +262,13 @@
17           Flash memory access on 4G Systems MTX-1 Board. If you have one of
18           these boards and would like to use the flash chips on it, say 'Y'.
19  
20 +config MTD_BCM963XX
21 +        tristate "BCM963xx Flash device"
22 +        depends on MIPS && BCM963XX
23 +        help
24 +         Flash memory access on BCM963xx boards. Currently only works with
25 +         RedBoot and CFE.
26 +
27  config MTD_DILNETPC
28         tristate "CFI Flash device mapped on DIL/Net PC"
29         depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT
30 --- a/drivers/mtd/maps/Makefile
31 +++ b/drivers/mtd/maps/Makefile
32 @@ -68,3 +68,4 @@
33  obj-$(CONFIG_MTD_OMAP_NOR)     += omap_nor.o
34  obj-$(CONFIG_MTD_MTX1)         += mtx-1_flash.o
35  obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o
36 +obj-$(CONFIG_MTD_BCM963XX)     += bcm963xx-flash.o
37 --- a/drivers/mtd/redboot.c
38 +++ b/drivers/mtd/redboot.c
39 @@ -39,7 +39,7 @@
40         return 1;
41  }
42  
43 -static int parse_redboot_partitions(struct mtd_info *master,
44 +int parse_redboot_partitions(struct mtd_info *master,
45                               struct mtd_partition **pparts,
46                               unsigned long fis_origin)
47  {
48 @@ -161,6 +161,14 @@
49                 goto out;
50         }
51  
52 +       if (!fis_origin) {
53 +               for (i = 0; i < numslots; i++) {
54 +                       if (!strncmp(buf[i].name, "RedBoot", 8)) {
55 +                               fis_origin = (buf[i].flash_base & (master->size << 1) - 1);
56 +                       }
57 +               }
58 +       }
59 +
60         for (i = 0; i < numslots; i++) {
61                 struct fis_list *new_fl, **prev;
62  
63 @@ -183,9 +191,8 @@
64                 new_fl->img = &buf[i];
65                  if (fis_origin) {
66                          buf[i].flash_base -= fis_origin;
67 -                } else {
68 -                        buf[i].flash_base &= master->size-1;
69                  }
70 +               buf[i].flash_base &= (master->size << 1) - 1;
71  
72                 /* I'm sure the JFFS2 code has done me permanent damage.
73                  * I now think the following is _normal_