aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/Kconfig46
-rw-r--r--drivers/mtd/maps/Makefile4
-rw-r--r--drivers/mtd/maps/alchemy-flash.c166
-rw-r--r--drivers/mtd/maps/amd76xrom.c1
-rw-r--r--drivers/mtd/maps/bfin-async-flash.c1
-rw-r--r--drivers/mtd/maps/ck804xrom.c1
-rw-r--r--drivers/mtd/maps/esb2rom.c1
-rw-r--r--drivers/mtd/maps/gpio-addr-flash.c1
-rw-r--r--drivers/mtd/maps/ichxrom.c1
-rw-r--r--drivers/mtd/maps/intel_vr_nor.c1
-rw-r--r--drivers/mtd/maps/ipaq-flash.c460
-rw-r--r--drivers/mtd/maps/ixp4xx.c6
-rw-r--r--drivers/mtd/maps/octagon-5066.c1
-rw-r--r--drivers/mtd/maps/omap_nor.c188
-rw-r--r--drivers/mtd/maps/pcmciamtd.c197
-rw-r--r--drivers/mtd/maps/physmap.c21
-rw-r--r--drivers/mtd/maps/physmap_of.c1
-rw-r--r--drivers/mtd/maps/pismo.c321
-rw-r--r--drivers/mtd/maps/plat-ram.c2
-rw-r--r--drivers/mtd/maps/pmcmsp-flash.c1
-rw-r--r--drivers/mtd/maps/pxa2xx-flash.c14
-rw-r--r--drivers/mtd/maps/sa1100-flash.c2
-rw-r--r--drivers/mtd/maps/sbc_gxx.c1
-rw-r--r--drivers/mtd/maps/sun_uflash.c1
-rw-r--r--drivers/mtd/maps/vmax301.c1
-rw-r--r--drivers/mtd/maps/vmu-flash.c10
26 files changed, 482 insertions, 968 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 14be0755d7cd..aa2807d0ce72 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -1,5 +1,3 @@
1# drivers/mtd/maps/Kconfig
2
3menu "Mapping drivers for chip access" 1menu "Mapping drivers for chip access"
4 depends on MTD!=n 2 depends on MTD!=n
5 3
@@ -253,12 +251,6 @@ config MTD_NETtel
253 help 251 help
254 Support for flash chips on NETtel/SecureEdge/SnapGear boards. 252 Support for flash chips on NETtel/SecureEdge/SnapGear boards.
255 253
256config MTD_ALCHEMY
257 tristate "AMD Alchemy Pb1xxx/Db1xxx/RDK MTD support"
258 depends on SOC_AU1X00 && MTD_PARTITIONS && MTD_CFI
259 help
260 Flash memory access on AMD Alchemy Pb/Db/RDK Reference Boards
261
262config MTD_DILNETPC 254config MTD_DILNETPC
263 tristate "CFI Flash device mapped on DIL/Net PC" 255 tristate "CFI Flash device mapped on DIL/Net PC"
264 depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT && BROKEN 256 depends on X86 && MTD_CONCAT && MTD_PARTITIONS && MTD_CFI_INTELEXT && BROKEN
@@ -361,12 +353,6 @@ config MTD_SA1100
361 the SA1100 and SA1110, including the Assabet and the Compaq iPAQ. 353 the SA1100 and SA1110, including the Assabet and the Compaq iPAQ.
362 If you have such a board, say 'Y'. 354 If you have such a board, say 'Y'.
363 355
364config MTD_IPAQ
365 tristate "CFI Flash device mapped on Compaq/HP iPAQ"
366 depends on IPAQ_HANDHELD && MTD_CFI
367 help
368 This provides a driver for the on-board flash of the iPAQ.
369
370config MTD_DC21285 356config MTD_DC21285
371 tristate "CFI Flash device mapped on DC21285 Footbridge" 357 tristate "CFI Flash device mapped on DC21285 Footbridge"
372 depends on MTD_CFI && ARCH_FOOTBRIDGE && MTD_COMPLEX_MAPPINGS 358 depends on MTD_CFI && ARCH_FOOTBRIDGE && MTD_COMPLEX_MAPPINGS
@@ -389,9 +375,9 @@ config MTD_IXP2000
389 depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP2000 375 depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP2000
390 help 376 help
391 This enables MTD access to flash devices on platforms based 377 This enables MTD access to flash devices on platforms based
392 on Intel's IXP2000 family of network processors such as the 378 on Intel's IXP2000 family of network processors. If you have an
393 IXDP425 and Coyote. If you have an IXP2000 based board and 379 IXP2000 based board and would like to use the flash chips on it,
394 would like to use the flash chips on it, say 'Y'. 380 say 'Y'.
395 381
396config MTD_FORTUNET 382config MTD_FORTUNET
397 tristate "CFI Flash device mapped on the FortuNet board" 383 tristate "CFI Flash device mapped on the FortuNet board"
@@ -436,15 +422,6 @@ config MTD_H720X
436 This enables access to the flash chips on the Hynix evaluation boards. 422 This enables access to the flash chips on the Hynix evaluation boards.
437 If you have such a board, say 'Y'. 423 If you have such a board, say 'Y'.
438 424
439config MTD_OMAP_NOR
440 tristate "TI OMAP board mappings"
441 depends on MTD_CFI && ARCH_OMAP
442 help
443 This enables access to the NOR flash chips on TI OMAP-based
444 boards defining flash platform devices and flash platform data.
445 These boards include the Innovator, H2, H3, OSK, Perseus2, and
446 more. If you have such a board, say 'Y'.
447
448# This needs CFI or JEDEC, depending on the cards found. 425# This needs CFI or JEDEC, depending on the cards found.
449config MTD_PCI 426config MTD_PCI
450 tristate "PCI MTD driver" 427 tristate "PCI MTD driver"
@@ -557,4 +534,21 @@ config MTD_VMU
557 To build this as a module select M here, the module will be called 534 To build this as a module select M here, the module will be called
558 vmu-flash. 535 vmu-flash.
559 536
537config MTD_PISMO
538 tristate "MTD discovery driver for PISMO modules"
539 depends on I2C
540 depends on ARCH_VERSATILE
541 help
542 This driver allows for discovery of PISMO modules - see
543 <http://www.pismoworld.org/>. These are small modules containing
544 up to five memory devices (eg, SRAM, flash, DOC) described by an
545 I2C EEPROM.
546
547 This driver does not create any MTD maps itself; instead it
548 creates MTD physmap and MTD SRAM platform devices. If you
549 enable this option, you should consider enabling MTD_PHYSMAP
550 and/or MTD_PLATRAM according to the devices on your module.
551
552 When built as a module, it will be called pismo.ko
553
560endmenu 554endmenu
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index ae2f6dbe43c3..bb035cd54c72 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -24,12 +24,12 @@ obj-$(CONFIG_MTD_CEIVA) += ceiva.o
24obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o 24obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o
25obj-$(CONFIG_MTD_PHYSMAP) += physmap.o 25obj-$(CONFIG_MTD_PHYSMAP) += physmap.o
26obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o 26obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o
27obj-$(CONFIG_MTD_PISMO) += pismo.o
27obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o 28obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o
28obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o 29obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o
29obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o 30obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o
30obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o 31obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o
31obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o 32obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o
32obj-$(CONFIG_MTD_IPAQ) += ipaq-flash.o
33obj-$(CONFIG_MTD_SBC_GXX) += sbc_gxx.o 33obj-$(CONFIG_MTD_SBC_GXX) += sbc_gxx.o
34obj-$(CONFIG_MTD_SC520CDP) += sc520cdp.o 34obj-$(CONFIG_MTD_SC520CDP) += sc520cdp.o
35obj-$(CONFIG_MTD_NETSC520) += netsc520.o 35obj-$(CONFIG_MTD_NETSC520) += netsc520.o
@@ -40,7 +40,6 @@ obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o
40obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o 40obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o
41obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o 41obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o
42obj-$(CONFIG_MTD_PCI) += pci.o 42obj-$(CONFIG_MTD_PCI) += pci.o
43obj-$(CONFIG_MTD_ALCHEMY) += alchemy-flash.o
44obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o 43obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o
45obj-$(CONFIG_MTD_EDB7312) += edb7312.o 44obj-$(CONFIG_MTD_EDB7312) += edb7312.o
46obj-$(CONFIG_MTD_IMPA7) += impa7.o 45obj-$(CONFIG_MTD_IMPA7) += impa7.o
@@ -55,7 +54,6 @@ obj-$(CONFIG_MTD_IXP2000) += ixp2000.o
55obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o 54obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o
56obj-$(CONFIG_MTD_DMV182) += dmv182.o 55obj-$(CONFIG_MTD_DMV182) += dmv182.o
57obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o 56obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o
58obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
59obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o 57obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o
60obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o 58obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o
61obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o 59obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o
diff --git a/drivers/mtd/maps/alchemy-flash.c b/drivers/mtd/maps/alchemy-flash.c
deleted file mode 100644
index 845ad4f2a542..000000000000
--- a/drivers/mtd/maps/alchemy-flash.c
+++ /dev/null
@@ -1,166 +0,0 @@
1/*
2 * Flash memory access on AMD Alchemy evaluation boards
3 *
4 * (C) 2003, 2004 Pete Popov <ppopov@embeddedalley.com>
5 */
6
7#include <linux/init.h>
8#include <linux/module.h>
9#include <linux/types.h>
10#include <linux/kernel.h>
11
12#include <linux/mtd/mtd.h>
13#include <linux/mtd/map.h>
14#include <linux/mtd/partitions.h>
15
16#include <asm/io.h>
17
18#ifdef CONFIG_MIPS_PB1000
19#define BOARD_MAP_NAME "Pb1000 Flash"
20#define BOARD_FLASH_SIZE 0x00800000 /* 8MB */
21#define BOARD_FLASH_WIDTH 4 /* 32-bits */
22#endif
23
24#ifdef CONFIG_MIPS_PB1500
25#define BOARD_MAP_NAME "Pb1500 Flash"
26#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
27#define BOARD_FLASH_WIDTH 4 /* 32-bits */
28#endif
29
30#ifdef CONFIG_MIPS_PB1100
31#define BOARD_MAP_NAME "Pb1100 Flash"
32#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
33#define BOARD_FLASH_WIDTH 4 /* 32-bits */
34#endif
35
36#ifdef CONFIG_MIPS_PB1550
37#define BOARD_MAP_NAME "Pb1550 Flash"
38#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
39#define BOARD_FLASH_WIDTH 4 /* 32-bits */
40#endif
41
42#ifdef CONFIG_MIPS_PB1200
43#define BOARD_MAP_NAME "Pb1200 Flash"
44#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
45#define BOARD_FLASH_WIDTH 2 /* 16-bits */
46#endif
47
48#ifdef CONFIG_MIPS_DB1000
49#define BOARD_MAP_NAME "Db1000 Flash"
50#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
51#define BOARD_FLASH_WIDTH 4 /* 32-bits */
52#endif
53
54#ifdef CONFIG_MIPS_DB1500
55#define BOARD_MAP_NAME "Db1500 Flash"
56#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
57#define BOARD_FLASH_WIDTH 4 /* 32-bits */
58#endif
59
60#ifdef CONFIG_MIPS_DB1100
61#define BOARD_MAP_NAME "Db1100 Flash"
62#define BOARD_FLASH_SIZE 0x02000000 /* 32MB */
63#define BOARD_FLASH_WIDTH 4 /* 32-bits */
64#endif
65
66#ifdef CONFIG_MIPS_DB1550
67#define BOARD_MAP_NAME "Db1550 Flash"
68#define BOARD_FLASH_SIZE 0x08000000 /* 128MB */
69#define BOARD_FLASH_WIDTH 4 /* 32-bits */
70#endif
71
72#ifdef CONFIG_MIPS_DB1200
73#define BOARD_MAP_NAME "Db1200 Flash"
74#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
75#define BOARD_FLASH_WIDTH 2 /* 16-bits */
76#endif
77
78#ifdef CONFIG_MIPS_BOSPORUS
79#define BOARD_MAP_NAME "Bosporus Flash"
80#define BOARD_FLASH_SIZE 0x01000000 /* 16MB */
81#define BOARD_FLASH_WIDTH 2 /* 16-bits */
82#endif
83
84#ifdef CONFIG_MIPS_MIRAGE
85#define BOARD_MAP_NAME "Mirage Flash"
86#define BOARD_FLASH_SIZE 0x04000000 /* 64MB */
87#define BOARD_FLASH_WIDTH 4 /* 32-bits */
88#define USE_LOCAL_ACCESSORS /* why? */
89#endif
90
91static struct map_info alchemy_map = {
92 .name = BOARD_MAP_NAME,
93};
94
95static struct mtd_partition alchemy_partitions[] = {
96 {
97 .name = "User FS",
98 .size = BOARD_FLASH_SIZE - 0x00400000,
99 .offset = 0x0000000
100 },{
101 .name = "YAMON",
102 .size = 0x0100000,
103 .offset = MTDPART_OFS_APPEND,
104 .mask_flags = MTD_WRITEABLE
105 },{
106 .name = "raw kernel",
107 .size = (0x300000 - 0x40000), /* last 256KB is yamon env */
108 .offset = MTDPART_OFS_APPEND,
109 }
110};
111
112static struct mtd_info *mymtd;
113
114static int __init alchemy_mtd_init(void)
115{
116 struct mtd_partition *parts;
117 int nb_parts = 0;
118 unsigned long window_addr;
119 unsigned long window_size;
120
121 /* Default flash buswidth */
122 alchemy_map.bankwidth = BOARD_FLASH_WIDTH;
123
124 window_addr = 0x20000000 - BOARD_FLASH_SIZE;
125 window_size = BOARD_FLASH_SIZE;
126
127 /*
128 * Static partition definition selection
129 */
130 parts = alchemy_partitions;
131 nb_parts = ARRAY_SIZE(alchemy_partitions);
132 alchemy_map.size = window_size;
133
134 /*
135 * Now let's probe for the actual flash. Do it here since
136 * specific machine settings might have been set above.
137 */
138 printk(KERN_NOTICE BOARD_MAP_NAME ": probing %d-bit flash bus\n",
139 alchemy_map.bankwidth*8);
140 alchemy_map.virt = ioremap(window_addr, window_size);
141 mymtd = do_map_probe("cfi_probe", &alchemy_map);
142 if (!mymtd) {
143 iounmap(alchemy_map.virt);
144 return -ENXIO;
145 }
146 mymtd->owner = THIS_MODULE;
147
148 add_mtd_partitions(mymtd, parts, nb_parts);
149 return 0;
150}
151
152static void __exit alchemy_mtd_cleanup(void)
153{
154 if (mymtd) {
155 del_mtd_partitions(mymtd);
156 map_destroy(mymtd);
157 iounmap(alchemy_map.virt);
158 }
159}
160
161module_init(alchemy_mtd_init);
162module_exit(alchemy_mtd_cleanup);
163
164MODULE_AUTHOR("Embedded Alley Solutions, Inc");
165MODULE_DESCRIPTION(BOARD_MAP_NAME " MTD driver");
166MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c
index 237733d094c4..19fe92db0c46 100644
--- a/drivers/mtd/maps/amd76xrom.c
+++ b/drivers/mtd/maps/amd76xrom.c
@@ -8,6 +8,7 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/slab.h>
11#include <asm/io.h> 12#include <asm/io.h>
12#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
13#include <linux/mtd/map.h> 14#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c
index a7c808b577d3..c0fd99b0c525 100644
--- a/drivers/mtd/maps/bfin-async-flash.c
+++ b/drivers/mtd/maps/bfin-async-flash.c
@@ -22,6 +22,7 @@
22#include <linux/mtd/partitions.h> 22#include <linux/mtd/partitions.h>
23#include <linux/mtd/physmap.h> 23#include <linux/mtd/physmap.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/slab.h>
25#include <linux/types.h> 26#include <linux/types.h>
26 27
27#include <asm/blackfin.h> 28#include <asm/blackfin.h>
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 424f17d6ffd1..ddb462bea9b5 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -11,6 +11,7 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/slab.h>
14#include <asm/io.h> 15#include <asm/io.h>
15#include <linux/mtd/mtd.h> 16#include <linux/mtd/mtd.h>
16#include <linux/mtd/map.h> 17#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c
index 11a2f57df9cf..d12c93dc1aad 100644
--- a/drivers/mtd/maps/esb2rom.c
+++ b/drivers/mtd/maps/esb2rom.c
@@ -14,6 +14,7 @@
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/slab.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <linux/mtd/mtd.h> 19#include <linux/mtd/mtd.h>
19#include <linux/mtd/map.h> 20#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c
index 1ad5caf9fe69..32e89d773b4e 100644
--- a/drivers/mtd/maps/gpio-addr-flash.c
+++ b/drivers/mtd/maps/gpio-addr-flash.c
@@ -23,6 +23,7 @@
23#include <linux/mtd/partitions.h> 23#include <linux/mtd/partitions.h>
24#include <linux/mtd/physmap.h> 24#include <linux/mtd/physmap.h>
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/slab.h>
26#include <linux/types.h> 27#include <linux/types.h>
27 28
28#define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); }) 29#define pr_devinit(fmt, args...) ({ static const __devinitconst char __fmt[] = fmt; printk(__fmt, ## args); })
diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c
index c32bc28920b3..f102bf243a74 100644
--- a/drivers/mtd/maps/ichxrom.c
+++ b/drivers/mtd/maps/ichxrom.c
@@ -8,6 +8,7 @@
8#include <linux/types.h> 8#include <linux/types.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/slab.h>
11#include <asm/io.h> 12#include <asm/io.h>
12#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
13#include <linux/mtd/map.h> 14#include <linux/mtd/map.h>
diff --git a/drivers/mtd/maps/intel_vr_nor.c b/drivers/mtd/maps/intel_vr_nor.c
index 1e7814ae212a..fc1998512eb4 100644
--- a/drivers/mtd/maps/intel_vr_nor.c
+++ b/drivers/mtd/maps/intel_vr_nor.c
@@ -29,6 +29,7 @@
29 29
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/kernel.h> 31#include <linux/kernel.h>
32#include <linux/slab.h>
32#include <linux/pci.h> 33#include <linux/pci.h>
33#include <linux/init.h> 34#include <linux/init.h>
34#include <linux/mtd/mtd.h> 35#include <linux/mtd/mtd.h>
diff --git a/drivers/mtd/maps/ipaq-flash.c b/drivers/mtd/maps/ipaq-flash.c
deleted file mode 100644
index 76708e796b70..000000000000
--- a/drivers/mtd/maps/ipaq-flash.c
+++ /dev/null
@@ -1,460 +0,0 @@
1/*
2 * Flash memory access on iPAQ Handhelds (either SA1100 or PXA250 based)
3 *
4 * (C) 2000 Nicolas Pitre <nico@fluxnic.net>
5 * (C) 2002 Hewlett-Packard Company <jamey.hicks@hp.com>
6 * (C) 2003 Christian Pellegrin <chri@ascensit.com>, <chri@infis.univ.ts.it>: concatenation of multiple flashes
7 */
8
9#include <linux/module.h>
10#include <linux/types.h>
11#include <linux/kernel.h>
12#include <linux/spinlock.h>
13#include <linux/init.h>
14#include <linux/slab.h>
15#include <asm/page.h>
16#include <asm/mach-types.h>
17#include <asm/system.h>
18#include <asm/errno.h>
19
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/partitions.h>
23#ifdef CONFIG_MTD_CONCAT
24#include <linux/mtd/concat.h>
25#endif
26
27#include <mach/hardware.h>
28#include <mach/h3600.h>
29#include <asm/io.h>
30
31
32#ifndef CONFIG_IPAQ_HANDHELD
33#error This is for iPAQ Handhelds only
34#endif
35#ifdef CONFIG_SA1100_JORNADA56X
36
37static void jornada56x_set_vpp(struct map_info *map, int vpp)
38{
39 if (vpp)
40 GPSR = GPIO_GPIO26;
41 else
42 GPCR = GPIO_GPIO26;
43 GPDR |= GPIO_GPIO26;
44}
45
46#endif
47
48#ifdef CONFIG_SA1100_JORNADA720
49
50static void jornada720_set_vpp(struct map_info *map, int vpp)
51{
52 if (vpp)
53 PPSR |= 0x80;
54 else
55 PPSR &= ~0x80;
56 PPDR |= 0x80;
57}
58
59#endif
60
61#define MAX_IPAQ_CS 2 /* Number of CS we are going to test */
62
63#define IPAQ_MAP_INIT(X) \
64 { \
65 name: "IPAQ flash " X, \
66 }
67
68
69static struct map_info ipaq_map[MAX_IPAQ_CS] = {
70 IPAQ_MAP_INIT("bank 1"),
71 IPAQ_MAP_INIT("bank 2")
72};
73
74static struct mtd_info *my_sub_mtd[MAX_IPAQ_CS] = {
75 NULL,
76 NULL
77};
78
79/*
80 * Here are partition information for all known IPAQ-based devices.
81 * See include/linux/mtd/partitions.h for definition of the mtd_partition
82 * structure.
83 *
84 * The *_max_flash_size is the maximum possible mapped flash size which
85 * is not necessarily the actual flash size. It must be no more than
86 * the value specified in the "struct map_desc *_io_desc" mapping
87 * definition for the corresponding machine.
88 *
89 * Please keep these in alphabetical order, and formatted as per existing
90 * entries. Thanks.
91 */
92
93#ifdef CONFIG_IPAQ_HANDHELD
94static unsigned long h3xxx_max_flash_size = 0x04000000;
95static struct mtd_partition h3xxx_partitions[] = {
96 {
97 name: "H3XXX boot firmware",
98#ifndef CONFIG_LAB
99 size: 0x00040000,
100#else
101 size: 0x00080000,
102#endif
103 offset: 0,
104#ifndef CONFIG_LAB
105 mask_flags: MTD_WRITEABLE, /* force read-only */
106#endif
107 },
108 {
109 name: "H3XXX root jffs2",
110#ifndef CONFIG_LAB
111 size: 0x2000000 - 2*0x40000, /* Warning, this is fixed later */
112 offset: 0x00040000,
113#else
114 size: 0x2000000 - 0x40000 - 0x80000, /* Warning, this is fixed later */
115 offset: 0x00080000,
116#endif
117 },
118 {
119 name: "asset",
120 size: 0x40000,
121 offset: 0x2000000 - 0x40000, /* Warning, this is fixed later */
122 mask_flags: MTD_WRITEABLE, /* force read-only */
123 }
124};
125
126#ifndef CONFIG_MTD_CONCAT
127static struct mtd_partition h3xxx_partitions_bank2[] = {
128 /* this is used only on 2 CS machines when concat is not present */
129 {
130 name: "second H3XXX root jffs2",
131 size: 0x1000000 - 0x40000, /* Warning, this is fixed later */
132 offset: 0x00000000,
133 },
134 {
135 name: "second asset",
136 size: 0x40000,
137 offset: 0x1000000 - 0x40000, /* Warning, this is fixed later */
138 mask_flags: MTD_WRITEABLE, /* force read-only */
139 }
140};
141#endif
142
143static DEFINE_SPINLOCK(ipaq_vpp_lock);
144
145static void h3xxx_set_vpp(struct map_info *map, int vpp)
146{
147 static int nest = 0;
148
149 spin_lock(&ipaq_vpp_lock);
150 if (vpp)
151 nest++;
152 else
153 nest--;
154 if (nest)
155 assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, 1);
156 else
157 assign_h3600_egpio(IPAQ_EGPIO_VPP_ON, 0);
158 spin_unlock(&ipaq_vpp_lock);
159}
160
161#endif
162
163#if defined(CONFIG_SA1100_JORNADA56X) || defined(CONFIG_SA1100_JORNADA720)
164static unsigned long jornada_max_flash_size = 0x02000000;
165static struct mtd_partition jornada_partitions[] = {
166 {
167 name: "Jornada boot firmware",
168 size: 0x00040000,
169 offset: 0,
170 mask_flags: MTD_WRITEABLE, /* force read-only */
171 }, {
172 name: "Jornada root jffs2",
173 size: MTDPART_SIZ_FULL,
174 offset: 0x00040000,
175 }
176};
177#endif
178
179
180static struct mtd_partition *parsed_parts;
181static struct mtd_info *mymtd;
182
183static unsigned long cs_phys[] = {
184#ifdef CONFIG_ARCH_SA1100
185 SA1100_CS0_PHYS,
186 SA1100_CS1_PHYS,
187 SA1100_CS2_PHYS,
188 SA1100_CS3_PHYS,
189 SA1100_CS4_PHYS,
190 SA1100_CS5_PHYS,
191#else
192 PXA_CS0_PHYS,
193 PXA_CS1_PHYS,
194 PXA_CS2_PHYS,
195 PXA_CS3_PHYS,
196 PXA_CS4_PHYS,
197 PXA_CS5_PHYS,
198#endif
199};
200
201static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
202
203static int __init h1900_special_case(void);
204
205static int __init ipaq_mtd_init(void)
206{
207 struct mtd_partition *parts = NULL;
208 int nb_parts = 0;
209 int parsed_nr_parts = 0;
210 const char *part_type;
211 int i; /* used when we have >1 flash chips */
212 unsigned long tot_flashsize = 0; /* used when we have >1 flash chips */
213
214 /* Default flash bankwidth */
215 // ipaq_map.bankwidth = (MSC0 & MSC_RBW) ? 2 : 4;
216
217 if (machine_is_h1900())
218 {
219 /* For our intents, the h1900 is not a real iPAQ, so we special-case it. */
220 return h1900_special_case();
221 }
222
223 if (machine_is_h3100() || machine_is_h1900())
224 for(i=0; i<MAX_IPAQ_CS; i++)
225 ipaq_map[i].bankwidth = 2;
226 else
227 for(i=0; i<MAX_IPAQ_CS; i++)
228 ipaq_map[i].bankwidth = 4;
229
230 /*
231 * Static partition definition selection
232 */
233 part_type = "static";
234
235 simple_map_init(&ipaq_map[0]);
236 simple_map_init(&ipaq_map[1]);
237
238#ifdef CONFIG_IPAQ_HANDHELD
239 if (machine_is_ipaq()) {
240 parts = h3xxx_partitions;
241 nb_parts = ARRAY_SIZE(h3xxx_partitions);
242 for(i=0; i<MAX_IPAQ_CS; i++) {
243 ipaq_map[i].size = h3xxx_max_flash_size;
244 ipaq_map[i].set_vpp = h3xxx_set_vpp;
245 ipaq_map[i].phys = cs_phys[i];
246 ipaq_map[i].virt = ioremap(cs_phys[i], 0x04000000);
247 if (machine_is_h3100 () || machine_is_h1900())
248 ipaq_map[i].bankwidth = 2;
249 }
250 if (machine_is_h3600()) {
251 /* No asset partition here */
252 h3xxx_partitions[1].size += 0x40000;
253 nb_parts--;
254 }
255 }
256#endif
257#ifdef CONFIG_ARCH_H5400
258 if (machine_is_h5400()) {
259 ipaq_map[0].size = 0x02000000;
260 ipaq_map[1].size = 0x02000000;
261 ipaq_map[1].phys = 0x02000000;
262 ipaq_map[1].virt = ipaq_map[0].virt + 0x02000000;
263 }
264#endif
265#ifdef CONFIG_ARCH_H1900
266 if (machine_is_h1900()) {
267 ipaq_map[0].size = 0x00400000;
268 ipaq_map[1].size = 0x02000000;
269 ipaq_map[1].phys = 0x00080000;
270 ipaq_map[1].virt = ipaq_map[0].virt + 0x00080000;
271 }
272#endif
273
274#ifdef CONFIG_SA1100_JORNADA56X
275 if (machine_is_jornada56x()) {
276 parts = jornada_partitions;
277 nb_parts = ARRAY_SIZE(jornada_partitions);
278 ipaq_map[0].size = jornada_max_flash_size;
279 ipaq_map[0].set_vpp = jornada56x_set_vpp;
280 ipaq_map[0].virt = (__u32)ioremap(0x0, 0x04000000);
281 }
282#endif
283#ifdef CONFIG_SA1100_JORNADA720
284 if (machine_is_jornada720()) {
285 parts = jornada_partitions;
286 nb_parts = ARRAY_SIZE(jornada_partitions);
287 ipaq_map[0].size = jornada_max_flash_size;
288 ipaq_map[0].set_vpp = jornada720_set_vpp;
289 }
290#endif
291
292
293 if (machine_is_ipaq()) { /* for iPAQs only */
294 for(i=0; i<MAX_IPAQ_CS; i++) {
295 printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with CFI.\n", ipaq_map[i].bankwidth*8, ipaq_map[i].virt);
296 my_sub_mtd[i] = do_map_probe("cfi_probe", &ipaq_map[i]);
297 if (!my_sub_mtd[i]) {
298 printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[i].bankwidth*8, ipaq_map[i].virt);
299 my_sub_mtd[i] = do_map_probe("jedec_probe", &ipaq_map[i]);
300 }
301 if (!my_sub_mtd[i]) {
302 printk(KERN_NOTICE "iPAQ flash: failed to find flash.\n");
303 if (i)
304 break;
305 else
306 return -ENXIO;
307 } else
308 printk(KERN_NOTICE "iPAQ flash: found %d bytes\n", my_sub_mtd[i]->size);
309
310 /* do we really need this debugging? --joshua 20030703 */
311 // printk("my_sub_mtd[%d]=%p\n", i, my_sub_mtd[i]);
312 my_sub_mtd[i]->owner = THIS_MODULE;
313 tot_flashsize += my_sub_mtd[i]->size;
314 }
315#ifdef CONFIG_MTD_CONCAT
316 /* fix the asset location */
317# ifdef CONFIG_LAB
318 h3xxx_partitions[1].size = tot_flashsize - 0x40000 - 0x80000 /* extra big boot block */;
319# else
320 h3xxx_partitions[1].size = tot_flashsize - 2 * 0x40000;
321# endif
322 h3xxx_partitions[2].offset = tot_flashsize - 0x40000;
323 /* and concat the devices */
324 mymtd = mtd_concat_create(&my_sub_mtd[0], i,
325 "ipaq");
326 if (!mymtd) {
327 printk("Cannot create iPAQ concat device\n");
328 return -ENXIO;
329 }
330#else
331 mymtd = my_sub_mtd[0];
332
333 /*
334 *In the very near future, command line partition parsing
335 * will use the device name as 'mtd-id' instead of a value
336 * passed to the parse_cmdline_partitions() routine. Since
337 * the bootldr says 'ipaq', make sure it continues to work.
338 */
339 mymtd->name = "ipaq";
340
341 if ((machine_is_h3600())) {
342# ifdef CONFIG_LAB
343 h3xxx_partitions[1].size = my_sub_mtd[0]->size - 0x80000;
344# else
345 h3xxx_partitions[1].size = my_sub_mtd[0]->size - 0x40000;
346# endif
347 nb_parts = 2;
348 } else {
349# ifdef CONFIG_LAB
350 h3xxx_partitions[1].size = my_sub_mtd[0]->size - 0x40000 - 0x80000; /* extra big boot block */
351# else
352 h3xxx_partitions[1].size = my_sub_mtd[0]->size - 2*0x40000;
353# endif
354 h3xxx_partitions[2].offset = my_sub_mtd[0]->size - 0x40000;
355 }
356
357 if (my_sub_mtd[1]) {
358# ifdef CONFIG_LAB
359 h3xxx_partitions_bank2[0].size = my_sub_mtd[1]->size - 0x80000;
360# else
361 h3xxx_partitions_bank2[0].size = my_sub_mtd[1]->size - 0x40000;
362# endif
363 h3xxx_partitions_bank2[1].offset = my_sub_mtd[1]->size - 0x40000;
364 }
365#endif
366 }
367 else {
368 /*
369 * Now let's probe for the actual flash. Do it here since
370 * specific machine settings might have been set above.
371 */
372 printk(KERN_NOTICE "IPAQ flash: probing %d-bit flash bus, window=%lx\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt);
373 mymtd = do_map_probe("cfi_probe", &ipaq_map[0]);
374 if (!mymtd)
375 return -ENXIO;
376 mymtd->owner = THIS_MODULE;
377 }
378
379
380 /*
381 * Dynamic partition selection stuff (might override the static ones)
382 */
383
384 i = parse_mtd_partitions(mymtd, part_probes, &parsed_parts, 0);
385
386 if (i > 0) {
387 nb_parts = parsed_nr_parts = i;
388 parts = parsed_parts;
389 part_type = "dynamic";
390 }
391
392 if (!parts) {
393 printk(KERN_NOTICE "IPAQ flash: no partition info available, registering whole flash at once\n");
394 add_mtd_device(mymtd);
395#ifndef CONFIG_MTD_CONCAT
396 if (my_sub_mtd[1])
397 add_mtd_device(my_sub_mtd[1]);
398#endif
399 } else {
400 printk(KERN_NOTICE "Using %s partition definition\n", part_type);
401 add_mtd_partitions(mymtd, parts, nb_parts);
402#ifndef CONFIG_MTD_CONCAT
403 if (my_sub_mtd[1])
404 add_mtd_partitions(my_sub_mtd[1], h3xxx_partitions_bank2, ARRAY_SIZE(h3xxx_partitions_bank2));
405#endif
406 }
407
408 return 0;
409}
410
411static void __exit ipaq_mtd_cleanup(void)
412{
413 int i;
414
415 if (mymtd) {
416 del_mtd_partitions(mymtd);
417#ifndef CONFIG_MTD_CONCAT
418 if (my_sub_mtd[1])
419 del_mtd_partitions(my_sub_mtd[1]);
420#endif
421 map_destroy(mymtd);
422#ifdef CONFIG_MTD_CONCAT
423 for(i=0; i<MAX_IPAQ_CS; i++)
424#else
425 for(i=1; i<MAX_IPAQ_CS; i++)
426#endif
427 {
428 if (my_sub_mtd[i])
429 map_destroy(my_sub_mtd[i]);
430 }
431 kfree(parsed_parts);
432 }
433}
434
435static int __init h1900_special_case(void)
436{
437 /* The iPAQ h1900 is a special case - it has weird ROM. */
438 simple_map_init(&ipaq_map[0]);
439 ipaq_map[0].size = 0x80000;
440 ipaq_map[0].set_vpp = h3xxx_set_vpp;
441 ipaq_map[0].phys = 0x0;
442 ipaq_map[0].virt = ioremap(0x0, 0x04000000);
443 ipaq_map[0].bankwidth = 2;
444
445 printk(KERN_NOTICE "iPAQ flash: probing %d-bit flash bus, window=%lx with JEDEC.\n", ipaq_map[0].bankwidth*8, ipaq_map[0].virt);
446 mymtd = do_map_probe("jedec_probe", &ipaq_map[0]);
447 if (!mymtd)
448 return -ENODEV;
449 add_mtd_device(mymtd);
450 printk(KERN_NOTICE "iPAQ flash: registered h1910 flash\n");
451
452 return 0;
453}
454
455module_init(ipaq_mtd_init);
456module_exit(ipaq_mtd_cleanup);
457
458MODULE_AUTHOR("Jamey Hicks");
459MODULE_DESCRIPTION("IPAQ CFI map driver");
460MODULE_LICENSE("MIT");
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c
index 7214b876feba..7b0515297411 100644
--- a/drivers/mtd/maps/ixp4xx.c
+++ b/drivers/mtd/maps/ixp4xx.c
@@ -210,7 +210,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
210 * not attempt to do a direct access on us. 210 * not attempt to do a direct access on us.
211 */ 211 */
212 info->map.phys = NO_XIP; 212 info->map.phys = NO_XIP;
213 info->map.size = dev->resource->end - dev->resource->start + 1; 213 info->map.size = resource_size(dev->resource);
214 214
215 /* 215 /*
216 * We only support 16-bit accesses for now. If and when 216 * We only support 16-bit accesses for now. If and when
@@ -224,7 +224,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
224 info->map.copy_from = ixp4xx_copy_from, 224 info->map.copy_from = ixp4xx_copy_from,
225 225
226 info->res = request_mem_region(dev->resource->start, 226 info->res = request_mem_region(dev->resource->start,
227 dev->resource->end - dev->resource->start + 1, 227 resource_size(dev->resource),
228 "IXP4XXFlash"); 228 "IXP4XXFlash");
229 if (!info->res) { 229 if (!info->res) {
230 printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n"); 230 printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
@@ -233,7 +233,7 @@ static int ixp4xx_flash_probe(struct platform_device *dev)
233 } 233 }
234 234
235 info->map.virt = ioremap(dev->resource->start, 235 info->map.virt = ioremap(dev->resource->start,
236 dev->resource->end - dev->resource->start + 1); 236 resource_size(dev->resource));
237 if (!info->map.virt) { 237 if (!info->map.virt) {
238 printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n"); 238 printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
239 err = -EIO; 239 err = -EIO;
diff --git a/drivers/mtd/maps/octagon-5066.c b/drivers/mtd/maps/octagon-5066.c
index 2b2e45093218..23fe1786770f 100644
--- a/drivers/mtd/maps/octagon-5066.c
+++ b/drivers/mtd/maps/octagon-5066.c
@@ -24,7 +24,6 @@
24 ##################################################################### */ 24 ##################################################################### */
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/slab.h>
28#include <linux/ioport.h> 27#include <linux/ioport.h>
29#include <linux/init.h> 28#include <linux/init.h>
30#include <asm/io.h> 29#include <asm/io.h>
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
deleted file mode 100644
index a24478102b11..000000000000
--- a/drivers/mtd/maps/omap_nor.c
+++ /dev/null
@@ -1,188 +0,0 @@
1/*
2 * Flash memory support for various TI OMAP boards
3 *
4 * Copyright (C) 2001-2002 MontaVista Software Inc.
5 * Copyright (C) 2003-2004 Texas Instruments
6 * Copyright (C) 2004 Nokia Corporation
7 *
8 * Assembled using driver code copyright the companies above
9 * and written by David Brownell, Jian Zhang <jzhang@ti.com>,
10 * Tony Lindgren <tony@atomide.com> and others.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33#include <linux/platform_device.h>
34#include <linux/module.h>
35#include <linux/types.h>
36#include <linux/kernel.h>
37#include <linux/init.h>
38#include <linux/ioport.h>
39#include <linux/slab.h>
40
41#include <linux/mtd/mtd.h>
42#include <linux/mtd/map.h>
43#include <linux/mtd/partitions.h>
44
45#include <asm/io.h>
46#include <mach/hardware.h>
47#include <asm/mach/flash.h>
48#include <mach/tc.h>
49
50#ifdef CONFIG_MTD_PARTITIONS
51static const char *part_probes[] = { /* "RedBoot", */ "cmdlinepart", NULL };
52#endif
53
54struct omapflash_info {
55 struct mtd_partition *parts;
56 struct mtd_info *mtd;
57 struct map_info map;
58};
59
60static void omap_set_vpp(struct map_info *map, int enable)
61{
62 static int count;
63 u32 l;
64
65 if (cpu_class_is_omap1()) {
66 if (enable) {
67 if (count++ == 0) {
68 l = omap_readl(EMIFS_CONFIG);
69 l |= OMAP_EMIFS_CONFIG_WP;
70 omap_writel(l, EMIFS_CONFIG);
71 }
72 } else {
73 if (count && (--count == 0)) {
74 l = omap_readl(EMIFS_CONFIG);
75 l &= ~OMAP_EMIFS_CONFIG_WP;
76 omap_writel(l, EMIFS_CONFIG);
77 }
78 }
79 }
80}
81
82static int __init omapflash_probe(struct platform_device *pdev)
83{
84 int err;
85 struct omapflash_info *info;
86 struct flash_platform_data *pdata = pdev->dev.platform_data;
87 struct resource *res = pdev->resource;
88 unsigned long size = res->end - res->start + 1;
89
90 info = kzalloc(sizeof(struct omapflash_info), GFP_KERNEL);
91 if (!info)
92 return -ENOMEM;
93
94 if (!request_mem_region(res->start, size, "flash")) {
95 err = -EBUSY;
96 goto out_free_info;
97 }
98
99 info->map.virt = ioremap(res->start, size);
100 if (!info->map.virt) {
101 err = -ENOMEM;
102 goto out_release_mem_region;
103 }
104 info->map.name = dev_name(&pdev->dev);
105 info->map.phys = res->start;
106 info->map.size = size;
107 info->map.bankwidth = pdata->width;
108 info->map.set_vpp = omap_set_vpp;
109
110 simple_map_init(&info->map);
111 info->mtd = do_map_probe(pdata->map_name, &info->map);
112 if (!info->mtd) {
113 err = -EIO;
114 goto out_iounmap;
115 }
116 info->mtd->owner = THIS_MODULE;
117
118 info->mtd->dev.parent = &pdev->dev;
119
120#ifdef CONFIG_MTD_PARTITIONS
121 err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0);
122 if (err > 0)
123 add_mtd_partitions(info->mtd, info->parts, err);
124 else if (err <= 0 && pdata->parts)
125 add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts);
126 else
127#endif
128 add_mtd_device(info->mtd);
129
130 platform_set_drvdata(pdev, info);
131
132 return 0;
133
134out_iounmap:
135 iounmap(info->map.virt);
136out_release_mem_region:
137 release_mem_region(res->start, size);
138out_free_info:
139 kfree(info);
140
141 return err;
142}
143
144static int __exit omapflash_remove(struct platform_device *pdev)
145{
146 struct omapflash_info *info = platform_get_drvdata(pdev);
147
148 platform_set_drvdata(pdev, NULL);
149
150 if (info) {
151 if (info->parts) {
152 del_mtd_partitions(info->mtd);
153 kfree(info->parts);
154 } else
155 del_mtd_device(info->mtd);
156 map_destroy(info->mtd);
157 release_mem_region(info->map.phys, info->map.size);
158 iounmap((void __iomem *) info->map.virt);
159 kfree(info);
160 }
161
162 return 0;
163}
164
165static struct platform_driver omapflash_driver = {
166 .remove = __exit_p(omapflash_remove),
167 .driver = {
168 .name = "omapflash",
169 .owner = THIS_MODULE,
170 },
171};
172
173static int __init omapflash_init(void)
174{
175 return platform_driver_probe(&omapflash_driver, omapflash_probe);
176}
177
178static void __exit omapflash_exit(void)
179{
180 platform_driver_unregister(&omapflash_driver);
181}
182
183module_init(omapflash_init);
184module_exit(omapflash_exit);
185
186MODULE_LICENSE("GPL");
187MODULE_DESCRIPTION("MTD NOR map driver for TI OMAP boards");
188MODULE_ALIAS("platform:omapflash");
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c
index d600c2deff73..689d6a79ffc0 100644
--- a/drivers/mtd/maps/pcmciamtd.c
+++ b/drivers/mtd/maps/pcmciamtd.c
@@ -118,11 +118,9 @@ static caddr_t remap_window(struct map_info *map, unsigned long to)
118 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", 118 DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x",
119 dev->offset, mrq.CardOffset); 119 dev->offset, mrq.CardOffset);
120 mrq.Page = 0; 120 mrq.Page = 0;
121 ret = pcmcia_map_mem_page(win, &mrq); 121 ret = pcmcia_map_mem_page(dev->p_dev, win, &mrq);
122 if (ret != 0) { 122 if (ret != 0)
123 cs_error(dev->p_dev, MapMemPage, ret);
124 return NULL; 123 return NULL;
125 }
126 dev->offset = mrq.CardOffset; 124 dev->offset = mrq.CardOffset;
127 } 125 }
128 return dev->win_base + (to & (dev->win_size-1)); 126 return dev->win_base + (to & (dev->win_size-1));
@@ -327,8 +325,6 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on)
327 325
328 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); 326 DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp);
329 ret = pcmcia_modify_configuration(link, &mod); 327 ret = pcmcia_modify_configuration(link, &mod);
330 if (ret != 0)
331 cs_error(link, ModifyConfiguration, ret);
332} 328}
333 329
334 330
@@ -348,107 +344,116 @@ static void pcmciamtd_release(struct pcmcia_device *link)
348 iounmap(dev->win_base); 344 iounmap(dev->win_base);
349 dev->win_base = NULL; 345 dev->win_base = NULL;
350 } 346 }
351 pcmcia_release_window(link->win); 347 pcmcia_release_window(link, link->win);
352 } 348 }
353 pcmcia_disable_device(link); 349 pcmcia_disable_device(link);
354} 350}
355 351
356 352
357static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name) 353#ifdef CONFIG_MTD_DEBUG
354static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev,
355 tuple_t *tuple,
356 void *priv_data)
358{ 357{
359 int rc;
360 tuple_t tuple;
361 cisparse_t parse; 358 cisparse_t parse;
362 u_char buf[64];
363
364 tuple.Attributes = 0;
365 tuple.TupleData = (cisdata_t *)buf;
366 tuple.TupleDataMax = sizeof(buf);
367 tuple.TupleOffset = 0;
368 tuple.DesiredTuple = RETURN_FIRST_TUPLE;
369
370 rc = pcmcia_get_first_tuple(link, &tuple);
371 while (rc == 0) {
372 rc = pcmcia_get_tuple_data(link, &tuple);
373 if (rc != 0) {
374 cs_error(link, GetTupleData, rc);
375 break;
376 }
377 rc = pcmcia_parse_tuple(&tuple, &parse);
378 if (rc != 0) {
379 cs_error(link, ParseTuple, rc);
380 break;
381 }
382 359
383 switch(tuple.TupleCode) { 360 if (!pcmcia_parse_tuple(tuple, &parse)) {
384 case CISTPL_FORMAT: { 361 cistpl_format_t *t = &parse.format;
385 cistpl_format_t *t = &parse.format; 362 (void)t; /* Shut up, gcc */
386 (void)t; /* Shut up, gcc */ 363 DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u",
387 DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u", 364 t->type, t->edc, t->offset, t->length);
388 t->type, t->edc, t->offset, t->length); 365 }
389 break; 366 return -ENOSPC;
367}
390 368
391 } 369static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev,
370 tuple_t *tuple,
371 void *priv_data)
372{
373 cisparse_t parse;
374 int i;
392 375
393 case CISTPL_DEVICE: { 376 if (!pcmcia_parse_tuple(tuple, &parse)) {
394 cistpl_device_t *t = &parse.device; 377 cistpl_jedec_t *t = &parse.jedec;
395 int i; 378 for (i = 0; i < t->nid; i++)
396 DEBUG(2, "Common memory:"); 379 DEBUG(2, "JEDEC: 0x%02x 0x%02x", t->id[i].mfr, t->id[i].info);
397 dev->pcmcia_map.size = t->dev[0].size; 380 }
398 for(i = 0; i < t->ndev; i++) { 381 return -ENOSPC;
399 DEBUG(2, "Region %d, type = %u", i, t->dev[i].type); 382}
400 DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp); 383#endif
401 DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed);
402 DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size);
403 }
404 break;
405 }
406 384
407 case CISTPL_VERS_1: { 385static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev,
408 cistpl_vers_1_t *t = &parse.version_1; 386 tuple_t *tuple,
409 int i; 387 void *priv_data)
410 if(t->ns) { 388{
411 dev->mtd_name[0] = '\0'; 389 struct pcmciamtd_dev *dev = priv_data;
412 for(i = 0; i < t->ns; i++) { 390 cisparse_t parse;
413 if(i) 391 cistpl_device_t *t = &parse.device;
414 strcat(dev->mtd_name, " "); 392 int i;
415 strcat(dev->mtd_name, t->str+t->ofs[i]);
416 }
417 }
418 DEBUG(2, "Found name: %s", dev->mtd_name);
419 break;
420 }
421 393
422 case CISTPL_JEDEC_C: { 394 if (pcmcia_parse_tuple(tuple, &parse))
423 cistpl_jedec_t *t = &parse.jedec; 395 return -EINVAL;
424 int i; 396
425 for(i = 0; i < t->nid; i++) { 397 DEBUG(2, "Common memory:");
426 DEBUG(2, "JEDEC: 0x%02x 0x%02x", t->id[i].mfr, t->id[i].info); 398 dev->pcmcia_map.size = t->dev[0].size;
427 } 399 /* from here on: DEBUG only */
428 break; 400 for (i = 0; i < t->ndev; i++) {
429 } 401 DEBUG(2, "Region %d, type = %u", i, t->dev[i].type);
402 DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp);
403 DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed);
404 DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size);
405 }
406 return 0;
407}
430 408
431 case CISTPL_DEVICE_GEO: { 409static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev,
432 cistpl_device_geo_t *t = &parse.device_geo; 410 tuple_t *tuple,
433 int i; 411 void *priv_data)
434 dev->pcmcia_map.bankwidth = t->geo[0].buswidth; 412{
435 for(i = 0; i < t->ngeo; i++) { 413 struct pcmciamtd_dev *dev = priv_data;
436 DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth); 414 cisparse_t parse;
437 DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block); 415 cistpl_device_geo_t *t = &parse.device_geo;
438 DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block); 416 int i;
439 DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block);
440 DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition);
441 DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave);
442 }
443 break;
444 }
445 417
446 default: 418 if (pcmcia_parse_tuple(tuple, &parse))
447 DEBUG(2, "Unknown tuple code %d", tuple.TupleCode); 419 return -EINVAL;
448 } 420
421 dev->pcmcia_map.bankwidth = t->geo[0].buswidth;
422 /* from here on: DEBUG only */
423 for (i = 0; i < t->ngeo; i++) {
424 DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth);
425 DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block);
426 DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block);
427 DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block);
428 DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition);
429 DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave);
430 }
431 return 0;
432}
433
434
435static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, int *new_name)
436{
437 int i;
449 438
450 rc = pcmcia_get_next_tuple(link, &tuple); 439 if (p_dev->prod_id[0]) {
440 dev->mtd_name[0] = '\0';
441 for (i = 0; i < 4; i++) {
442 if (i)
443 strcat(dev->mtd_name, " ");
444 if (p_dev->prod_id[i])
445 strcat(dev->mtd_name, p_dev->prod_id[i]);
446 }
447 DEBUG(2, "Found name: %s", dev->mtd_name);
451 } 448 }
449
450#ifdef CONFIG_MTD_DEBUG
451 pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL);
452 pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL);
453#endif
454 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev);
455 pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev);
456
452 if(!dev->pcmcia_map.size) 457 if(!dev->pcmcia_map.size)
453 dev->pcmcia_map.size = MAX_PCMCIA_ADDR; 458 dev->pcmcia_map.size = MAX_PCMCIA_ADDR;
454 459
@@ -481,16 +486,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link,
481 * MTD device available to the system. 486 * MTD device available to the system.
482 */ 487 */
483 488
484#define CS_CHECK(fn, ret) \
485do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
486
487static int pcmciamtd_config(struct pcmcia_device *link) 489static int pcmciamtd_config(struct pcmcia_device *link)
488{ 490{
489 struct pcmciamtd_dev *dev = link->priv; 491 struct pcmciamtd_dev *dev = link->priv;
490 struct mtd_info *mtd = NULL; 492 struct mtd_info *mtd = NULL;
491 cs_status_t status; 493 cs_status_t status;
492 win_req_t req; 494 win_req_t req;
493 int last_ret = 0, last_fn = 0;
494 int ret; 495 int ret;
495 int i; 496 int i;
496 static char *probes[] = { "jedec_probe", "cfi_probe" }; 497 static char *probes[] = { "jedec_probe", "cfi_probe" };
@@ -529,7 +530,7 @@ static int pcmciamtd_config(struct pcmcia_device *link)
529 int ret; 530 int ret;
530 DEBUG(2, "requesting window with size = %dKiB memspeed = %d", 531 DEBUG(2, "requesting window with size = %dKiB memspeed = %d",
531 req.Size >> 10, req.AccessSpeed); 532 req.Size >> 10, req.AccessSpeed);
532 ret = pcmcia_request_window(&link, &req, &link->win); 533 ret = pcmcia_request_window(link, &req, &link->win);
533 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); 534 DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size);
534 if(ret) { 535 if(ret) {
535 req.Size >>= 1; 536 req.Size >>= 1;
@@ -577,7 +578,6 @@ static int pcmciamtd_config(struct pcmcia_device *link)
577 DEBUG(2, "Setting Configuration"); 578 DEBUG(2, "Setting Configuration");
578 ret = pcmcia_request_configuration(link, &link->conf); 579 ret = pcmcia_request_configuration(link, &link->conf);
579 if (ret != 0) { 580 if (ret != 0) {
580 cs_error(link, RequestConfiguration, ret);
581 if (dev->win_base) { 581 if (dev->win_base) {
582 iounmap(dev->win_base); 582 iounmap(dev->win_base);
583 dev->win_base = NULL; 583 dev->win_base = NULL;
@@ -652,8 +652,7 @@ static int pcmciamtd_config(struct pcmcia_device *link)
652 link->dev_node = &dev->node; 652 link->dev_node = &dev->node;
653 return 0; 653 return 0;
654 654
655 cs_failed: 655 failed:
656 cs_error(link, last_fn, last_ret);
657 err("CS Error, exiting"); 656 err("CS Error, exiting");
658 pcmciamtd_release(link); 657 pcmciamtd_release(link);
659 return -ENODEV; 658 return -ENODEV;
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 380648e9051a..d9603f7f9652 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -48,23 +48,22 @@ static int physmap_flash_remove(struct platform_device *dev)
48 48
49 if (info->cmtd) { 49 if (info->cmtd) {
50#ifdef CONFIG_MTD_PARTITIONS 50#ifdef CONFIG_MTD_PARTITIONS
51 if (info->nr_parts || physmap_data->nr_parts) 51 if (info->nr_parts || physmap_data->nr_parts) {
52 del_mtd_partitions(info->cmtd); 52 del_mtd_partitions(info->cmtd);
53 else 53
54 if (info->nr_parts)
55 kfree(info->parts);
56 } else {
54 del_mtd_device(info->cmtd); 57 del_mtd_device(info->cmtd);
58 }
55#else 59#else
56 del_mtd_device(info->cmtd); 60 del_mtd_device(info->cmtd);
57#endif 61#endif
58 }
59#ifdef CONFIG_MTD_PARTITIONS
60 if (info->nr_parts)
61 kfree(info->parts);
62#endif
63
64#ifdef CONFIG_MTD_CONCAT 62#ifdef CONFIG_MTD_CONCAT
65 if (info->cmtd != info->mtd[0]) 63 if (info->cmtd != info->mtd[0])
66 mtd_concat_destroy(info->cmtd); 64 mtd_concat_destroy(info->cmtd);
67#endif 65#endif
66 }
68 67
69 for (i = 0; i < MAX_RESOURCES; i++) { 68 for (i = 0; i < MAX_RESOURCES; i++) {
70 if (info->mtd[i] != NULL) 69 if (info->mtd[i] != NULL)
@@ -130,7 +129,7 @@ static int physmap_flash_probe(struct platform_device *dev)
130 info->map[i].size); 129 info->map[i].size);
131 if (info->map[i].virt == NULL) { 130 if (info->map[i].virt == NULL) {
132 dev_err(&dev->dev, "Failed to ioremap flash region\n"); 131 dev_err(&dev->dev, "Failed to ioremap flash region\n");
133 err = EIO; 132 err = -EIO;
134 goto err_out; 133 goto err_out;
135 } 134 }
136 135
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 61e4eb48bb2d..101ee6ead05c 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -23,6 +23,7 @@
23#include <linux/mtd/concat.h> 23#include <linux/mtd/concat.h>
24#include <linux/of.h> 24#include <linux/of.h>
25#include <linux/of_platform.h> 25#include <linux/of_platform.h>
26#include <linux/slab.h>
26 27
27struct of_flash_list { 28struct of_flash_list {
28 struct mtd_info *mtd; 29 struct mtd_info *mtd;
diff --git a/drivers/mtd/maps/pismo.c b/drivers/mtd/maps/pismo.c
new file mode 100644
index 000000000000..60c068db452d
--- /dev/null
+++ b/drivers/mtd/maps/pismo.c
@@ -0,0 +1,321 @@
1/*
2 * PISMO memory driver - http://www.pismoworld.org/
3 *
4 * For ARM Realview and Versatile platforms
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License.
9 */
10#include <linux/init.h>
11#include <linux/module.h>
12#include <linux/i2c.h>
13#include <linux/slab.h>
14#include <linux/platform_device.h>
15#include <linux/spinlock.h>
16#include <linux/mutex.h>
17#include <linux/mtd/physmap.h>
18#include <linux/mtd/plat-ram.h>
19#include <linux/mtd/pismo.h>
20
21#define PISMO_NUM_CS 5
22
23struct pismo_cs_block {
24 u8 type;
25 u8 width;
26 __le16 access;
27 __le32 size;
28 u32 reserved[2];
29 char device[32];
30} __packed;
31
32struct pismo_eeprom {
33 struct pismo_cs_block cs[PISMO_NUM_CS];
34 char board[15];
35 u8 sum;
36} __packed;
37
38struct pismo_mem {
39 phys_addr_t base;
40 u32 size;
41 u16 access;
42 u8 width;
43 u8 type;
44};
45
46struct pismo_data {
47 struct i2c_client *client;
48 void (*vpp)(void *, int);
49 void *vpp_data;
50 struct platform_device *dev[PISMO_NUM_CS];
51};
52
53/* FIXME: set_vpp could do with a better calling convention */
54static struct pismo_data *vpp_pismo;
55static DEFINE_MUTEX(pismo_mutex);
56
57static int pismo_setvpp_probe_fix(struct pismo_data *pismo)
58{
59 mutex_lock(&pismo_mutex);
60 if (vpp_pismo) {
61 mutex_unlock(&pismo_mutex);
62 kfree(pismo);
63 return -EBUSY;
64 }
65 vpp_pismo = pismo;
66 mutex_unlock(&pismo_mutex);
67 return 0;
68}
69
70static void pismo_setvpp_remove_fix(struct pismo_data *pismo)
71{
72 mutex_lock(&pismo_mutex);
73 if (vpp_pismo == pismo)
74 vpp_pismo = NULL;
75 mutex_unlock(&pismo_mutex);
76}
77
78static void pismo_set_vpp(struct map_info *map, int on)
79{
80 struct pismo_data *pismo = vpp_pismo;
81
82 pismo->vpp(pismo->vpp_data, on);
83}
84/* end of hack */
85
86
87static unsigned int __devinit pismo_width_to_bytes(unsigned int width)
88{
89 width &= 15;
90 if (width > 2)
91 return 0;
92 return 1 << width;
93}
94
95static int __devinit pismo_eeprom_read(struct i2c_client *client, void *buf,
96 u8 addr, size_t size)
97{
98 int ret;
99 struct i2c_msg msg[] = {
100 {
101 .addr = client->addr,
102 .len = sizeof(addr),
103 .buf = &addr,
104 }, {
105 .addr = client->addr,
106 .flags = I2C_M_RD,
107 .len = size,
108 .buf = buf,
109 },
110 };
111
112 ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
113
114 return ret == ARRAY_SIZE(msg) ? size : -EIO;
115}
116
117static int __devinit pismo_add_device(struct pismo_data *pismo, int i,
118 struct pismo_mem *region, const char *name, void *pdata, size_t psize)
119{
120 struct platform_device *dev;
121 struct resource res = { };
122 phys_addr_t base = region->base;
123 int ret;
124
125 if (base == ~0)
126 return -ENXIO;
127
128 res.start = base;
129 res.end = base + region->size - 1;
130 res.flags = IORESOURCE_MEM;
131
132 dev = platform_device_alloc(name, i);
133 if (!dev)
134 return -ENOMEM;
135 dev->dev.parent = &pismo->client->dev;
136
137 do {
138 ret = platform_device_add_resources(dev, &res, 1);
139 if (ret)
140 break;
141
142 ret = platform_device_add_data(dev, pdata, psize);
143 if (ret)
144 break;
145
146 ret = platform_device_add(dev);
147 if (ret)
148 break;
149
150 pismo->dev[i] = dev;
151 return 0;
152 } while (0);
153
154 platform_device_put(dev);
155 return ret;
156}
157
158static int __devinit pismo_add_nor(struct pismo_data *pismo, int i,
159 struct pismo_mem *region)
160{
161 struct physmap_flash_data data = {
162 .width = region->width,
163 };
164
165 if (pismo->vpp)
166 data.set_vpp = pismo_set_vpp;
167
168 return pismo_add_device(pismo, i, region, "physmap-flash",
169 &data, sizeof(data));
170}
171
172static int __devinit pismo_add_sram(struct pismo_data *pismo, int i,
173 struct pismo_mem *region)
174{
175 struct platdata_mtd_ram data = {
176 .bankwidth = region->width,
177 };
178
179 return pismo_add_device(pismo, i, region, "mtd-ram",
180 &data, sizeof(data));
181}
182
183static void __devinit pismo_add_one(struct pismo_data *pismo, int i,
184 const struct pismo_cs_block *cs, phys_addr_t base)
185{
186 struct device *dev = &pismo->client->dev;
187 struct pismo_mem region;
188
189 region.base = base;
190 region.type = cs->type;
191 region.width = pismo_width_to_bytes(cs->width);
192 region.access = le16_to_cpu(cs->access);
193 region.size = le32_to_cpu(cs->size);
194
195 if (region.width == 0) {
196 dev_err(dev, "cs%u: bad width: %02x, ignoring\n", i, cs->width);
197 return;
198 }
199
200 /*
201 * FIXME: may need to the platforms memory controller here, but at
202 * the moment we assume that it has already been correctly setup.
203 * The memory controller can also tell us the base address as well.
204 */
205
206 dev_info(dev, "cs%u: %.32s: type %02x access %u00ps size %uK\n",
207 i, cs->device, region.type, region.access, region.size / 1024);
208
209 switch (region.type) {
210 case 0:
211 break;
212 case 1:
213 /* static DOC */
214 break;
215 case 2:
216 /* static NOR */
217 pismo_add_nor(pismo, i, &region);
218 break;
219 case 3:
220 /* static RAM */
221 pismo_add_sram(pismo, i, &region);
222 break;
223 }
224}
225
226static int __devexit pismo_remove(struct i2c_client *client)
227{
228 struct pismo_data *pismo = i2c_get_clientdata(client);
229 int i;
230
231 for (i = 0; i < ARRAY_SIZE(pismo->dev); i++)
232 platform_device_unregister(pismo->dev[i]);
233
234 /* FIXME: set_vpp needs saner arguments */
235 pismo_setvpp_remove_fix(pismo);
236
237 kfree(pismo);
238
239 return 0;
240}
241
242static int __devinit pismo_probe(struct i2c_client *client,
243 const struct i2c_device_id *id)
244{
245 struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
246 struct pismo_pdata *pdata = client->dev.platform_data;
247 struct pismo_eeprom eeprom;
248 struct pismo_data *pismo;
249 int ret, i;
250
251 if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) {
252 dev_err(&client->dev, "functionality mismatch\n");
253 return -EIO;
254 }
255
256 pismo = kzalloc(sizeof(*pismo), GFP_KERNEL);
257 if (!pismo)
258 return -ENOMEM;
259
260 /* FIXME: set_vpp needs saner arguments */
261 ret = pismo_setvpp_probe_fix(pismo);
262 if (ret)
263 return ret;
264
265 pismo->client = client;
266 if (pdata) {
267 pismo->vpp = pdata->set_vpp;
268 pismo->vpp_data = pdata->vpp_data;
269 }
270 i2c_set_clientdata(client, pismo);
271
272 ret = pismo_eeprom_read(client, &eeprom, 0, sizeof(eeprom));
273 if (ret < 0) {
274 dev_err(&client->dev, "error reading EEPROM: %d\n", ret);
275 return ret;
276 }
277
278 dev_info(&client->dev, "%.15s board found\n", eeprom.board);
279
280 for (i = 0; i < ARRAY_SIZE(eeprom.cs); i++)
281 if (eeprom.cs[i].type != 0xff)
282 pismo_add_one(pismo, i, &eeprom.cs[i],
283 pdata->cs_addrs[i]);
284
285 return 0;
286}
287
288static const struct i2c_device_id pismo_id[] = {
289 { "pismo" },
290 { },
291};
292MODULE_DEVICE_TABLE(i2c, pismo_id);
293
294static struct i2c_driver pismo_driver = {
295 .driver = {
296 .name = "pismo",
297 .owner = THIS_MODULE,
298 },
299 .probe = pismo_probe,
300 .remove = __devexit_p(pismo_remove),
301 .id_table = pismo_id,
302};
303
304static int __init pismo_init(void)
305{
306 BUILD_BUG_ON(sizeof(struct pismo_cs_block) != 48);
307 BUILD_BUG_ON(sizeof(struct pismo_eeprom) != 256);
308
309 return i2c_add_driver(&pismo_driver);
310}
311module_init(pismo_init);
312
313static void __exit pismo_exit(void)
314{
315 i2c_del_driver(&pismo_driver);
316}
317module_exit(pismo_exit);
318
319MODULE_AUTHOR("Russell King <linux@arm.linux.org.uk>");
320MODULE_DESCRIPTION("PISMO memory driver");
321MODULE_LICENSE("GPL");
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index dafb91944e70..76a76be5a7bd 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -4,7 +4,7 @@
4 * http://www.simtec.co.uk/products/SWLINUX/ 4 * http://www.simtec.co.uk/products/SWLINUX/
5 * Ben Dooks <ben@simtec.co.uk> 5 * Ben Dooks <ben@simtec.co.uk>
6 * 6 *
7 * Generic platfrom device based RAM map 7 * Generic platform device based RAM map
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by 10 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/mtd/maps/pmcmsp-flash.c b/drivers/mtd/maps/pmcmsp-flash.c
index c8fd8da4bc87..acb13fa5001c 100644
--- a/drivers/mtd/maps/pmcmsp-flash.c
+++ b/drivers/mtd/maps/pmcmsp-flash.c
@@ -28,6 +28,7 @@
28 * 675 Mass Ave, Cambridge, MA 02139, USA. 28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */ 29 */
30 30
31#include <linux/slab.h>
31#include <linux/module.h> 32#include <linux/module.h>
32#include <linux/types.h> 33#include <linux/types.h>
33#include <linux/kernel.h> 34#include <linux/kernel.h>
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index 74fa075c838a..91dc6331053f 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/slab.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -20,14 +21,23 @@
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <asm/cacheflush.h>
24 24
25#include <asm/mach/flash.h> 25#include <asm/mach/flash.h>
26 26
27#define CACHELINESIZE 32
28
27static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from, 29static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from,
28 ssize_t len) 30 ssize_t len)
29{ 31{
30 flush_ioremap_region(map->phys, map->cached, from, len); 32 unsigned long start = (unsigned long)map->cached + from;
33 unsigned long end = start + len;
34
35 start &= ~(CACHELINESIZE - 1);
36 while (start < end) {
37 /* invalidate D cache line */
38 asm volatile ("mcr p15, 0, %0, c7, c6, 1" : : "r" (start));
39 start += CACHELINESIZE;
40 }
31} 41}
32 42
33struct pxa2xx_flash_info { 43struct pxa2xx_flash_info {
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index d7a47574d21e..f3af87e08ecd 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -248,7 +248,7 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla
248 plat->exit(); 248 plat->exit();
249} 249}
250 250
251static struct sa_info *__init 251static struct sa_info *__devinit
252sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) 252sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
253{ 253{
254 struct sa_info *info; 254 struct sa_info *info;
diff --git a/drivers/mtd/maps/sbc_gxx.c b/drivers/mtd/maps/sbc_gxx.c
index 1b1c0b7e11ef..04b2781fc627 100644
--- a/drivers/mtd/maps/sbc_gxx.c
+++ b/drivers/mtd/maps/sbc_gxx.c
@@ -45,7 +45,6 @@ separate MTD devices.
45// Includes 45// Includes
46 46
47#include <linux/module.h> 47#include <linux/module.h>
48#include <linux/slab.h>
49#include <linux/ioport.h> 48#include <linux/ioport.h>
50#include <linux/init.h> 49#include <linux/init.h>
51#include <asm/io.h> 50#include <asm/io.h>
diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c
index fd7a1017399a..fadc4c45b455 100644
--- a/drivers/mtd/maps/sun_uflash.c
+++ b/drivers/mtd/maps/sun_uflash.c
@@ -15,6 +15,7 @@
15#include <linux/ioport.h> 15#include <linux/ioport.h>
16#include <linux/of.h> 16#include <linux/of.h>
17#include <linux/of_device.h> 17#include <linux/of_device.h>
18#include <linux/slab.h>
18#include <asm/prom.h> 19#include <asm/prom.h>
19#include <asm/uaccess.h> 20#include <asm/uaccess.h>
20#include <asm/io.h> 21#include <asm/io.h>
diff --git a/drivers/mtd/maps/vmax301.c b/drivers/mtd/maps/vmax301.c
index 6d452dcdfe34..6adaa6acc193 100644
--- a/drivers/mtd/maps/vmax301.c
+++ b/drivers/mtd/maps/vmax301.c
@@ -16,7 +16,6 @@
16 ##################################################################### */ 16 ##################################################################### */
17 17
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/slab.h>
20#include <linux/ioport.h> 19#include <linux/ioport.h>
21#include <linux/init.h> 20#include <linux/init.h>
22#include <linux/spinlock.h> 21#include <linux/spinlock.h>
diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c
index 1f73297e7776..4afc167731ef 100644
--- a/drivers/mtd/maps/vmu-flash.c
+++ b/drivers/mtd/maps/vmu-flash.c
@@ -8,6 +8,7 @@
8 * GNU General Public Licence 8 * GNU General Public Licence
9 */ 9 */
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/slab.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/delay.h> 13#include <linux/delay.h>
13#include <linux/maple.h> 14#include <linux/maple.h>
@@ -612,16 +613,15 @@ static int __devinit vmu_connect(struct maple_device *mdev)
612 613
613 test_flash_data = be32_to_cpu(mdev->devinfo.function); 614 test_flash_data = be32_to_cpu(mdev->devinfo.function);
614 /* Need to count how many bits are set - to find out which 615 /* Need to count how many bits are set - to find out which
615 * function_data element has details of the memory card: 616 * function_data element has details of the memory card
616 * using Brian Kernighan's/Peter Wegner's method */ 617 */
617 for (c = 0; test_flash_data; c++) 618 c = hweight_long(test_flash_data);
618 test_flash_data &= test_flash_data - 1;
619 619
620 basic_flash_data = be32_to_cpu(mdev->devinfo.function_data[c - 1]); 620 basic_flash_data = be32_to_cpu(mdev->devinfo.function_data[c - 1]);
621 621
622 card = kmalloc(sizeof(struct memcard), GFP_KERNEL); 622 card = kmalloc(sizeof(struct memcard), GFP_KERNEL);
623 if (!card) { 623 if (!card) {
624 error = ENOMEM; 624 error = -ENOMEM;
625 goto fail_nomem; 625 goto fail_nomem;
626 } 626 }
627 627