1 Index: linux-2.6.20.7/drivers/mtd/maps/Kconfig
2 ===================================================================
3 --- linux-2.6.20.7.orig/drivers/mtd/maps/Kconfig 2007-04-21 12:47:04.000000000 -0300
4 +++ linux-2.6.20.7/drivers/mtd/maps/Kconfig 2007-04-21 13:01:08.000000000 -0300
7 This enables access to the flash chip on the Sharp SL Series of PDAs.
10 + bool "Map driver for Motorola EZX Platform"
11 + depends on MTD && PXA_EZX
16 + prompt "Select partition mapping for EZX platform"
19 + bool "A780/E680 Original Mapping"
21 +config MTD_EZX_A780_ALTERNATE
22 + bool "A780/E680 Alternate Mapping for BLOB2"
25 + bool "E2 Original Mapping"
32 tristate "Map driver for platform device RAM (mtd-ram)"
34 Index: linux-2.6.20.7/drivers/mtd/maps/Makefile
35 ===================================================================
36 --- linux-2.6.20.7.orig/drivers/mtd/maps/Makefile 2007-04-21 12:55:09.000000000 -0300
37 +++ linux-2.6.20.7/drivers/mtd/maps/Makefile 2007-04-21 12:55:45.000000000 -0300
39 obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
40 obj-$(CONFIG_MTD_MTX1) += mtx-1_flash.o
41 obj-$(CONFIG_MTD_TQM834x) += tqm834x.o
42 +obj-$(CONFIG_MTD_EZX) += ezx-flash.o
43 Index: linux-2.6.20.7/drivers/mtd/maps/ezx-flash.c
44 ===================================================================
45 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
46 +++ linux-2.6.20.7/drivers/mtd/maps/ezx-flash.c 2007-04-21 13:07:14.000000000 -0300
51 + * Map driver for the PXA27x
53 + * Author: Harald Welte
54 + * Copyright: (C) 2001 MontaVista Software Inc.
56 + * This program is free software; you can redistribute it and/or modify
57 + * it under the terms of the GNU General Public License version 2 as
58 + * published by the Free Software Foundation.
60 + * Mar 3, 2007 - (Daniel Ribeiro) Alternate partition table
64 +#include <linux/module.h>
65 +#include <linux/types.h>
66 +#include <linux/kernel.h>
67 +#include <linux/init.h>
68 +#include <linux/dma-mapping.h>
69 +#include <linux/slab.h>
71 +#include <linux/mtd/mtd.h>
72 +#include <linux/mtd/map.h>
73 +#include <linux/mtd/partitions.h>
76 +#include <asm/hardware.h>
77 +#include <asm/arch/pxa-regs.h>
78 +#include <asm/arch/mainstone.h>
80 +#define WINDOW_ADDR 0x0
81 +#define WINDOW_SIZE (32*1024*1024)
82 +#define WINDOW_CACHE_ADDR 0x0
83 +#define WINDOW_CACHE_SIZE 0x1a00000
85 +static void pxa27x_map_inval_cache(struct map_info *map, unsigned long from,
89 + unsigned long endaddress, i, j;
90 + endaddress = from + len -1;
92 + endaddress &= ~(32-1);
93 + for (i = from; i <= endaddress; i += 32)
94 + asm("mcr p15, 0, %0, c7, c6, 1"::"r"(i));
96 + asm( "mrc p15, 0, %0, c2, c0, 0\n"
101 + consistent_sync((char *)map->cached + from, len, DMA_FROM_DEVICE);
106 +struct map_info pxa27x_map = {
107 + .name = "PXA27x flash",
108 + .size = WINDOW_SIZE,
109 + .phys = WINDOW_ADDR,
110 + .inval_cache = &pxa27x_map_inval_cache,
113 +#if defined CONFIG_MTD_EZX_A780_ALTERNATE
114 +static struct mtd_partition pxa27x_partitions[] = {
116 + .name = "Bootloader (RO)",
117 + .size = 0x00020000,
119 + .mask_flags = MTD_WRITEABLE,
121 + .name = "Bootloader 2",
122 + .size = 0x00020000,
123 + .offset = 0x00020000,
125 + .name = "Kernel 1",
126 + .size = 0x000e0000, // 896KB
127 + .offset = 0x00040000,
130 + .size = 0x01760000,
131 + .offset = 0x00120000,
133 + .name = "Kernel 2",
134 + .size = 0x00180000, // 1.5MB
135 + .offset = 0x01880000,
137 + .name = "VFM_Filesystem",
138 + .size = 0x005a0000,
139 + .offset = 0x01a00000,
142 + .size = 0x00020000,
143 + .offset = 0x01fa0000,
146 + .size = 0x00020000,
147 + .offset = 0x01fc0000,
150 +#elif defined CONFIG_MTD_EZX_A780
151 +static struct mtd_partition pxa27x_partitions[] = {
153 + .name = "Bootloader",
154 + .size = 0x00020000,
156 + .mask_flags = MTD_WRITEABLE,
159 + .size = 0x000e0000,
160 + .offset = 0x00020000,
163 + .size = 0x018e0000,
164 + .offset = 0x00120000,
166 + .name = "VFM_Filesystem",
167 + .size = 0x00580000,
168 + .offset = 0x01a00000,
171 + .size = 0x00020000,
172 + .offset = 0x01fa0000,
175 + .size = 0x00020000,
176 + .offset = 0x01fc0000,
180 +#error "please define partition for this PXA27x implementation"
184 +static struct mtd_info *mymtd;
185 +static struct mtd_partition *parsed_parts;
187 +static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
189 +static int __init init_pxa27x(void)
191 + struct mtd_partition *parts;
193 + int parsed_nr_parts = 0;
194 + char *part_type = "static";
196 + pxa27x_map.bankwidth = (BOOT_DEF & 1) ? 2 : 4;
198 + printk("Probing PXA27x flash at physical address 0x%08x (%d-bit bankwidth)\n",
199 + WINDOW_ADDR, pxa27x_map.bankwidth * 8);
200 + pxa27x_map.virt = ioremap(pxa27x_map.phys, pxa27x_map.size);
202 + if (!pxa27x_map.virt) {
203 + printk("Failed to ioremap\n");
207 + mymtd = do_map_probe("cfi_probe", &pxa27x_map);
209 + iounmap((void *)pxa27x_map.virt);
212 + mymtd->owner = THIS_MODULE;
215 + /* ioremap the first flash chip as cacheable */
216 + pxa27x_map.cached = ioremap_cached(pxa27x_map.phys, pxa27x_map.size);
217 + if (!pxa27x_map.cached) {
218 + printk("Failed to do cacheable-ioremap\n");
219 + iounmap((void *)pxa27x_map.virt);
223 + simple_map_init(&pxa27x_map);
225 + if (parsed_nr_parts == 0) {
226 + int ret = parse_mtd_partitions(mymtd, probes, &parsed_parts, 0);
229 + part_type = "RedBoot";
230 + parsed_nr_parts = ret;
234 + if (parsed_nr_parts > 0) {
235 + parts = parsed_parts;
236 + nb_parts = parsed_nr_parts;
238 + parts = pxa27x_partitions;
239 + nb_parts = ARRAY_SIZE(pxa27x_partitions);
243 + printk(KERN_NOTICE "Using %s partition definition\n", part_type);
244 + add_mtd_partitions(mymtd, parts, nb_parts);
246 + add_mtd_device(mymtd);
249 + if (ret = ezx_partition_init())
254 +static void __exit cleanup_pxa27x(void)
257 + del_mtd_partitions(mymtd);
258 + map_destroy(mymtd);
260 + kfree(parsed_parts);
262 + if (pxa27x_map.virt)
263 + iounmap((void *)pxa27x_map.virt);
264 + if (pxa27x_map.cached)
265 + iounmap((void *)pxa27x_map.cached);
269 +module_init(init_pxa27x);
270 +module_exit(cleanup_pxa27x);
272 +MODULE_LICENSE("GPL");
273 +MODULE_AUTHOR("Harald Welte <laforge@gnumonks.org>");
274 +MODULE_DESCRIPTION("MTD map driver for Motorola EZX platform");