c7c1afdc9268f433dcbe47e4aea9dac2a7bed78e
[openwrt/svn-archive/archive.git] / target / linux / brcm63xx / patches-2.6.27 / 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 && BCM63XX
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/redboot.c
31 +++ b/drivers/mtd/redboot.c
32 @@ -39,7 +39,7 @@
33 return 1;
34 }
35
36 -static int parse_redboot_partitions(struct mtd_info *master,
37 +int parse_redboot_partitions(struct mtd_info *master,
38 struct mtd_partition **pparts,
39 unsigned long fis_origin)
40 {
41 @@ -161,6 +161,14 @@
42 goto out;
43 }
44
45 + if (!fis_origin) {
46 + for (i = 0; i < numslots; i++) {
47 + if (!strncmp(buf[i].name, "RedBoot", 8)) {
48 + fis_origin = (buf[i].flash_base & (master->size << 1) - 1);
49 + }
50 + }
51 + }
52 +
53 for (i = 0; i < numslots; i++) {
54 struct fis_list *new_fl, **prev;
55
56 @@ -183,9 +191,8 @@
57 new_fl->img = &buf[i];
58 if (fis_origin) {
59 buf[i].flash_base -= fis_origin;
60 - } else {
61 - buf[i].flash_base &= master->size-1;
62 }
63 + buf[i].flash_base &= (master->size << 1) - 1;
64
65 /* I'm sure the JFFS2 code has done me permanent damage.
66 * I now think the following is _normal_
67 --- linux-2.6.27/drivers/mtd/maps/Makefile 2008-10-10 00:13:53.000000000 +0200
68 +++ linux-2.6.27.new/drivers/mtd/maps/Makefile 2008-10-20 14:22:52.000000000 +0200
69 @@ -65,3 +65,4 @@
70 obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
71 obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o
72 obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o
73 +obj-$(CONFIG_MTD_BCM963XX) += bcm963xx-flash.o