1 Index: linux-2.6.21.7/drivers/mtd/maps/gumstix-flash.c
2 ===================================================================
4 +++ linux-2.6.21.7/drivers/mtd/maps/gumstix-flash.c
7 + * Map driver for the Gumstix platform
9 + * Author: Craig Hughes
11 + * This program is free software; you can redistribute it and/or modify
12 + * it under the terms of the GNU General Public License version 2 as
13 + * published by the Free Software Foundation.
16 +#include <linux/module.h>
17 +#include <linux/types.h>
18 +#include <linux/kernel.h>
19 +#include <linux/init.h>
20 +#include <linux/mtd/mtd.h>
21 +#include <linux/mtd/map.h>
22 +#include <linux/mtd/partitions.h>
24 +#include <asm/hardware.h>
25 +#include <asm/arch/gumstix.h>
28 +#define ROM_ADDR 0x00000000
29 +#define FLASH_ADDR 0x00000000
31 +#define WINDOW_SIZE 64*1024*1024
33 +static struct map_info gumstix_flash_maps[1] = { {
34 + .name = "Gumstix Flash ROM",
35 + .size = WINDOW_SIZE,
40 +static struct mtd_partition gumstix_flash_partitions[] = {
42 + .name = "Bootloader",
44 + .offset = FLASH_ADDR
47 + .size = MTDPART_SIZ_FULL,
48 + .offset = MTDPART_OFS_APPEND
52 +static struct mtd_info *mymtds[1];
53 +static struct mtd_partition *parsed_parts[1];
54 +static int nr_parsed_parts[1];
56 +static const char *probes[] = { NULL };
58 +static int __init gumstix_flashmap_init(void)
62 + for (i = 0; i < 1; i++) {
63 + gumstix_flash_maps[i].virt = ioremap(gumstix_flash_maps[i].phys, WINDOW_SIZE);
64 + if (!gumstix_flash_maps[i].virt) {
65 + printk(KERN_WARNING "Failed to ioremap %s\n", gumstix_flash_maps[i].name);
70 + simple_map_init(&gumstix_flash_maps[i]);
72 + printk(KERN_NOTICE "Probing %s at physical address 0x%08lx (%d-bit bankwidth)\n",
73 + gumstix_flash_maps[i].name, gumstix_flash_maps[i].phys,
74 + gumstix_flash_maps[i].bankwidth * 8);
76 + mymtds[i] = do_map_probe("cfi_probe", &gumstix_flash_maps[i]);
79 + iounmap((void *)gumstix_flash_maps[i].virt);
80 + if (gumstix_flash_maps[i].cached)
81 + iounmap(gumstix_flash_maps[i].cached);
86 + mymtds[i]->owner = THIS_MODULE;
88 + ret = parse_mtd_partitions(mymtds[i], probes,
89 + &parsed_parts[i], 0);
92 + nr_parsed_parts[i] = ret;
98 + for (i = 0; i < 1; i++) {
100 + printk(KERN_WARNING "%s is absent. Skipping\n", gumstix_flash_maps[i].name);
101 + } else if (nr_parsed_parts[i]) {
102 + add_mtd_partitions(mymtds[i], parsed_parts[i], nr_parsed_parts[i]);
104 + printk("Using static partitions on %s\n", gumstix_flash_maps[i].name);
105 + add_mtd_partitions(mymtds[i], gumstix_flash_partitions, ARRAY_SIZE(gumstix_flash_partitions));
107 + printk("Registering %s as whole device\n", gumstix_flash_maps[i].name);
108 + add_mtd_device(mymtds[i]);
114 +static void __exit gumstix_flashmap_cleanup(void)
117 + for (i = 0; i < 1; i++) {
121 + if (nr_parsed_parts[i] || !i)
122 + del_mtd_partitions(mymtds[i]);
124 + del_mtd_device(mymtds[i]);
126 + map_destroy(mymtds[i]);
127 + iounmap((void *)gumstix_flash_maps[i].virt);
128 + if (gumstix_flash_maps[i].cached)
129 + iounmap(gumstix_flash_maps[i].cached);
131 + if (parsed_parts[i])
132 + kfree(parsed_parts[i]);
136 +module_init(gumstix_flashmap_init);
137 +module_exit(gumstix_flashmap_cleanup);
139 +MODULE_LICENSE("GPL");
140 +MODULE_AUTHOR("Gumstix, Inc. <gumstix-users@lists.sf.net>");
141 +MODULE_DESCRIPTION("MTD map driver for the Gumstix Platform");
142 Index: linux-2.6.21.7/drivers/mtd/maps/Kconfig
143 ===================================================================
144 --- linux-2.6.21.7.orig/drivers/mtd/maps/Kconfig
145 +++ linux-2.6.21.7/drivers/mtd/maps/Kconfig
146 @@ -131,6 +131,13 @@ config MTD_SBC_GXX
148 <http://www.arcomcontrols.com/products/icp/pc104/processors/SBC_GX1.htm>.
151 + tristate "CFI Flash device mapped on Gumstix"
152 + depends on ARCH_GUMSTIX && MTD_CFI_INTELEXT && MTD_PARTITIONS
154 + This provides a driver for the on-board flash of the Gumstix
155 + single board computers.
158 tristate "CFI Flash device mapped on Intel Lubbock XScale eval board"
159 depends on ARCH_LUBBOCK && MTD_CFI_INTELEXT && MTD_PARTITIONS
160 Index: linux-2.6.21.7/drivers/mtd/maps/Makefile
161 ===================================================================
162 --- linux-2.6.21.7.orig/drivers/mtd/maps/Makefile
163 +++ linux-2.6.21.7/drivers/mtd/maps/Makefile
164 @@ -21,6 +21,7 @@ obj-$(CONFIG_MTD_ICHXROM) += ichxrom.o
165 obj-$(CONFIG_MTD_CK804XROM) += ck804xrom.o
166 obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o
167 obj-$(CONFIG_MTD_LUBBOCK) += lubbock-flash.o
168 +obj-$(CONFIG_MTD_GUMSTIX) += gumstix-flash.o
169 obj-$(CONFIG_MTD_MAINSTONE) += mainstone-flash.o
170 obj-$(CONFIG_MTD_MBX860) += mbx860.o
171 obj-$(CONFIG_MTD_CEIVA) += ceiva.o