diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-09 13:15:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-05-09 13:15:46 -0400 |
commit | a637b0d45947df686979b85361ad5bfa9d19fdd3 (patch) | |
tree | 926207cdfbbde430d1e7b515f32fe1c740b15745 /drivers/mtd/maps | |
parent | f78089e87e576f91396a5d428d14b552178dfb17 (diff) | |
parent | cdb6404cc53a166a1e3b0179bd8d1f4070beff41 (diff) |
Merge tag 'for-linus-20130509' of git://git.infradead.org/linux-mtd
Pull MTD update from David Woodhouse:
- Lots of cleanups from Artem, including deletion of some obsolete
drivers
- Support partitions larger than 4GiB in device tree
- Support for new SPI chips
* tag 'for-linus-20130509' of git://git.infradead.org/linux-mtd: (83 commits)
mtd: omap2: Use module_platform_driver()
mtd: bf5xx_nand: Use module_platform_driver()
mtd: denali_dt: Remove redundant use of of_match_ptr
mtd: denali_dt: Change return value to fix smatch warning
mtd: denali_dt: Use module_platform_driver()
mtd: denali_dt: Fix incorrect error check
mtd: nand: subpage write support for hardware based ECC schemes
mtd: omap2: use msecs_to_jiffies()
mtd: nand_ids: use size macros
mtd: nand_ids: improve LEGACY_ID_NAND macro a bit
mtd: add 4 Toshiba nand chips for the full-id case
mtd: add the support to parse out the full-id nand type
mtd: add new fields to nand_flash_dev{}
mtd: sh_flctl: Use of_match_ptr() macro
mtd: gpio: Use of_match_ptr() macro
mtd: gpio: Use devm_kzalloc()
mtd: davinci_nand: Use of_match_ptr()
mtd: dataflash: Use of_match_ptr() macro
mtd: remove h720x flash support
mtd: onenand: remove OneNAND simulator
...
Diffstat (limited to 'drivers/mtd/maps')
27 files changed, 39 insertions, 1679 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index c26938382f64..bed9d58d5741 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -249,22 +249,6 @@ config MTD_LANTIQ | |||
249 | help | 249 | help |
250 | Support for NOR flash attached to the Lantiq SoC's External Bus Unit. | 250 | Support for NOR flash attached to the Lantiq SoC's External Bus Unit. |
251 | 251 | ||
252 | config MTD_DILNETPC | ||
253 | tristate "CFI Flash device mapped on DIL/Net PC" | ||
254 | depends on X86 && MTD_CFI_INTELEXT && BROKEN | ||
255 | help | ||
256 | MTD map driver for SSV DIL/Net PC Boards "DNP" and "ADNP". | ||
257 | For details, see <http://www.ssv-embedded.de/ssv/pc104/p169.htm> | ||
258 | and <http://www.ssv-embedded.de/ssv/pc104/p170.htm> | ||
259 | |||
260 | config MTD_DILNETPC_BOOTSIZE | ||
261 | hex "Size of DIL/Net PC flash boot partition" | ||
262 | depends on MTD_DILNETPC | ||
263 | default "0x80000" | ||
264 | help | ||
265 | The amount of space taken up by the kernel or Etherboot | ||
266 | on the DIL/Net PC flash chips. | ||
267 | |||
268 | config MTD_L440GX | 252 | config MTD_L440GX |
269 | tristate "BIOS flash chip on Intel L440GX boards" | 253 | tristate "BIOS flash chip on Intel L440GX boards" |
270 | depends on X86 && MTD_JEDECPROBE | 254 | depends on X86 && MTD_JEDECPROBE |
@@ -274,42 +258,6 @@ config MTD_L440GX | |||
274 | 258 | ||
275 | BE VERY CAREFUL. | 259 | BE VERY CAREFUL. |
276 | 260 | ||
277 | config MTD_TQM8XXL | ||
278 | tristate "CFI Flash device mapped on TQM8XXL" | ||
279 | depends on MTD_CFI && TQM8xxL | ||
280 | help | ||
281 | The TQM8xxL PowerPC board has up to two banks of CFI-compliant | ||
282 | chips, currently uses AMD one. This 'mapping' driver supports | ||
283 | that arrangement, allowing the CFI probe and command set driver | ||
284 | code to communicate with the chips on the TQM8xxL board. More at | ||
285 | <http://www.denx.de/wiki/PPCEmbedded/>. | ||
286 | |||
287 | config MTD_RPXLITE | ||
288 | tristate "CFI Flash device mapped on RPX Lite or CLLF" | ||
289 | depends on MTD_CFI && (RPXCLASSIC || RPXLITE) | ||
290 | help | ||
291 | The RPXLite PowerPC board has CFI-compliant chips mapped in | ||
292 | a strange sparse mapping. This 'mapping' driver supports that | ||
293 | arrangement, allowing the CFI probe and command set driver code | ||
294 | to communicate with the chips on the RPXLite board. More at | ||
295 | <http://www.embeddedplanet.com/>. | ||
296 | |||
297 | config MTD_MBX860 | ||
298 | tristate "System flash on MBX860 board" | ||
299 | depends on MTD_CFI && MBX | ||
300 | help | ||
301 | This enables access routines for the flash chips on the Motorola | ||
302 | MBX860 board. If you have one of these boards and would like | ||
303 | to use the flash chips on it, say 'Y'. | ||
304 | |||
305 | config MTD_DBOX2 | ||
306 | tristate "CFI Flash device mapped on D-Box2" | ||
307 | depends on DBOX2 && MTD_CFI_INTELSTD && MTD_CFI_INTELEXT && MTD_CFI_AMDSTD | ||
308 | help | ||
309 | This enables access routines for the flash chips on the Nokia/Sagem | ||
310 | D-Box 2 board. If you have one of these boards and would like to use | ||
311 | the flash chips on it, say 'Y'. | ||
312 | |||
313 | config MTD_CFI_FLAGADM | 261 | config MTD_CFI_FLAGADM |
314 | tristate "CFI Flash device mapping on FlagaDM" | 262 | tristate "CFI Flash device mapping on FlagaDM" |
315 | depends on 8xx && MTD_CFI | 263 | depends on 8xx && MTD_CFI |
@@ -349,15 +297,6 @@ config MTD_IXP4XX | |||
349 | IXDP425 and Coyote. If you have an IXP4xx based board and | 297 | IXDP425 and Coyote. If you have an IXP4xx based board and |
350 | would like to use the flash chips on it, say 'Y'. | 298 | would like to use the flash chips on it, say 'Y'. |
351 | 299 | ||
352 | config MTD_IXP2000 | ||
353 | tristate "CFI Flash device mapped on Intel IXP2000 based systems" | ||
354 | depends on MTD_CFI && MTD_COMPLEX_MAPPINGS && ARCH_IXP2000 | ||
355 | help | ||
356 | This enables MTD access to flash devices on platforms based | ||
357 | on Intel's IXP2000 family of network processors. If you have an | ||
358 | IXP2000 based board and would like to use the flash chips on it, | ||
359 | say 'Y'. | ||
360 | |||
361 | config MTD_AUTCPU12 | 300 | config MTD_AUTCPU12 |
362 | bool "NV-RAM mapping AUTCPU12 board" | 301 | bool "NV-RAM mapping AUTCPU12 board" |
363 | depends on ARCH_AUTCPU12 | 302 | depends on ARCH_AUTCPU12 |
@@ -372,13 +311,6 @@ config MTD_IMPA7 | |||
372 | This enables access to the NOR Flash on the impA7 board of | 311 | This enables access to the NOR Flash on the impA7 board of |
373 | implementa GmbH. If you have such a board, say 'Y' here. | 312 | implementa GmbH. If you have such a board, say 'Y' here. |
374 | 313 | ||
375 | config MTD_H720X | ||
376 | tristate "Hynix evaluation board mappings" | ||
377 | depends on MTD_CFI && ( ARCH_H7201 || ARCH_H7202 ) | ||
378 | help | ||
379 | This enables access to the flash chips on the Hynix evaluation boards. | ||
380 | If you have such a board, say 'Y'. | ||
381 | |||
382 | # This needs CFI or JEDEC, depending on the cards found. | 314 | # This needs CFI or JEDEC, depending on the cards found. |
383 | config MTD_PCI | 315 | config MTD_PCI |
384 | tristate "PCI MTD driver" | 316 | tristate "PCI MTD driver" |
@@ -433,15 +365,6 @@ config MTD_UCLINUX | |||
433 | help | 365 | help |
434 | Map driver to support image based filesystems for uClinux. | 366 | Map driver to support image based filesystems for uClinux. |
435 | 367 | ||
436 | config MTD_DMV182 | ||
437 | tristate "Map driver for Dy-4 SVME/DMV-182 board." | ||
438 | depends on DMV182 | ||
439 | select MTD_MAP_BANK_WIDTH_32 | ||
440 | select MTD_CFI_I8 | ||
441 | select MTD_CFI_AMDSTD | ||
442 | help | ||
443 | Map driver for Dy-4 SVME/DMV-182 board. | ||
444 | |||
445 | config MTD_INTEL_VR_NOR | 368 | config MTD_INTEL_VR_NOR |
446 | tristate "NOR flash on Intel Vermilion Range Expansion Bus CS0" | 369 | tristate "NOR flash on Intel Vermilion Range Expansion Bus CS0" |
447 | depends on PCI | 370 | depends on PCI |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 4ded28711bc1..395a12444048 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -9,7 +9,6 @@ endif | |||
9 | # Chip mappings | 9 | # Chip mappings |
10 | obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o | 10 | obj-$(CONFIG_MTD_CFI_FLAGADM) += cfi_flagadm.o |
11 | obj-$(CONFIG_MTD_DC21285) += dc21285.o | 11 | obj-$(CONFIG_MTD_DC21285) += dc21285.o |
12 | obj-$(CONFIG_MTD_DILNETPC) += dilnetpc.o | ||
13 | obj-$(CONFIG_MTD_L440GX) += l440gx.o | 12 | obj-$(CONFIG_MTD_L440GX) += l440gx.o |
14 | obj-$(CONFIG_MTD_AMD76XROM) += amd76xrom.o | 13 | obj-$(CONFIG_MTD_AMD76XROM) += amd76xrom.o |
15 | obj-$(CONFIG_MTD_ESB2ROM) += esb2rom.o | 14 | obj-$(CONFIG_MTD_ESB2ROM) += esb2rom.o |
@@ -17,15 +16,12 @@ obj-$(CONFIG_MTD_ICHXROM) += ichxrom.o | |||
17 | obj-$(CONFIG_MTD_CK804XROM) += ck804xrom.o | 16 | obj-$(CONFIG_MTD_CK804XROM) += ck804xrom.o |
18 | obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o | 17 | obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o |
19 | obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o | 18 | obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o |
20 | obj-$(CONFIG_MTD_MBX860) += mbx860.o | ||
21 | obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o | 19 | obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o |
22 | obj-$(CONFIG_MTD_PHYSMAP) += physmap.o | 20 | obj-$(CONFIG_MTD_PHYSMAP) += physmap.o |
23 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o | 21 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o |
24 | obj-$(CONFIG_MTD_PISMO) += pismo.o | 22 | obj-$(CONFIG_MTD_PISMO) += pismo.o |
25 | obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o | 23 | obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o |
26 | obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o | 24 | obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o |
27 | obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o | ||
28 | obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o | ||
29 | obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o | 25 | obj-$(CONFIG_MTD_SA1100) += sa1100-flash.o |
30 | obj-$(CONFIG_MTD_SBC_GXX) += sbc_gxx.o | 26 | obj-$(CONFIG_MTD_SBC_GXX) += sbc_gxx.o |
31 | obj-$(CONFIG_MTD_SC520CDP) += sc520cdp.o | 27 | obj-$(CONFIG_MTD_SC520CDP) += sc520cdp.o |
@@ -34,7 +30,6 @@ obj-$(CONFIG_MTD_TS5500) += ts5500_flash.o | |||
34 | obj-$(CONFIG_MTD_SUN_UFLASH) += sun_uflash.o | 30 | obj-$(CONFIG_MTD_SUN_UFLASH) += sun_uflash.o |
35 | obj-$(CONFIG_MTD_VMAX) += vmax301.o | 31 | obj-$(CONFIG_MTD_VMAX) += vmax301.o |
36 | obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o | 32 | obj-$(CONFIG_MTD_SCx200_DOCFLASH)+= scx200_docflash.o |
37 | obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o | ||
38 | obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o | 33 | obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o |
39 | obj-$(CONFIG_MTD_PCI) += pci.o | 34 | obj-$(CONFIG_MTD_PCI) += pci.o |
40 | obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o | 35 | obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o |
@@ -42,10 +37,7 @@ obj-$(CONFIG_MTD_IMPA7) += impa7.o | |||
42 | obj-$(CONFIG_MTD_UCLINUX) += uclinux.o | 37 | obj-$(CONFIG_MTD_UCLINUX) += uclinux.o |
43 | obj-$(CONFIG_MTD_NETtel) += nettel.o | 38 | obj-$(CONFIG_MTD_NETtel) += nettel.o |
44 | obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o | 39 | obj-$(CONFIG_MTD_SCB2_FLASH) += scb2_flash.o |
45 | obj-$(CONFIG_MTD_H720X) += h720x-flash.o | ||
46 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o | 40 | obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o |
47 | obj-$(CONFIG_MTD_IXP2000) += ixp2000.o | ||
48 | obj-$(CONFIG_MTD_DMV182) += dmv182.o | ||
49 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o | 41 | obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o |
50 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o | 42 | obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o |
51 | obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o | 43 | obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o |
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index f833edfaab79..319b04a6c9d1 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c | |||
@@ -122,7 +122,8 @@ static void bfin_flash_copy_to(struct map_info *map, unsigned long to, const voi | |||
122 | switch_back(state); | 122 | switch_back(state); |
123 | } | 123 | } |
124 | 124 | ||
125 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; | 125 | static const char * const part_probe_types[] = { |
126 | "cmdlinepart", "RedBoot", NULL }; | ||
126 | 127 | ||
127 | static int bfin_flash_probe(struct platform_device *pdev) | 128 | static int bfin_flash_probe(struct platform_device *pdev) |
128 | { | 129 | { |
diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 586a1c77e48a..0455166f05fa 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c | |||
@@ -308,8 +308,7 @@ static int ck804xrom_init_one(struct pci_dev *pdev, | |||
308 | 308 | ||
309 | out: | 309 | out: |
310 | /* Free any left over map structures */ | 310 | /* Free any left over map structures */ |
311 | if (map) | 311 | kfree(map); |
312 | kfree(map); | ||
313 | 312 | ||
314 | /* See if I have any map structures */ | 313 | /* See if I have any map structures */ |
315 | if (list_empty(&window->maps)) { | 314 | if (list_empty(&window->maps)) { |
diff --git a/drivers/mtd/maps/dbox2-flash.c b/drivers/mtd/maps/dbox2-flash.c deleted file mode 100644 index 85bdece6ab3f..000000000000 --- a/drivers/mtd/maps/dbox2-flash.c +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* | ||
2 | * D-Box 2 flash driver | ||
3 | */ | ||
4 | |||
5 | #include <linux/module.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <asm/io.h> | ||
10 | #include <linux/mtd/mtd.h> | ||
11 | #include <linux/mtd/map.h> | ||
12 | #include <linux/mtd/partitions.h> | ||
13 | #include <linux/errno.h> | ||
14 | |||
15 | /* partition_info gives details on the logical partitions that the split the | ||
16 | * single flash device into. If the size if zero we use up to the end of the | ||
17 | * device. */ | ||
18 | static struct mtd_partition partition_info[]= { | ||
19 | { | ||
20 | .name = "BR bootloader", | ||
21 | .size = 128 * 1024, | ||
22 | .offset = 0, | ||
23 | .mask_flags = MTD_WRITEABLE | ||
24 | }, | ||
25 | { | ||
26 | .name = "FLFS (U-Boot)", | ||
27 | .size = 128 * 1024, | ||
28 | .offset = MTDPART_OFS_APPEND, | ||
29 | .mask_flags = 0 | ||
30 | }, | ||
31 | { | ||
32 | .name = "Root (SquashFS)", | ||
33 | .size = 7040 * 1024, | ||
34 | .offset = MTDPART_OFS_APPEND, | ||
35 | .mask_flags = 0 | ||
36 | }, | ||
37 | { | ||
38 | .name = "var (JFFS2)", | ||
39 | .size = 896 * 1024, | ||
40 | .offset = MTDPART_OFS_APPEND, | ||
41 | .mask_flags = 0 | ||
42 | }, | ||
43 | { | ||
44 | .name = "Flash without bootloader", | ||
45 | .size = MTDPART_SIZ_FULL, | ||
46 | .offset = 128 * 1024, | ||
47 | .mask_flags = 0 | ||
48 | }, | ||
49 | { | ||
50 | .name = "Complete Flash", | ||
51 | .size = MTDPART_SIZ_FULL, | ||
52 | .offset = 0, | ||
53 | .mask_flags = MTD_WRITEABLE | ||
54 | } | ||
55 | }; | ||
56 | |||
57 | #define NUM_PARTITIONS ARRAY_SIZE(partition_info) | ||
58 | |||
59 | #define WINDOW_ADDR 0x10000000 | ||
60 | #define WINDOW_SIZE 0x800000 | ||
61 | |||
62 | static struct mtd_info *mymtd; | ||
63 | |||
64 | |||
65 | struct map_info dbox2_flash_map = { | ||
66 | .name = "D-Box 2 flash memory", | ||
67 | .size = WINDOW_SIZE, | ||
68 | .bankwidth = 4, | ||
69 | .phys = WINDOW_ADDR, | ||
70 | }; | ||
71 | |||
72 | static int __init init_dbox2_flash(void) | ||
73 | { | ||
74 | printk(KERN_NOTICE "D-Box 2 flash driver (size->0x%X mem->0x%X)\n", WINDOW_SIZE, WINDOW_ADDR); | ||
75 | dbox2_flash_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); | ||
76 | |||
77 | if (!dbox2_flash_map.virt) { | ||
78 | printk("Failed to ioremap\n"); | ||
79 | return -EIO; | ||
80 | } | ||
81 | simple_map_init(&dbox2_flash_map); | ||
82 | |||
83 | // Probe for dual Intel 28F320 or dual AMD | ||
84 | mymtd = do_map_probe("cfi_probe", &dbox2_flash_map); | ||
85 | if (!mymtd) { | ||
86 | // Probe for single Intel 28F640 | ||
87 | dbox2_flash_map.bankwidth = 2; | ||
88 | |||
89 | mymtd = do_map_probe("cfi_probe", &dbox2_flash_map); | ||
90 | } | ||
91 | |||
92 | if (mymtd) { | ||
93 | mymtd->owner = THIS_MODULE; | ||
94 | |||
95 | /* Create MTD devices for each partition. */ | ||
96 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); | ||
97 | |||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | iounmap((void *)dbox2_flash_map.virt); | ||
102 | return -ENXIO; | ||
103 | } | ||
104 | |||
105 | static void __exit cleanup_dbox2_flash(void) | ||
106 | { | ||
107 | if (mymtd) { | ||
108 | mtd_device_unregister(mymtd); | ||
109 | map_destroy(mymtd); | ||
110 | } | ||
111 | if (dbox2_flash_map.virt) { | ||
112 | iounmap((void *)dbox2_flash_map.virt); | ||
113 | dbox2_flash_map.virt = 0; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | module_init(init_dbox2_flash); | ||
118 | module_exit(cleanup_dbox2_flash); | ||
119 | |||
120 | |||
121 | MODULE_LICENSE("GPL"); | ||
122 | MODULE_AUTHOR("Kári DavÃðsson <kd@flaga.is>, Bastian Blank <waldi@tuxbox.org>, Alexander Wild <wild@te-elektronik.com>"); | ||
123 | MODULE_DESCRIPTION("MTD map driver for D-Box 2 board"); | ||
diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c index 080f06053bd4..f8a7dd14cee0 100644 --- a/drivers/mtd/maps/dc21285.c +++ b/drivers/mtd/maps/dc21285.c | |||
@@ -143,9 +143,8 @@ static struct map_info dc21285_map = { | |||
143 | .copy_from = dc21285_copy_from, | 143 | .copy_from = dc21285_copy_from, |
144 | }; | 144 | }; |
145 | 145 | ||
146 | |||
147 | /* Partition stuff */ | 146 | /* Partition stuff */ |
148 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 147 | static const char * const probes[] = { "RedBoot", "cmdlinepart", NULL }; |
149 | 148 | ||
150 | static int __init init_dc21285(void) | 149 | static int __init init_dc21285(void) |
151 | { | 150 | { |
diff --git a/drivers/mtd/maps/dilnetpc.c b/drivers/mtd/maps/dilnetpc.c deleted file mode 100644 index 3e393f0da823..000000000000 --- a/drivers/mtd/maps/dilnetpc.c +++ /dev/null | |||
@@ -1,496 +0,0 @@ | |||
1 | /* dilnetpc.c -- MTD map driver for SSV DIL/Net PC Boards "DNP" and "ADNP" | ||
2 | * | ||
3 | * This program is free software; you can redistribute it and/or modify | ||
4 | * it under the terms of the GNU General Public License as published by | ||
5 | * the Free Software Foundation; either version 2 of the License, or | ||
6 | * (at your option) any later version. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, | ||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
11 | * GNU General Public License for more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program; if not, write to the Free Software | ||
15 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA | ||
16 | * | ||
17 | * The DIL/Net PC is a tiny embedded PC board made by SSV Embedded Systems | ||
18 | * featuring the AMD Elan SC410 processor. There are two variants of this | ||
19 | * board: DNP/1486 and ADNP/1486. The DNP version has 2 megs of flash | ||
20 | * ROM (Intel 28F016S3) and 8 megs of DRAM, the ADNP version has 4 megs | ||
21 | * flash and 16 megs of RAM. | ||
22 | * For details, see http://www.ssv-embedded.de/ssv/pc104/p169.htm | ||
23 | * and http://www.ssv-embedded.de/ssv/pc104/p170.htm | ||
24 | */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | #include <linux/types.h> | ||
28 | #include <linux/kernel.h> | ||
29 | #include <linux/init.h> | ||
30 | #include <linux/string.h> | ||
31 | |||
32 | #include <linux/mtd/mtd.h> | ||
33 | #include <linux/mtd/map.h> | ||
34 | #include <linux/mtd/partitions.h> | ||
35 | #include <linux/mtd/concat.h> | ||
36 | |||
37 | #include <asm/io.h> | ||
38 | |||
39 | /* | ||
40 | ** The DIL/NetPC keeps its BIOS in two distinct flash blocks. | ||
41 | ** Destroying any of these blocks transforms the DNPC into | ||
42 | ** a paperweight (albeit not a very useful one, considering | ||
43 | ** it only weighs a few grams). | ||
44 | ** | ||
45 | ** Therefore, the BIOS blocks must never be erased or written to | ||
46 | ** except by people who know exactly what they are doing (e.g. | ||
47 | ** to install a BIOS update). These partitions are marked read-only | ||
48 | ** by default, but can be made read/write by undefining | ||
49 | ** DNPC_BIOS_BLOCKS_WRITEPROTECTED: | ||
50 | */ | ||
51 | #define DNPC_BIOS_BLOCKS_WRITEPROTECTED | ||
52 | |||
53 | /* | ||
54 | ** The ID string (in ROM) is checked to determine whether we | ||
55 | ** are running on a DNP/1486 or ADNP/1486 | ||
56 | */ | ||
57 | #define BIOSID_BASE 0x000fe100 | ||
58 | |||
59 | #define ID_DNPC "DNP1486" | ||
60 | #define ID_ADNP "ADNP1486" | ||
61 | |||
62 | /* | ||
63 | ** Address where the flash should appear in CPU space | ||
64 | */ | ||
65 | #define FLASH_BASE 0x2000000 | ||
66 | |||
67 | /* | ||
68 | ** Chip Setup and Control (CSC) indexed register space | ||
69 | */ | ||
70 | #define CSC_INDEX 0x22 | ||
71 | #define CSC_DATA 0x23 | ||
72 | |||
73 | #define CSC_MMSWAR 0x30 /* MMS window C-F attributes register */ | ||
74 | #define CSC_MMSWDSR 0x31 /* MMS window C-F device select register */ | ||
75 | |||
76 | #define CSC_RBWR 0xa7 /* GPIO Read-Back/Write Register B */ | ||
77 | |||
78 | #define CSC_CR 0xd0 /* internal I/O device disable/Echo */ | ||
79 | /* Z-bus/configuration register */ | ||
80 | |||
81 | #define CSC_PCCMDCR 0xf1 /* PC card mode and DMA control register */ | ||
82 | |||
83 | |||
84 | /* | ||
85 | ** PC Card indexed register space: | ||
86 | */ | ||
87 | |||
88 | #define PCC_INDEX 0x3e0 | ||
89 | #define PCC_DATA 0x3e1 | ||
90 | |||
91 | #define PCC_AWER_B 0x46 /* Socket B Address Window enable register */ | ||
92 | #define PCC_MWSAR_1_Lo 0x58 /* memory window 1 start address low register */ | ||
93 | #define PCC_MWSAR_1_Hi 0x59 /* memory window 1 start address high register */ | ||
94 | #define PCC_MWEAR_1_Lo 0x5A /* memory window 1 stop address low register */ | ||
95 | #define PCC_MWEAR_1_Hi 0x5B /* memory window 1 stop address high register */ | ||
96 | #define PCC_MWAOR_1_Lo 0x5C /* memory window 1 address offset low register */ | ||
97 | #define PCC_MWAOR_1_Hi 0x5D /* memory window 1 address offset high register */ | ||
98 | |||
99 | |||
100 | /* | ||
101 | ** Access to SC4x0's Chip Setup and Control (CSC) | ||
102 | ** and PC Card (PCC) indexed registers: | ||
103 | */ | ||
104 | static inline void setcsc(int reg, unsigned char data) | ||
105 | { | ||
106 | outb(reg, CSC_INDEX); | ||
107 | outb(data, CSC_DATA); | ||
108 | } | ||
109 | |||
110 | static inline unsigned char getcsc(int reg) | ||
111 | { | ||
112 | outb(reg, CSC_INDEX); | ||
113 | return(inb(CSC_DATA)); | ||
114 | } | ||
115 | |||
116 | static inline void setpcc(int reg, unsigned char data) | ||
117 | { | ||
118 | outb(reg, PCC_INDEX); | ||
119 | outb(data, PCC_DATA); | ||
120 | } | ||
121 | |||
122 | static inline unsigned char getpcc(int reg) | ||
123 | { | ||
124 | outb(reg, PCC_INDEX); | ||
125 | return(inb(PCC_DATA)); | ||
126 | } | ||
127 | |||
128 | |||
129 | /* | ||
130 | ************************************************************ | ||
131 | ** Enable access to DIL/NetPC's flash by mapping it into | ||
132 | ** the SC4x0's MMS Window C. | ||
133 | ************************************************************ | ||
134 | */ | ||
135 | static void dnpc_map_flash(unsigned long flash_base, unsigned long flash_size) | ||
136 | { | ||
137 | unsigned long flash_end = flash_base + flash_size - 1; | ||
138 | |||
139 | /* | ||
140 | ** enable setup of MMS windows C-F: | ||
141 | */ | ||
142 | /* - enable PC Card indexed register space */ | ||
143 | setcsc(CSC_CR, getcsc(CSC_CR) | 0x2); | ||
144 | /* - set PC Card controller to operate in standard mode */ | ||
145 | setcsc(CSC_PCCMDCR, getcsc(CSC_PCCMDCR) & ~1); | ||
146 | |||
147 | /* | ||
148 | ** Program base address and end address of window | ||
149 | ** where the flash ROM should appear in CPU address space | ||
150 | */ | ||
151 | setpcc(PCC_MWSAR_1_Lo, (flash_base >> 12) & 0xff); | ||
152 | setpcc(PCC_MWSAR_1_Hi, (flash_base >> 20) & 0x3f); | ||
153 | setpcc(PCC_MWEAR_1_Lo, (flash_end >> 12) & 0xff); | ||
154 | setpcc(PCC_MWEAR_1_Hi, (flash_end >> 20) & 0x3f); | ||
155 | |||
156 | /* program offset of first flash location to appear in this window (0) */ | ||
157 | setpcc(PCC_MWAOR_1_Lo, ((0 - flash_base) >> 12) & 0xff); | ||
158 | setpcc(PCC_MWAOR_1_Hi, ((0 - flash_base)>> 20) & 0x3f); | ||
159 | |||
160 | /* set attributes for MMS window C: non-cacheable, write-enabled */ | ||
161 | setcsc(CSC_MMSWAR, getcsc(CSC_MMSWAR) & ~0x11); | ||
162 | |||
163 | /* select physical device ROMCS0 (i.e. flash) for MMS Window C */ | ||
164 | setcsc(CSC_MMSWDSR, getcsc(CSC_MMSWDSR) & ~0x03); | ||
165 | |||
166 | /* enable memory window 1 */ | ||
167 | setpcc(PCC_AWER_B, getpcc(PCC_AWER_B) | 0x02); | ||
168 | |||
169 | /* now disable PC Card indexed register space again */ | ||
170 | setcsc(CSC_CR, getcsc(CSC_CR) & ~0x2); | ||
171 | } | ||
172 | |||
173 | |||
174 | /* | ||
175 | ************************************************************ | ||
176 | ** Disable access to DIL/NetPC's flash by mapping it into | ||
177 | ** the SC4x0's MMS Window C. | ||
178 | ************************************************************ | ||
179 | */ | ||
180 | static void dnpc_unmap_flash(void) | ||
181 | { | ||
182 | /* - enable PC Card indexed register space */ | ||
183 | setcsc(CSC_CR, getcsc(CSC_CR) | 0x2); | ||
184 | |||
185 | /* disable memory window 1 */ | ||
186 | setpcc(PCC_AWER_B, getpcc(PCC_AWER_B) & ~0x02); | ||
187 | |||
188 | /* now disable PC Card indexed register space again */ | ||
189 | setcsc(CSC_CR, getcsc(CSC_CR) & ~0x2); | ||
190 | } | ||
191 | |||
192 | |||
193 | |||
194 | /* | ||
195 | ************************************************************ | ||
196 | ** Enable/Disable VPP to write to flash | ||
197 | ************************************************************ | ||
198 | */ | ||
199 | |||
200 | static DEFINE_SPINLOCK(dnpc_spin); | ||
201 | static int vpp_counter = 0; | ||
202 | /* | ||
203 | ** This is what has to be done for the DNP board .. | ||
204 | */ | ||
205 | static void dnp_set_vpp(struct map_info *not_used, int on) | ||
206 | { | ||
207 | spin_lock_irq(&dnpc_spin); | ||
208 | |||
209 | if (on) | ||
210 | { | ||
211 | if(++vpp_counter == 1) | ||
212 | setcsc(CSC_RBWR, getcsc(CSC_RBWR) & ~0x4); | ||
213 | } | ||
214 | else | ||
215 | { | ||
216 | if(--vpp_counter == 0) | ||
217 | setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4); | ||
218 | else | ||
219 | BUG_ON(vpp_counter < 0); | ||
220 | } | ||
221 | spin_unlock_irq(&dnpc_spin); | ||
222 | } | ||
223 | |||
224 | /* | ||
225 | ** .. and this the ADNP version: | ||
226 | */ | ||
227 | static void adnp_set_vpp(struct map_info *not_used, int on) | ||
228 | { | ||
229 | spin_lock_irq(&dnpc_spin); | ||
230 | |||
231 | if (on) | ||
232 | { | ||
233 | if(++vpp_counter == 1) | ||
234 | setcsc(CSC_RBWR, getcsc(CSC_RBWR) & ~0x8); | ||
235 | } | ||
236 | else | ||
237 | { | ||
238 | if(--vpp_counter == 0) | ||
239 | setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8); | ||
240 | else | ||
241 | BUG_ON(vpp_counter < 0); | ||
242 | } | ||
243 | spin_unlock_irq(&dnpc_spin); | ||
244 | } | ||
245 | |||
246 | |||
247 | |||
248 | #define DNP_WINDOW_SIZE 0x00200000 /* DNP flash size is 2MiB */ | ||
249 | #define ADNP_WINDOW_SIZE 0x00400000 /* ADNP flash size is 4MiB */ | ||
250 | #define WINDOW_ADDR FLASH_BASE | ||
251 | |||
252 | static struct map_info dnpc_map = { | ||
253 | .name = "ADNP Flash Bank", | ||
254 | .size = ADNP_WINDOW_SIZE, | ||
255 | .bankwidth = 1, | ||
256 | .set_vpp = adnp_set_vpp, | ||
257 | .phys = WINDOW_ADDR | ||
258 | }; | ||
259 | |||
260 | /* | ||
261 | ** The layout of the flash is somewhat "strange": | ||
262 | ** | ||
263 | ** 1. 960 KiB (15 blocks) : Space for ROM Bootloader and user data | ||
264 | ** 2. 64 KiB (1 block) : System BIOS | ||
265 | ** 3. 960 KiB (15 blocks) : User Data (DNP model) or | ||
266 | ** 3. 3008 KiB (47 blocks) : User Data (ADNP model) | ||
267 | ** 4. 64 KiB (1 block) : System BIOS Entry | ||
268 | */ | ||
269 | |||
270 | static struct mtd_partition partition_info[]= | ||
271 | { | ||
272 | { | ||
273 | .name = "ADNP boot", | ||
274 | .offset = 0, | ||
275 | .size = 0xf0000, | ||
276 | }, | ||
277 | { | ||
278 | .name = "ADNP system BIOS", | ||
279 | .offset = MTDPART_OFS_NXTBLK, | ||
280 | .size = 0x10000, | ||
281 | #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED | ||
282 | .mask_flags = MTD_WRITEABLE, | ||
283 | #endif | ||
284 | }, | ||
285 | { | ||
286 | .name = "ADNP file system", | ||
287 | .offset = MTDPART_OFS_NXTBLK, | ||
288 | .size = 0x2f0000, | ||
289 | }, | ||
290 | { | ||
291 | .name = "ADNP system BIOS entry", | ||
292 | .offset = MTDPART_OFS_NXTBLK, | ||
293 | .size = MTDPART_SIZ_FULL, | ||
294 | #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED | ||
295 | .mask_flags = MTD_WRITEABLE, | ||
296 | #endif | ||
297 | }, | ||
298 | }; | ||
299 | |||
300 | #define NUM_PARTITIONS ARRAY_SIZE(partition_info) | ||
301 | |||
302 | static struct mtd_info *mymtd; | ||
303 | static struct mtd_info *lowlvl_parts[NUM_PARTITIONS]; | ||
304 | static struct mtd_info *merged_mtd; | ||
305 | |||
306 | /* | ||
307 | ** "Highlevel" partition info: | ||
308 | ** | ||
309 | ** Using the MTD concat layer, we can re-arrange partitions to our | ||
310 | ** liking: we construct a virtual MTD device by concatenating the | ||
311 | ** partitions, specifying the sequence such that the boot block | ||
312 | ** is immediately followed by the filesystem block (i.e. the stupid | ||
313 | ** system BIOS block is mapped to a different place). When re-partitioning | ||
314 | ** this concatenated MTD device, we can set the boot block size to | ||
315 | ** an arbitrary (though erase block aligned) value i.e. not one that | ||
316 | ** is dictated by the flash's physical layout. We can thus set the | ||
317 | ** boot block to be e.g. 64 KB (which is fully sufficient if we want | ||
318 | ** to boot an etherboot image) or to -say- 1.5 MB if we want to boot | ||
319 | ** a large kernel image. In all cases, the remainder of the flash | ||
320 | ** is available as file system space. | ||
321 | */ | ||
322 | |||
323 | static struct mtd_partition higlvl_partition_info[]= | ||
324 | { | ||
325 | { | ||
326 | .name = "ADNP boot block", | ||
327 | .offset = 0, | ||
328 | .size = CONFIG_MTD_DILNETPC_BOOTSIZE, | ||
329 | }, | ||
330 | { | ||
331 | .name = "ADNP file system space", | ||
332 | .offset = MTDPART_OFS_NXTBLK, | ||
333 | .size = ADNP_WINDOW_SIZE-CONFIG_MTD_DILNETPC_BOOTSIZE-0x20000, | ||
334 | }, | ||
335 | { | ||
336 | .name = "ADNP system BIOS + BIOS Entry", | ||
337 | .offset = MTDPART_OFS_NXTBLK, | ||
338 | .size = MTDPART_SIZ_FULL, | ||
339 | #ifdef DNPC_BIOS_BLOCKS_WRITEPROTECTED | ||
340 | .mask_flags = MTD_WRITEABLE, | ||
341 | #endif | ||
342 | }, | ||
343 | }; | ||
344 | |||
345 | #define NUM_HIGHLVL_PARTITIONS ARRAY_SIZE(higlvl_partition_info) | ||
346 | |||
347 | |||
348 | static int dnp_adnp_probe(void) | ||
349 | { | ||
350 | char *biosid, rc = -1; | ||
351 | |||
352 | biosid = (char*)ioremap(BIOSID_BASE, 16); | ||
353 | if(biosid) | ||
354 | { | ||
355 | if(!strcmp(biosid, ID_DNPC)) | ||
356 | rc = 1; /* this is a DNPC */ | ||
357 | else if(!strcmp(biosid, ID_ADNP)) | ||
358 | rc = 0; /* this is a ADNPC */ | ||
359 | } | ||
360 | iounmap((void *)biosid); | ||
361 | return(rc); | ||
362 | } | ||
363 | |||
364 | |||
365 | static int __init init_dnpc(void) | ||
366 | { | ||
367 | int is_dnp; | ||
368 | |||
369 | /* | ||
370 | ** determine hardware (DNP/ADNP/invalid) | ||
371 | */ | ||
372 | if((is_dnp = dnp_adnp_probe()) < 0) | ||
373 | return -ENXIO; | ||
374 | |||
375 | /* | ||
376 | ** Things are set up for ADNP by default | ||
377 | ** -> modify all that needs to be different for DNP | ||
378 | */ | ||
379 | if(is_dnp) | ||
380 | { /* | ||
381 | ** Adjust window size, select correct set_vpp function. | ||
382 | ** The partitioning scheme is identical on both DNP | ||
383 | ** and ADNP except for the size of the third partition. | ||
384 | */ | ||
385 | int i; | ||
386 | dnpc_map.size = DNP_WINDOW_SIZE; | ||
387 | dnpc_map.set_vpp = dnp_set_vpp; | ||
388 | partition_info[2].size = 0xf0000; | ||
389 | |||
390 | /* | ||
391 | ** increment all string pointers so the leading 'A' gets skipped, | ||
392 | ** thus turning all occurrences of "ADNP ..." into "DNP ..." | ||
393 | */ | ||
394 | ++dnpc_map.name; | ||
395 | for(i = 0; i < NUM_PARTITIONS; i++) | ||
396 | ++partition_info[i].name; | ||
397 | higlvl_partition_info[1].size = DNP_WINDOW_SIZE - | ||
398 | CONFIG_MTD_DILNETPC_BOOTSIZE - 0x20000; | ||
399 | for(i = 0; i < NUM_HIGHLVL_PARTITIONS; i++) | ||
400 | ++higlvl_partition_info[i].name; | ||
401 | } | ||
402 | |||
403 | printk(KERN_NOTICE "DIL/Net %s flash: 0x%lx at 0x%llx\n", | ||
404 | is_dnp ? "DNPC" : "ADNP", dnpc_map.size, (unsigned long long)dnpc_map.phys); | ||
405 | |||
406 | dnpc_map.virt = ioremap_nocache(dnpc_map.phys, dnpc_map.size); | ||
407 | |||
408 | dnpc_map_flash(dnpc_map.phys, dnpc_map.size); | ||
409 | |||
410 | if (!dnpc_map.virt) { | ||
411 | printk("Failed to ioremap_nocache\n"); | ||
412 | return -EIO; | ||
413 | } | ||
414 | simple_map_init(&dnpc_map); | ||
415 | |||
416 | printk("FLASH virtual address: 0x%p\n", dnpc_map.virt); | ||
417 | |||
418 | mymtd = do_map_probe("jedec_probe", &dnpc_map); | ||
419 | |||
420 | if (!mymtd) | ||
421 | mymtd = do_map_probe("cfi_probe", &dnpc_map); | ||
422 | |||
423 | /* | ||
424 | ** If flash probes fail, try to make flashes accessible | ||
425 | ** at least as ROM. Ajust erasesize in this case since | ||
426 | ** the default one (128M) will break our partitioning | ||
427 | */ | ||
428 | if (!mymtd) | ||
429 | if((mymtd = do_map_probe("map_rom", &dnpc_map))) | ||
430 | mymtd->erasesize = 0x10000; | ||
431 | |||
432 | if (!mymtd) { | ||
433 | iounmap(dnpc_map.virt); | ||
434 | return -ENXIO; | ||
435 | } | ||
436 | |||
437 | mymtd->owner = THIS_MODULE; | ||
438 | |||
439 | /* | ||
440 | ** Supply pointers to lowlvl_parts[] array to add_mtd_partitions() | ||
441 | ** -> add_mtd_partitions() will _not_ register MTD devices for | ||
442 | ** the partitions, but will instead store pointers to the MTD | ||
443 | ** objects it creates into our lowlvl_parts[] array. | ||
444 | ** NOTE: we arrange the pointers such that the sequence of the | ||
445 | ** partitions gets re-arranged: partition #2 follows | ||
446 | ** partition #0. | ||
447 | */ | ||
448 | partition_info[0].mtdp = &lowlvl_parts[0]; | ||
449 | partition_info[1].mtdp = &lowlvl_parts[2]; | ||
450 | partition_info[2].mtdp = &lowlvl_parts[1]; | ||
451 | partition_info[3].mtdp = &lowlvl_parts[3]; | ||
452 | |||
453 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); | ||
454 | |||
455 | /* | ||
456 | ** now create a virtual MTD device by concatenating the for partitions | ||
457 | ** (in the sequence given by the lowlvl_parts[] array. | ||
458 | */ | ||
459 | merged_mtd = mtd_concat_create(lowlvl_parts, NUM_PARTITIONS, "(A)DNP Flash Concatenated"); | ||
460 | if(merged_mtd) | ||
461 | { /* | ||
462 | ** now partition the new device the way we want it. This time, | ||
463 | ** we do not supply mtd pointers in higlvl_partition_info, so | ||
464 | ** add_mtd_partitions() will register the devices. | ||
465 | */ | ||
466 | mtd_device_register(merged_mtd, higlvl_partition_info, | ||
467 | NUM_HIGHLVL_PARTITIONS); | ||
468 | } | ||
469 | |||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | static void __exit cleanup_dnpc(void) | ||
474 | { | ||
475 | if(merged_mtd) { | ||
476 | mtd_device_unregister(merged_mtd); | ||
477 | mtd_concat_destroy(merged_mtd); | ||
478 | } | ||
479 | |||
480 | if (mymtd) { | ||
481 | mtd_device_unregister(mymtd); | ||
482 | map_destroy(mymtd); | ||
483 | } | ||
484 | if (dnpc_map.virt) { | ||
485 | iounmap(dnpc_map.virt); | ||
486 | dnpc_unmap_flash(); | ||
487 | dnpc_map.virt = NULL; | ||
488 | } | ||
489 | } | ||
490 | |||
491 | module_init(init_dnpc); | ||
492 | module_exit(cleanup_dnpc); | ||
493 | |||
494 | MODULE_LICENSE("GPL"); | ||
495 | MODULE_AUTHOR("Sysgo Real-Time Solutions GmbH"); | ||
496 | MODULE_DESCRIPTION("MTD map driver for SSV DIL/NetPC DNP & ADNP"); | ||
diff --git a/drivers/mtd/maps/dmv182.c b/drivers/mtd/maps/dmv182.c deleted file mode 100644 index 6538ac675e00..000000000000 --- a/drivers/mtd/maps/dmv182.c +++ /dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | |||
2 | /* | ||
3 | * drivers/mtd/maps/dmv182.c | ||
4 | * | ||
5 | * Flash map driver for the Dy4 SVME182 board | ||
6 | * | ||
7 | * Copyright 2003-2004, TimeSys Corporation | ||
8 | * | ||
9 | * Based on the SVME181 flash map, by Tom Nelson, Dot4, Inc. for TimeSys Corp. | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify it | ||
12 | * under the terms of the GNU General Public License as published by the | ||
13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
14 | * option) any later version. | ||
15 | */ | ||
16 | |||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/kernel.h> | ||
21 | #include <asm/io.h> | ||
22 | #include <linux/mtd/mtd.h> | ||
23 | #include <linux/mtd/map.h> | ||
24 | #include <linux/mtd/partitions.h> | ||
25 | #include <linux/errno.h> | ||
26 | |||
27 | /* | ||
28 | * This driver currently handles only the 16MiB user flash bank 1 on the | ||
29 | * board. It does not provide access to bank 0 (contains the Dy4 FFW), bank 2 | ||
30 | * (VxWorks boot), or the optional 48MiB expansion flash. | ||
31 | * | ||
32 | * scott.wood@timesys.com: On the newer boards with 128MiB flash, it | ||
33 | * now supports the first 96MiB (the boot flash bank containing FFW | ||
34 | * is excluded). The VxWorks loader is in partition 1. | ||
35 | */ | ||
36 | |||
37 | #define FLASH_BASE_ADDR 0xf0000000 | ||
38 | #define FLASH_BANK_SIZE (128*1024*1024) | ||
39 | |||
40 | MODULE_AUTHOR("Scott Wood, TimeSys Corporation <scott.wood@timesys.com>"); | ||
41 | MODULE_DESCRIPTION("User-programmable flash device on the Dy4 SVME182 board"); | ||
42 | MODULE_LICENSE("GPL"); | ||
43 | |||
44 | static struct map_info svme182_map = { | ||
45 | .name = "Dy4 SVME182", | ||
46 | .bankwidth = 32, | ||
47 | .size = 128 * 1024 * 1024 | ||
48 | }; | ||
49 | |||
50 | #define BOOTIMAGE_PART_SIZE ((6*1024*1024)-RESERVED_PART_SIZE) | ||
51 | |||
52 | // Allow 6MiB for the kernel | ||
53 | #define NEW_BOOTIMAGE_PART_SIZE (6 * 1024 * 1024) | ||
54 | // Allow 1MiB for the bootloader | ||
55 | #define NEW_BOOTLOADER_PART_SIZE (1024 * 1024) | ||
56 | // Use the remaining 9MiB at the end of flash for the RFS | ||
57 | #define NEW_RFS_PART_SIZE (0x01000000 - NEW_BOOTLOADER_PART_SIZE - \ | ||
58 | NEW_BOOTIMAGE_PART_SIZE) | ||
59 | |||
60 | static struct mtd_partition svme182_partitions[] = { | ||
61 | // The Lower PABS is only 128KiB, but the partition code doesn't | ||
62 | // like partitions that don't end on the largest erase block | ||
63 | // size of the device, even if all of the erase blocks in the | ||
64 | // partition are small ones. The hardware should prevent | ||
65 | // writes to the actual PABS areas. | ||
66 | { | ||
67 | name: "Lower PABS and CPU 0 bootloader or kernel", | ||
68 | size: 6*1024*1024, | ||
69 | offset: 0, | ||
70 | }, | ||
71 | { | ||
72 | name: "Root Filesystem", | ||
73 | size: 10*1024*1024, | ||
74 | offset: MTDPART_OFS_NXTBLK | ||
75 | }, | ||
76 | { | ||
77 | name: "CPU1 Bootloader", | ||
78 | size: 1024*1024, | ||
79 | offset: MTDPART_OFS_NXTBLK, | ||
80 | }, | ||
81 | { | ||
82 | name: "Extra", | ||
83 | size: 110*1024*1024, | ||
84 | offset: MTDPART_OFS_NXTBLK | ||
85 | }, | ||
86 | { | ||
87 | name: "Foundation Firmware and Upper PABS", | ||
88 | size: 1024*1024, | ||
89 | offset: MTDPART_OFS_NXTBLK, | ||
90 | mask_flags: MTD_WRITEABLE // read-only | ||
91 | } | ||
92 | }; | ||
93 | |||
94 | static struct mtd_info *this_mtd; | ||
95 | |||
96 | static int __init init_svme182(void) | ||
97 | { | ||
98 | struct mtd_partition *partitions; | ||
99 | int num_parts = ARRAY_SIZE(svme182_partitions); | ||
100 | |||
101 | partitions = svme182_partitions; | ||
102 | |||
103 | svme182_map.virt = ioremap(FLASH_BASE_ADDR, svme182_map.size); | ||
104 | |||
105 | if (svme182_map.virt == 0) { | ||
106 | printk("Failed to ioremap FLASH memory area.\n"); | ||
107 | return -EIO; | ||
108 | } | ||
109 | |||
110 | simple_map_init(&svme182_map); | ||
111 | |||
112 | this_mtd = do_map_probe("cfi_probe", &svme182_map); | ||
113 | if (!this_mtd) | ||
114 | { | ||
115 | iounmap((void *)svme182_map.virt); | ||
116 | return -ENXIO; | ||
117 | } | ||
118 | |||
119 | printk(KERN_NOTICE "SVME182 flash device: %dMiB at 0x%08x\n", | ||
120 | this_mtd->size >> 20, FLASH_BASE_ADDR); | ||
121 | |||
122 | this_mtd->owner = THIS_MODULE; | ||
123 | mtd_device_register(this_mtd, partitions, num_parts); | ||
124 | |||
125 | return 0; | ||
126 | } | ||
127 | |||
128 | static void __exit cleanup_svme182(void) | ||
129 | { | ||
130 | if (this_mtd) | ||
131 | { | ||
132 | mtd_device_unregister(this_mtd); | ||
133 | map_destroy(this_mtd); | ||
134 | } | ||
135 | |||
136 | if (svme182_map.virt) | ||
137 | { | ||
138 | iounmap((void *)svme182_map.virt); | ||
139 | svme182_map.virt = 0; | ||
140 | } | ||
141 | |||
142 | return; | ||
143 | } | ||
144 | |||
145 | module_init(init_svme182); | ||
146 | module_exit(cleanup_svme182); | ||
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 7b643de2500b..5ede28294f9e 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c | |||
@@ -157,7 +157,8 @@ static void gf_copy_to(struct map_info *map, unsigned long to, | |||
157 | memcpy_toio(map->virt + (to % state->win_size), from, len); | 157 | memcpy_toio(map->virt + (to % state->win_size), from, len); |
158 | } | 158 | } |
159 | 159 | ||
160 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; | 160 | static const char * const part_probe_types[] = { |
161 | "cmdlinepart", "RedBoot", NULL }; | ||
161 | 162 | ||
162 | /** | 163 | /** |
163 | * gpio_flash_probe() - setup a mapping for a GPIO assisted flash | 164 | * gpio_flash_probe() - setup a mapping for a GPIO assisted flash |
diff --git a/drivers/mtd/maps/h720x-flash.c b/drivers/mtd/maps/h720x-flash.c deleted file mode 100644 index 8ed6cb4529d8..000000000000 --- a/drivers/mtd/maps/h720x-flash.c +++ /dev/null | |||
@@ -1,120 +0,0 @@ | |||
1 | /* | ||
2 | * Flash memory access on Hynix GMS30C7201/HMS30C7202 based | ||
3 | * evaluation boards | ||
4 | * | ||
5 | * (C) 2002 Jungjun Kim <jungjun.kim@hynix.com> | ||
6 | * 2003 Thomas Gleixner <tglx@linutronix.de> | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/types.h> | ||
11 | #include <linux/kernel.h> | ||
12 | #include <linux/init.h> | ||
13 | #include <linux/errno.h> | ||
14 | #include <linux/slab.h> | ||
15 | |||
16 | #include <linux/mtd/mtd.h> | ||
17 | #include <linux/mtd/map.h> | ||
18 | #include <linux/mtd/partitions.h> | ||
19 | #include <mach/hardware.h> | ||
20 | #include <asm/io.h> | ||
21 | |||
22 | static struct mtd_info *mymtd; | ||
23 | |||
24 | static struct map_info h720x_map = { | ||
25 | .name = "H720X", | ||
26 | .bankwidth = 4, | ||
27 | .size = H720X_FLASH_SIZE, | ||
28 | .phys = H720X_FLASH_PHYS, | ||
29 | }; | ||
30 | |||
31 | static struct mtd_partition h720x_partitions[] = { | ||
32 | { | ||
33 | .name = "ArMon", | ||
34 | .size = 0x00080000, | ||
35 | .offset = 0, | ||
36 | .mask_flags = MTD_WRITEABLE | ||
37 | },{ | ||
38 | .name = "Env", | ||
39 | .size = 0x00040000, | ||
40 | .offset = 0x00080000, | ||
41 | .mask_flags = MTD_WRITEABLE | ||
42 | },{ | ||
43 | .name = "Kernel", | ||
44 | .size = 0x00180000, | ||
45 | .offset = 0x000c0000, | ||
46 | .mask_flags = MTD_WRITEABLE | ||
47 | },{ | ||
48 | .name = "Ramdisk", | ||
49 | .size = 0x00400000, | ||
50 | .offset = 0x00240000, | ||
51 | .mask_flags = MTD_WRITEABLE | ||
52 | },{ | ||
53 | .name = "jffs2", | ||
54 | .size = MTDPART_SIZ_FULL, | ||
55 | .offset = MTDPART_OFS_APPEND | ||
56 | } | ||
57 | }; | ||
58 | |||
59 | #define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions) | ||
60 | |||
61 | /* | ||
62 | * Initialize FLASH support | ||
63 | */ | ||
64 | static int __init h720x_mtd_init(void) | ||
65 | { | ||
66 | h720x_map.virt = ioremap(h720x_map.phys, h720x_map.size); | ||
67 | |||
68 | if (!h720x_map.virt) { | ||
69 | printk(KERN_ERR "H720x-MTD: ioremap failed\n"); | ||
70 | return -EIO; | ||
71 | } | ||
72 | |||
73 | simple_map_init(&h720x_map); | ||
74 | |||
75 | // Probe for flash bankwidth 4 | ||
76 | printk (KERN_INFO "H720x-MTD probing 32bit FLASH\n"); | ||
77 | mymtd = do_map_probe("cfi_probe", &h720x_map); | ||
78 | if (!mymtd) { | ||
79 | printk (KERN_INFO "H720x-MTD probing 16bit FLASH\n"); | ||
80 | // Probe for bankwidth 2 | ||
81 | h720x_map.bankwidth = 2; | ||
82 | mymtd = do_map_probe("cfi_probe", &h720x_map); | ||
83 | } | ||
84 | |||
85 | if (mymtd) { | ||
86 | mymtd->owner = THIS_MODULE; | ||
87 | |||
88 | mtd_device_parse_register(mymtd, NULL, NULL, | ||
89 | h720x_partitions, NUM_PARTITIONS); | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | iounmap((void *)h720x_map.virt); | ||
94 | return -ENXIO; | ||
95 | } | ||
96 | |||
97 | /* | ||
98 | * Cleanup | ||
99 | */ | ||
100 | static void __exit h720x_mtd_cleanup(void) | ||
101 | { | ||
102 | |||
103 | if (mymtd) { | ||
104 | mtd_device_unregister(mymtd); | ||
105 | map_destroy(mymtd); | ||
106 | } | ||
107 | |||
108 | if (h720x_map.virt) { | ||
109 | iounmap((void *)h720x_map.virt); | ||
110 | h720x_map.virt = 0; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | |||
115 | module_init(h720x_mtd_init); | ||
116 | module_exit(h720x_mtd_cleanup); | ||
117 | |||
118 | MODULE_LICENSE("GPL"); | ||
119 | MODULE_AUTHOR("Thomas Gleixner <tglx@linutronix.de>"); | ||
120 | MODULE_DESCRIPTION("MTD map driver for Hynix evaluation boards"); | ||
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c index 834a06c56f56..49686744d93c 100644 --- a/drivers/mtd/maps/impa7.c +++ b/drivers/mtd/maps/impa7.c | |||
@@ -24,14 +24,12 @@ | |||
24 | #define NUM_FLASHBANKS 2 | 24 | #define NUM_FLASHBANKS 2 |
25 | #define BUSWIDTH 4 | 25 | #define BUSWIDTH 4 |
26 | 26 | ||
27 | /* can be { "cfi_probe", "jedec_probe", "map_rom", NULL } */ | ||
28 | #define PROBETYPES { "jedec_probe", NULL } | ||
29 | |||
30 | #define MSG_PREFIX "impA7:" /* prefix for our printk()'s */ | 27 | #define MSG_PREFIX "impA7:" /* prefix for our printk()'s */ |
31 | #define MTDID "impa7-%d" /* for mtdparts= partitioning */ | 28 | #define MTDID "impa7-%d" /* for mtdparts= partitioning */ |
32 | 29 | ||
33 | static struct mtd_info *impa7_mtd[NUM_FLASHBANKS]; | 30 | static struct mtd_info *impa7_mtd[NUM_FLASHBANKS]; |
34 | 31 | ||
32 | static const char * const rom_probe_types[] = { "jedec_probe", NULL }; | ||
35 | 33 | ||
36 | static struct map_info impa7_map[NUM_FLASHBANKS] = { | 34 | static struct map_info impa7_map[NUM_FLASHBANKS] = { |
37 | { | 35 | { |
@@ -60,8 +58,7 @@ static struct mtd_partition partitions[] = | |||
60 | 58 | ||
61 | static int __init init_impa7(void) | 59 | static int __init init_impa7(void) |
62 | { | 60 | { |
63 | static const char *rom_probe_types[] = PROBETYPES; | 61 | const char * const *type; |
64 | const char **type; | ||
65 | int i; | 62 | int i; |
66 | static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = { | 63 | static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = { |
67 | { WINDOW_ADDR0, WINDOW_SIZE0 }, | 64 | { WINDOW_ADDR0, WINDOW_SIZE0 }, |
diff --git a/drivers/mtd/maps/intel_vr_nor.c b/drivers/mtd/maps/intel_vr_nor.c index b14053b25026..f581ac1cf022 100644 --- a/drivers/mtd/maps/intel_vr_nor.c +++ b/drivers/mtd/maps/intel_vr_nor.c | |||
@@ -82,9 +82,9 @@ static void vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p) | |||
82 | 82 | ||
83 | static int vr_nor_mtd_setup(struct vr_nor_mtd *p) | 83 | static int vr_nor_mtd_setup(struct vr_nor_mtd *p) |
84 | { | 84 | { |
85 | static const char *probe_types[] = | 85 | static const char * const probe_types[] = |
86 | { "cfi_probe", "jedec_probe", NULL }; | 86 | { "cfi_probe", "jedec_probe", NULL }; |
87 | const char **type; | 87 | const char * const *type; |
88 | 88 | ||
89 | for (type = probe_types; !p->info && *type; type++) | 89 | for (type = probe_types; !p->info && *type; type++) |
90 | p->info = do_map_probe(*type, &p->map); | 90 | p->info = do_map_probe(*type, &p->map); |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c deleted file mode 100644 index 4a41ced0f710..000000000000 --- a/drivers/mtd/maps/ixp2000.c +++ /dev/null | |||
@@ -1,253 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/mtd/maps/ixp2000.c | ||
3 | * | ||
4 | * Mapping for the Intel XScale IXP2000 based systems | ||
5 | * | ||
6 | * Copyright (C) 2002 Intel Corp. | ||
7 | * Copyright (C) 2003-2004 MontaVista Software, Inc. | ||
8 | * | ||
9 | * Original Author: Naeem M Afzal <naeem.m.afzal@intel.com> | ||
10 | * Maintainer: Deepak Saxena <dsaxena@plexity.net> | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License version 2 as | ||
14 | * published by the Free Software Foundation. | ||
15 | * | ||
16 | */ | ||
17 | |||
18 | #include <linux/module.h> | ||
19 | #include <linux/types.h> | ||
20 | #include <linux/init.h> | ||
21 | #include <linux/kernel.h> | ||
22 | #include <linux/string.h> | ||
23 | #include <linux/slab.h> | ||
24 | #include <linux/ioport.h> | ||
25 | #include <linux/device.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | |||
28 | #include <linux/mtd/mtd.h> | ||
29 | #include <linux/mtd/map.h> | ||
30 | #include <linux/mtd/partitions.h> | ||
31 | |||
32 | #include <asm/io.h> | ||
33 | #include <mach/hardware.h> | ||
34 | #include <asm/mach/flash.h> | ||
35 | |||
36 | #include <linux/reboot.h> | ||
37 | |||
38 | struct ixp2000_flash_info { | ||
39 | struct mtd_info *mtd; | ||
40 | struct map_info map; | ||
41 | struct resource *res; | ||
42 | }; | ||
43 | |||
44 | static inline unsigned long flash_bank_setup(struct map_info *map, unsigned long ofs) | ||
45 | { | ||
46 | unsigned long (*set_bank)(unsigned long) = | ||
47 | (unsigned long(*)(unsigned long))map->map_priv_2; | ||
48 | |||
49 | return (set_bank ? set_bank(ofs) : ofs); | ||
50 | } | ||
51 | |||
52 | #ifdef __ARMEB__ | ||
53 | /* | ||
54 | * Rev A0 and A1 of IXP2400 silicon have a broken addressing unit which | ||
55 | * causes the lower address bits to be XORed with 0x11 on 8 bit accesses | ||
56 | * and XORed with 0x10 on 16 bit accesses. See the spec update, erratum 44. | ||
57 | */ | ||
58 | static int erratum44_workaround = 0; | ||
59 | |||
60 | static inline unsigned long address_fix8_write(unsigned long addr) | ||
61 | { | ||
62 | if (erratum44_workaround) { | ||
63 | return (addr ^ 3); | ||
64 | } | ||
65 | return addr; | ||
66 | } | ||
67 | #else | ||
68 | |||
69 | #define address_fix8_write(x) (x) | ||
70 | #endif | ||
71 | |||
72 | static map_word ixp2000_flash_read8(struct map_info *map, unsigned long ofs) | ||
73 | { | ||
74 | map_word val; | ||
75 | |||
76 | val.x[0] = *((u8 *)(map->map_priv_1 + flash_bank_setup(map, ofs))); | ||
77 | return val; | ||
78 | } | ||
79 | |||
80 | /* | ||
81 | * We can't use the standard memcpy due to the broken SlowPort | ||
82 | * address translation on rev A0 and A1 silicon and the fact that | ||
83 | * we have banked flash. | ||
84 | */ | ||
85 | static void ixp2000_flash_copy_from(struct map_info *map, void *to, | ||
86 | unsigned long from, ssize_t len) | ||
87 | { | ||
88 | from = flash_bank_setup(map, from); | ||
89 | while(len--) | ||
90 | *(__u8 *) to++ = *(__u8 *)(map->map_priv_1 + from++); | ||
91 | } | ||
92 | |||
93 | static void ixp2000_flash_write8(struct map_info *map, map_word d, unsigned long ofs) | ||
94 | { | ||
95 | *(__u8 *) (address_fix8_write(map->map_priv_1 + | ||
96 | flash_bank_setup(map, ofs))) = d.x[0]; | ||
97 | } | ||
98 | |||
99 | static void ixp2000_flash_copy_to(struct map_info *map, unsigned long to, | ||
100 | const void *from, ssize_t len) | ||
101 | { | ||
102 | to = flash_bank_setup(map, to); | ||
103 | while(len--) { | ||
104 | unsigned long tmp = address_fix8_write(map->map_priv_1 + to++); | ||
105 | *(__u8 *)(tmp) = *(__u8 *)(from++); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | |||
110 | static int ixp2000_flash_remove(struct platform_device *dev) | ||
111 | { | ||
112 | struct flash_platform_data *plat = dev->dev.platform_data; | ||
113 | struct ixp2000_flash_info *info = platform_get_drvdata(dev); | ||
114 | |||
115 | platform_set_drvdata(dev, NULL); | ||
116 | |||
117 | if(!info) | ||
118 | return 0; | ||
119 | |||
120 | if (info->mtd) { | ||
121 | mtd_device_unregister(info->mtd); | ||
122 | map_destroy(info->mtd); | ||
123 | } | ||
124 | if (info->map.map_priv_1) | ||
125 | iounmap((void *) info->map.map_priv_1); | ||
126 | |||
127 | if (info->res) { | ||
128 | release_resource(info->res); | ||
129 | kfree(info->res); | ||
130 | } | ||
131 | |||
132 | if (plat->exit) | ||
133 | plat->exit(); | ||
134 | |||
135 | return 0; | ||
136 | } | ||
137 | |||
138 | |||
139 | static int ixp2000_flash_probe(struct platform_device *dev) | ||
140 | { | ||
141 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | ||
142 | struct ixp2000_flash_data *ixp_data = dev->dev.platform_data; | ||
143 | struct flash_platform_data *plat; | ||
144 | struct ixp2000_flash_info *info; | ||
145 | unsigned long window_size; | ||
146 | int err = -1; | ||
147 | |||
148 | if (!ixp_data) | ||
149 | return -ENODEV; | ||
150 | |||
151 | plat = ixp_data->platform_data; | ||
152 | if (!plat) | ||
153 | return -ENODEV; | ||
154 | |||
155 | window_size = resource_size(dev->resource); | ||
156 | dev_info(&dev->dev, "Probe of IXP2000 flash(%d banks x %dMiB)\n", | ||
157 | ixp_data->nr_banks, ((u32)window_size >> 20)); | ||
158 | |||
159 | if (plat->width != 1) { | ||
160 | dev_err(&dev->dev, "IXP2000 MTD map only supports 8-bit mode, asking for %d\n", | ||
161 | plat->width * 8); | ||
162 | return -EIO; | ||
163 | } | ||
164 | |||
165 | info = kzalloc(sizeof(struct ixp2000_flash_info), GFP_KERNEL); | ||
166 | if(!info) { | ||
167 | err = -ENOMEM; | ||
168 | goto Error; | ||
169 | } | ||
170 | |||
171 | platform_set_drvdata(dev, info); | ||
172 | |||
173 | /* | ||
174 | * Tell the MTD layer we're not 1:1 mapped so that it does | ||
175 | * not attempt to do a direct access on us. | ||
176 | */ | ||
177 | info->map.phys = NO_XIP; | ||
178 | |||
179 | info->map.size = ixp_data->nr_banks * window_size; | ||
180 | info->map.bankwidth = 1; | ||
181 | |||
182 | /* | ||
183 | * map_priv_2 is used to store a ptr to the bank_setup routine | ||
184 | */ | ||
185 | info->map.map_priv_2 = (unsigned long) ixp_data->bank_setup; | ||
186 | |||
187 | info->map.name = dev_name(&dev->dev); | ||
188 | info->map.read = ixp2000_flash_read8; | ||
189 | info->map.write = ixp2000_flash_write8; | ||
190 | info->map.copy_from = ixp2000_flash_copy_from; | ||
191 | info->map.copy_to = ixp2000_flash_copy_to; | ||
192 | |||
193 | info->res = request_mem_region(dev->resource->start, | ||
194 | resource_size(dev->resource), | ||
195 | dev_name(&dev->dev)); | ||
196 | if (!info->res) { | ||
197 | dev_err(&dev->dev, "Could not reserve memory region\n"); | ||
198 | err = -ENOMEM; | ||
199 | goto Error; | ||
200 | } | ||
201 | |||
202 | info->map.map_priv_1 = | ||
203 | (unsigned long)ioremap(dev->resource->start, | ||
204 | resource_size(dev->resource)); | ||
205 | if (!info->map.map_priv_1) { | ||
206 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); | ||
207 | err = -EIO; | ||
208 | goto Error; | ||
209 | } | ||
210 | |||
211 | #if defined(__ARMEB__) | ||
212 | /* | ||
213 | * Enable erratum 44 workaround for NPUs with broken slowport | ||
214 | */ | ||
215 | |||
216 | erratum44_workaround = ixp2000_has_broken_slowport(); | ||
217 | dev_info(&dev->dev, "Erratum 44 workaround %s\n", | ||
218 | erratum44_workaround ? "enabled" : "disabled"); | ||
219 | #endif | ||
220 | |||
221 | info->mtd = do_map_probe(plat->map_name, &info->map); | ||
222 | if (!info->mtd) { | ||
223 | dev_err(&dev->dev, "map_probe failed\n"); | ||
224 | err = -ENXIO; | ||
225 | goto Error; | ||
226 | } | ||
227 | info->mtd->owner = THIS_MODULE; | ||
228 | |||
229 | err = mtd_device_parse_register(info->mtd, probes, NULL, NULL, 0); | ||
230 | if (err) | ||
231 | goto Error; | ||
232 | |||
233 | return 0; | ||
234 | |||
235 | Error: | ||
236 | ixp2000_flash_remove(dev); | ||
237 | return err; | ||
238 | } | ||
239 | |||
240 | static struct platform_driver ixp2000_flash_driver = { | ||
241 | .probe = ixp2000_flash_probe, | ||
242 | .remove = ixp2000_flash_remove, | ||
243 | .driver = { | ||
244 | .name = "IXP2000-Flash", | ||
245 | .owner = THIS_MODULE, | ||
246 | }, | ||
247 | }; | ||
248 | |||
249 | module_platform_driver(ixp2000_flash_driver); | ||
250 | |||
251 | MODULE_LICENSE("GPL"); | ||
252 | MODULE_AUTHOR("Deepak Saxena <dsaxena@plexity.net>"); | ||
253 | MODULE_ALIAS("platform:IXP2000-Flash"); | ||
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index e864fc6c58f9..52b3410a105c 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
@@ -148,7 +148,7 @@ struct ixp4xx_flash_info { | |||
148 | struct resource *res; | 148 | struct resource *res; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 151 | static const char * const probes[] = { "RedBoot", "cmdlinepart", NULL }; |
152 | 152 | ||
153 | static int ixp4xx_flash_remove(struct platform_device *dev) | 153 | static int ixp4xx_flash_remove(struct platform_device *dev) |
154 | { | 154 | { |
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c index d1da6ede3845..d7ac65d1d569 100644 --- a/drivers/mtd/maps/lantiq-flash.c +++ b/drivers/mtd/maps/lantiq-flash.c | |||
@@ -46,8 +46,7 @@ struct ltq_mtd { | |||
46 | }; | 46 | }; |
47 | 47 | ||
48 | static const char ltq_map_name[] = "ltq_nor"; | 48 | static const char ltq_map_name[] = "ltq_nor"; |
49 | static const char *ltq_probe_types[] = { | 49 | static const char * const ltq_probe_types[] = { "cmdlinepart", "ofpart", NULL }; |
50 | "cmdlinepart", "ofpart", NULL }; | ||
51 | 50 | ||
52 | static map_word | 51 | static map_word |
53 | ltq_read16(struct map_info *map, unsigned long adr) | 52 | ltq_read16(struct map_info *map, unsigned long adr) |
diff --git a/drivers/mtd/maps/mbx860.c b/drivers/mtd/maps/mbx860.c deleted file mode 100644 index 93fa56c33003..000000000000 --- a/drivers/mtd/maps/mbx860.c +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* | ||
2 | * Handle mapping of the flash on MBX860 boards | ||
3 | * | ||
4 | * Author: Anton Todorov | ||
5 | * Copyright: (C) 2001 Emness Technology | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License version 2 as | ||
9 | * published by the Free Software Foundation. | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | #include <linux/module.h> | ||
14 | #include <linux/types.h> | ||
15 | #include <linux/kernel.h> | ||
16 | #include <linux/init.h> | ||
17 | #include <asm/io.h> | ||
18 | #include <linux/mtd/mtd.h> | ||
19 | #include <linux/mtd/map.h> | ||
20 | #include <linux/mtd/partitions.h> | ||
21 | |||
22 | |||
23 | #define WINDOW_ADDR 0xfe000000 | ||
24 | #define WINDOW_SIZE 0x00200000 | ||
25 | |||
26 | /* Flash / Partition sizing */ | ||
27 | #define MAX_SIZE_KiB 8192 | ||
28 | #define BOOT_PARTITION_SIZE_KiB 512 | ||
29 | #define KERNEL_PARTITION_SIZE_KiB 5632 | ||
30 | #define APP_PARTITION_SIZE_KiB 2048 | ||
31 | |||
32 | #define NUM_PARTITIONS 3 | ||
33 | |||
34 | /* partition_info gives details on the logical partitions that the split the | ||
35 | * single flash device into. If the size if zero we use up to the end of the | ||
36 | * device. */ | ||
37 | static struct mtd_partition partition_info[]={ | ||
38 | { .name = "MBX flash BOOT partition", | ||
39 | .offset = 0, | ||
40 | .size = BOOT_PARTITION_SIZE_KiB*1024 }, | ||
41 | { .name = "MBX flash DATA partition", | ||
42 | .offset = BOOT_PARTITION_SIZE_KiB*1024, | ||
43 | .size = (KERNEL_PARTITION_SIZE_KiB)*1024 }, | ||
44 | { .name = "MBX flash APPLICATION partition", | ||
45 | .offset = (BOOT_PARTITION_SIZE_KiB+KERNEL_PARTITION_SIZE_KiB)*1024 } | ||
46 | }; | ||
47 | |||
48 | |||
49 | static struct mtd_info *mymtd; | ||
50 | |||
51 | struct map_info mbx_map = { | ||
52 | .name = "MBX flash", | ||
53 | .size = WINDOW_SIZE, | ||
54 | .phys = WINDOW_ADDR, | ||
55 | .bankwidth = 4, | ||
56 | }; | ||
57 | |||
58 | static int __init init_mbx(void) | ||
59 | { | ||
60 | printk(KERN_NOTICE "Motorola MBX flash device: 0x%x at 0x%x\n", WINDOW_SIZE*4, WINDOW_ADDR); | ||
61 | mbx_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4); | ||
62 | |||
63 | if (!mbx_map.virt) { | ||
64 | printk("Failed to ioremap\n"); | ||
65 | return -EIO; | ||
66 | } | ||
67 | simple_map_init(&mbx_map); | ||
68 | |||
69 | mymtd = do_map_probe("jedec_probe", &mbx_map); | ||
70 | if (mymtd) { | ||
71 | mymtd->owner = THIS_MODULE; | ||
72 | mtd_device_register(mymtd, NULL, 0); | ||
73 | mtd_device_register(mymtd, partition_info, NUM_PARTITIONS); | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | iounmap((void *)mbx_map.virt); | ||
78 | return -ENXIO; | ||
79 | } | ||
80 | |||
81 | static void __exit cleanup_mbx(void) | ||
82 | { | ||
83 | if (mymtd) { | ||
84 | mtd_device_unregister(mymtd); | ||
85 | map_destroy(mymtd); | ||
86 | } | ||
87 | if (mbx_map.virt) { | ||
88 | iounmap((void *)mbx_map.virt); | ||
89 | mbx_map.virt = 0; | ||
90 | } | ||
91 | } | ||
92 | |||
93 | module_init(init_mbx); | ||
94 | module_exit(cleanup_mbx); | ||
95 | |||
96 | MODULE_AUTHOR("Anton Todorov <a.todorov@emness.com>"); | ||
97 | MODULE_DESCRIPTION("MTD map driver for Motorola MBX860 board"); | ||
98 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mtd/maps/pci.c b/drivers/mtd/maps/pci.c index c3aebd5da5d6..c2604f8b2a5e 100644 --- a/drivers/mtd/maps/pci.c +++ b/drivers/mtd/maps/pci.c | |||
@@ -283,8 +283,7 @@ static int mtd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) | |||
283 | if (err) | 283 | if (err) |
284 | goto release; | 284 | goto release; |
285 | 285 | ||
286 | /* tsk - do_map_probe should take const char * */ | 286 | mtd = do_map_probe(info->map_name, &map->map); |
287 | mtd = do_map_probe((char *)info->map_name, &map->map); | ||
288 | err = -ENODEV; | 287 | err = -ENODEV; |
289 | if (!mtd) | 288 | if (!mtd) |
290 | goto release; | 289 | goto release; |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 21b0b713cacb..e7a592c8c765 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -87,21 +87,18 @@ static void physmap_set_vpp(struct map_info *map, int state) | |||
87 | spin_unlock_irqrestore(&info->vpp_lock, flags); | 87 | spin_unlock_irqrestore(&info->vpp_lock, flags); |
88 | } | 88 | } |
89 | 89 | ||
90 | static const char *rom_probe_types[] = { | 90 | static const char * const rom_probe_types[] = { |
91 | "cfi_probe", | 91 | "cfi_probe", "jedec_probe", "qinfo_probe", "map_rom", NULL }; |
92 | "jedec_probe", | 92 | |
93 | "qinfo_probe", | 93 | static const char * const part_probe_types[] = { |
94 | "map_rom", | 94 | "cmdlinepart", "RedBoot", "afs", NULL }; |
95 | NULL }; | ||
96 | static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", "afs", | ||
97 | NULL }; | ||
98 | 95 | ||
99 | static int physmap_flash_probe(struct platform_device *dev) | 96 | static int physmap_flash_probe(struct platform_device *dev) |
100 | { | 97 | { |
101 | struct physmap_flash_data *physmap_data; | 98 | struct physmap_flash_data *physmap_data; |
102 | struct physmap_flash_info *info; | 99 | struct physmap_flash_info *info; |
103 | const char **probe_type; | 100 | const char * const *probe_type; |
104 | const char **part_types; | 101 | const char * const *part_types; |
105 | int err = 0; | 102 | int err = 0; |
106 | int i; | 103 | int i; |
107 | int devices_found = 0; | 104 | int devices_found = 0; |
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 363939dfad05..d11109762ac5 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -71,6 +71,9 @@ static int of_flash_remove(struct platform_device *dev) | |||
71 | return 0; | 71 | return 0; |
72 | } | 72 | } |
73 | 73 | ||
74 | static const char * const rom_probe_types[] = { | ||
75 | "cfi_probe", "jedec_probe", "map_rom" }; | ||
76 | |||
74 | /* Helper function to handle probing of the obsolete "direct-mapped" | 77 | /* Helper function to handle probing of the obsolete "direct-mapped" |
75 | * compatible binding, which has an extra "probe-type" property | 78 | * compatible binding, which has an extra "probe-type" property |
76 | * describing the type of flash probe necessary. */ | 79 | * describing the type of flash probe necessary. */ |
@@ -80,8 +83,6 @@ static struct mtd_info *obsolete_probe(struct platform_device *dev, | |||
80 | struct device_node *dp = dev->dev.of_node; | 83 | struct device_node *dp = dev->dev.of_node; |
81 | const char *of_probe; | 84 | const char *of_probe; |
82 | struct mtd_info *mtd; | 85 | struct mtd_info *mtd; |
83 | static const char *rom_probe_types[] | ||
84 | = { "cfi_probe", "jedec_probe", "map_rom"}; | ||
85 | int i; | 86 | int i; |
86 | 87 | ||
87 | dev_warn(&dev->dev, "Device tree uses obsolete \"direct-mapped\" " | 88 | dev_warn(&dev->dev, "Device tree uses obsolete \"direct-mapped\" " |
@@ -111,9 +112,10 @@ static struct mtd_info *obsolete_probe(struct platform_device *dev, | |||
111 | specifies the list of partition probers to use. If none is given then the | 112 | specifies the list of partition probers to use. If none is given then the |
112 | default is use. These take precedence over other device tree | 113 | default is use. These take precedence over other device tree |
113 | information. */ | 114 | information. */ |
114 | static const char *part_probe_types_def[] = { "cmdlinepart", "RedBoot", | 115 | static const char * const part_probe_types_def[] = { |
115 | "ofpart", "ofoldpart", NULL }; | 116 | "cmdlinepart", "RedBoot", "ofpart", "ofoldpart", NULL }; |
116 | static const char **of_get_probes(struct device_node *dp) | 117 | |
118 | static const char * const *of_get_probes(struct device_node *dp) | ||
117 | { | 119 | { |
118 | const char *cp; | 120 | const char *cp; |
119 | int cplen; | 121 | int cplen; |
@@ -142,7 +144,7 @@ static const char **of_get_probes(struct device_node *dp) | |||
142 | return res; | 144 | return res; |
143 | } | 145 | } |
144 | 146 | ||
145 | static void of_free_probes(const char **probes) | 147 | static void of_free_probes(const char * const *probes) |
146 | { | 148 | { |
147 | if (probes != part_probe_types_def) | 149 | if (probes != part_probe_types_def) |
148 | kfree(probes); | 150 | kfree(probes); |
@@ -151,7 +153,7 @@ static void of_free_probes(const char **probes) | |||
151 | static struct of_device_id of_flash_match[]; | 153 | static struct of_device_id of_flash_match[]; |
152 | static int of_flash_probe(struct platform_device *dev) | 154 | static int of_flash_probe(struct platform_device *dev) |
153 | { | 155 | { |
154 | const char **part_probe_types; | 156 | const char * const *part_probe_types; |
155 | const struct of_device_id *match; | 157 | const struct of_device_id *match; |
156 | struct device_node *dp = dev->dev.of_node; | 158 | struct device_node *dp = dev->dev.of_node; |
157 | struct resource res; | 159 | struct resource res; |
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 2de66b062f0d..71fdda29594b 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
@@ -199,7 +199,7 @@ static int platram_probe(struct platform_device *pdev) | |||
199 | * supplied by the platform_data struct */ | 199 | * supplied by the platform_data struct */ |
200 | 200 | ||
201 | if (pdata->map_probes) { | 201 | if (pdata->map_probes) { |
202 | const char **map_probes = pdata->map_probes; | 202 | const char * const *map_probes = pdata->map_probes; |
203 | 203 | ||
204 | for ( ; !info->mtd && *map_probes; map_probes++) | 204 | for ( ; !info->mtd && *map_probes; map_probes++) |
205 | info->mtd = do_map_probe(*map_probes , &info->map); | 205 | info->mtd = do_map_probe(*map_probes , &info->map); |
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 43e3dbb976d9..acb1dbcf7ce5 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
@@ -45,9 +45,7 @@ struct pxa2xx_flash_info { | |||
45 | struct map_info map; | 45 | struct map_info map; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | 48 | static const char * const probes[] = { "RedBoot", "cmdlinepart", NULL }; | |
49 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | ||
50 | |||
51 | 49 | ||
52 | static int pxa2xx_flash_probe(struct platform_device *pdev) | 50 | static int pxa2xx_flash_probe(struct platform_device *pdev) |
53 | { | 51 | { |
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c index 49c3fe715eee..ac02fbffd6df 100644 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ b/drivers/mtd/maps/rbtx4939-flash.c | |||
@@ -45,14 +45,15 @@ static int rbtx4939_flash_remove(struct platform_device *dev) | |||
45 | return 0; | 45 | return 0; |
46 | } | 46 | } |
47 | 47 | ||
48 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; | 48 | static const char * const rom_probe_types[] = { |
49 | "cfi_probe", "jedec_probe", NULL }; | ||
49 | 50 | ||
50 | static int rbtx4939_flash_probe(struct platform_device *dev) | 51 | static int rbtx4939_flash_probe(struct platform_device *dev) |
51 | { | 52 | { |
52 | struct rbtx4939_flash_data *pdata; | 53 | struct rbtx4939_flash_data *pdata; |
53 | struct rbtx4939_flash_info *info; | 54 | struct rbtx4939_flash_info *info; |
54 | struct resource *res; | 55 | struct resource *res; |
55 | const char **probe_type; | 56 | const char * const *probe_type; |
56 | int err = 0; | 57 | int err = 0; |
57 | unsigned long size; | 58 | unsigned long size; |
58 | 59 | ||
diff --git a/drivers/mtd/maps/rpxlite.c b/drivers/mtd/maps/rpxlite.c deleted file mode 100644 index ed88225bf667..000000000000 --- a/drivers/mtd/maps/rpxlite.c +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | /* | ||
2 | * Handle mapping of the flash on the RPX Lite and CLLF boards | ||
3 | */ | ||
4 | |||
5 | #include <linux/module.h> | ||
6 | #include <linux/types.h> | ||
7 | #include <linux/kernel.h> | ||
8 | #include <linux/init.h> | ||
9 | #include <asm/io.h> | ||
10 | #include <linux/mtd/mtd.h> | ||
11 | #include <linux/mtd/map.h> | ||
12 | |||
13 | |||
14 | #define WINDOW_ADDR 0xfe000000 | ||
15 | #define WINDOW_SIZE 0x800000 | ||
16 | |||
17 | static struct mtd_info *mymtd; | ||
18 | |||
19 | static struct map_info rpxlite_map = { | ||
20 | .name = "RPX", | ||
21 | .size = WINDOW_SIZE, | ||
22 | .bankwidth = 4, | ||
23 | .phys = WINDOW_ADDR, | ||
24 | }; | ||
25 | |||
26 | static int __init init_rpxlite(void) | ||
27 | { | ||
28 | printk(KERN_NOTICE "RPX Lite or CLLF flash device: %x at %x\n", WINDOW_SIZE*4, WINDOW_ADDR); | ||
29 | rpxlite_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE * 4); | ||
30 | |||
31 | if (!rpxlite_map.virt) { | ||
32 | printk("Failed to ioremap\n"); | ||
33 | return -EIO; | ||
34 | } | ||
35 | simple_map_init(&rpxlite_map); | ||
36 | mymtd = do_map_probe("cfi_probe", &rpxlite_map); | ||
37 | if (mymtd) { | ||
38 | mymtd->owner = THIS_MODULE; | ||
39 | mtd_device_register(mymtd, NULL, 0); | ||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | iounmap((void *)rpxlite_map.virt); | ||
44 | return -ENXIO; | ||
45 | } | ||
46 | |||
47 | static void __exit cleanup_rpxlite(void) | ||
48 | { | ||
49 | if (mymtd) { | ||
50 | mtd_device_unregister(mymtd); | ||
51 | map_destroy(mymtd); | ||
52 | } | ||
53 | if (rpxlite_map.virt) { | ||
54 | iounmap((void *)rpxlite_map.virt); | ||
55 | rpxlite_map.virt = 0; | ||
56 | } | ||
57 | } | ||
58 | |||
59 | module_init(init_rpxlite); | ||
60 | module_exit(cleanup_rpxlite); | ||
61 | |||
62 | MODULE_LICENSE("GPL"); | ||
63 | MODULE_AUTHOR("Arnold Christensen <AKC@pel.dk>"); | ||
64 | MODULE_DESCRIPTION("MTD map driver for RPX Lite and CLLF boards"); | ||
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index f694417cf7e6..29e3dcaa1d90 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
@@ -244,7 +244,7 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev, | |||
244 | return ERR_PTR(ret); | 244 | return ERR_PTR(ret); |
245 | } | 245 | } |
246 | 246 | ||
247 | static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; | 247 | static const char * const part_probes[] = { "cmdlinepart", "RedBoot", NULL }; |
248 | 248 | ||
249 | static int sa1100_mtd_probe(struct platform_device *pdev) | 249 | static int sa1100_mtd_probe(struct platform_device *pdev) |
250 | { | 250 | { |
diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c index 9d900ada6708..83a7a7091562 100644 --- a/drivers/mtd/maps/solutionengine.c +++ b/drivers/mtd/maps/solutionengine.c | |||
@@ -31,7 +31,7 @@ struct map_info soleng_flash_map = { | |||
31 | .bankwidth = 4, | 31 | .bankwidth = 4, |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 34 | static const char * const probes[] = { "RedBoot", "cmdlinepart", NULL }; |
35 | 35 | ||
36 | #ifdef CONFIG_MTD_SUPERH_RESERVE | 36 | #ifdef CONFIG_MTD_SUPERH_RESERVE |
37 | static struct mtd_partition superh_se_partitions[] = { | 37 | static struct mtd_partition superh_se_partitions[] = { |
diff --git a/drivers/mtd/maps/tqm8xxl.c b/drivers/mtd/maps/tqm8xxl.c deleted file mode 100644 index d78587990e7e..000000000000 --- a/drivers/mtd/maps/tqm8xxl.c +++ /dev/null | |||
@@ -1,249 +0,0 @@ | |||
1 | /* | ||
2 | * Handle mapping of the flash memory access routines | ||
3 | * on TQM8xxL based devices. | ||
4 | * | ||
5 | * based on rpxlite.c | ||
6 | * | ||
7 | * Copyright(C) 2001 Kirk Lee <kirk@hpc.ee.ntu.edu.tw> | ||
8 | * | ||
9 | * This code is GPLed | ||
10 | * | ||
11 | */ | ||
12 | |||
13 | /* | ||
14 | * According to TQM8xxL hardware manual, TQM8xxL series have | ||
15 | * following flash memory organisations: | ||
16 | * | capacity | | chip type | | bank0 | | bank1 | | ||
17 | * 2MiB 512Kx16 2MiB 0 | ||
18 | * 4MiB 1Mx16 4MiB 0 | ||
19 | * 8MiB 1Mx16 4MiB 4MiB | ||
20 | * Thus, we choose CONFIG_MTD_CFI_I2 & CONFIG_MTD_CFI_B4 at | ||
21 | * kernel configuration. | ||
22 | */ | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/types.h> | ||
25 | #include <linux/kernel.h> | ||
26 | #include <linux/init.h> | ||
27 | #include <linux/slab.h> | ||
28 | |||
29 | #include <linux/mtd/mtd.h> | ||
30 | #include <linux/mtd/map.h> | ||
31 | #include <linux/mtd/partitions.h> | ||
32 | |||
33 | #include <asm/io.h> | ||
34 | |||
35 | #define FLASH_ADDR 0x40000000 | ||
36 | #define FLASH_SIZE 0x00800000 | ||
37 | #define FLASH_BANK_MAX 4 | ||
38 | |||
39 | // trivial struct to describe partition information | ||
40 | struct mtd_part_def | ||
41 | { | ||
42 | int nums; | ||
43 | unsigned char *type; | ||
44 | struct mtd_partition* mtd_part; | ||
45 | }; | ||
46 | |||
47 | //static struct mtd_info *mymtd; | ||
48 | static struct mtd_info* mtd_banks[FLASH_BANK_MAX]; | ||
49 | static struct map_info* map_banks[FLASH_BANK_MAX]; | ||
50 | static struct mtd_part_def part_banks[FLASH_BANK_MAX]; | ||
51 | static unsigned long num_banks; | ||
52 | static void __iomem *start_scan_addr; | ||
53 | |||
54 | /* | ||
55 | * Here are partition information for all known TQM8xxL series devices. | ||
56 | * See include/linux/mtd/partitions.h for definition of the mtd_partition | ||
57 | * structure. | ||
58 | * | ||
59 | * The *_max_flash_size is the maximum possible mapped flash size which | ||
60 | * is not necessarily the actual flash size. It must correspond to the | ||
61 | * value specified in the mapping definition defined by the | ||
62 | * "struct map_desc *_io_desc" for the corresponding machine. | ||
63 | */ | ||
64 | |||
65 | /* Currently, TQM8xxL has up to 8MiB flash */ | ||
66 | static unsigned long tqm8xxl_max_flash_size = 0x00800000; | ||
67 | |||
68 | /* partition definition for first flash bank | ||
69 | * (cf. "drivers/char/flash_config.c") | ||
70 | */ | ||
71 | static struct mtd_partition tqm8xxl_partitions[] = { | ||
72 | { | ||
73 | .name = "ppcboot", | ||
74 | .offset = 0x00000000, | ||
75 | .size = 0x00020000, /* 128KB */ | ||
76 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
77 | }, | ||
78 | { | ||
79 | .name = "kernel", /* default kernel image */ | ||
80 | .offset = 0x00020000, | ||
81 | .size = 0x000e0000, | ||
82 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
83 | }, | ||
84 | { | ||
85 | .name = "user", | ||
86 | .offset = 0x00100000, | ||
87 | .size = 0x00100000, | ||
88 | }, | ||
89 | { | ||
90 | .name = "initrd", | ||
91 | .offset = 0x00200000, | ||
92 | .size = 0x00200000, | ||
93 | } | ||
94 | }; | ||
95 | /* partition definition for second flash bank */ | ||
96 | static struct mtd_partition tqm8xxl_fs_partitions[] = { | ||
97 | { | ||
98 | .name = "cramfs", | ||
99 | .offset = 0x00000000, | ||
100 | .size = 0x00200000, | ||
101 | }, | ||
102 | { | ||
103 | .name = "jffs", | ||
104 | .offset = 0x00200000, | ||
105 | .size = 0x00200000, | ||
106 | //.size = MTDPART_SIZ_FULL, | ||
107 | } | ||
108 | }; | ||
109 | |||
110 | static int __init init_tqm_mtd(void) | ||
111 | { | ||
112 | int idx = 0, ret = 0; | ||
113 | unsigned long flash_addr, flash_size, mtd_size = 0; | ||
114 | /* pointer to TQM8xxL board info data */ | ||
115 | bd_t *bd = (bd_t *)__res; | ||
116 | |||
117 | flash_addr = bd->bi_flashstart; | ||
118 | flash_size = bd->bi_flashsize; | ||
119 | |||
120 | //request maximum flash size address space | ||
121 | start_scan_addr = ioremap(flash_addr, flash_size); | ||
122 | if (!start_scan_addr) { | ||
123 | printk(KERN_WARNING "%s:Failed to ioremap address:0x%x\n", __func__, flash_addr); | ||
124 | return -EIO; | ||
125 | } | ||
126 | |||
127 | for (idx = 0 ; idx < FLASH_BANK_MAX ; idx++) { | ||
128 | if(mtd_size >= flash_size) | ||
129 | break; | ||
130 | |||
131 | printk(KERN_INFO "%s: chip probing count %d\n", __func__, idx); | ||
132 | |||
133 | map_banks[idx] = kzalloc(sizeof(struct map_info), GFP_KERNEL); | ||
134 | if(map_banks[idx] == NULL) { | ||
135 | ret = -ENOMEM; | ||
136 | /* FIXME: What if some MTD devices were probed already? */ | ||
137 | goto error_mem; | ||
138 | } | ||
139 | |||
140 | map_banks[idx]->name = kmalloc(16, GFP_KERNEL); | ||
141 | |||
142 | if (!map_banks[idx]->name) { | ||
143 | ret = -ENOMEM; | ||
144 | /* FIXME: What if some MTD devices were probed already? */ | ||
145 | goto error_mem; | ||
146 | } | ||
147 | sprintf(map_banks[idx]->name, "TQM8xxL%d", idx); | ||
148 | |||
149 | map_banks[idx]->size = flash_size; | ||
150 | map_banks[idx]->bankwidth = 4; | ||
151 | |||
152 | simple_map_init(map_banks[idx]); | ||
153 | |||
154 | map_banks[idx]->virt = start_scan_addr; | ||
155 | map_banks[idx]->phys = flash_addr; | ||
156 | /* FIXME: This looks utterly bogus, but I'm trying to | ||
157 | preserve the behaviour of the original (shown here)... | ||
158 | |||
159 | map_banks[idx]->map_priv_1 = | ||
160 | start_scan_addr + ((idx > 0) ? | ||
161 | (mtd_banks[idx-1] ? mtd_banks[idx-1]->size : 0) : 0); | ||
162 | */ | ||
163 | |||
164 | if (idx && mtd_banks[idx-1]) { | ||
165 | map_banks[idx]->virt += mtd_banks[idx-1]->size; | ||
166 | map_banks[idx]->phys += mtd_banks[idx-1]->size; | ||
167 | } | ||
168 | |||
169 | //start to probe flash chips | ||
170 | mtd_banks[idx] = do_map_probe("cfi_probe", map_banks[idx]); | ||
171 | |||
172 | if (mtd_banks[idx]) { | ||
173 | mtd_banks[idx]->owner = THIS_MODULE; | ||
174 | mtd_size += mtd_banks[idx]->size; | ||
175 | num_banks++; | ||
176 | |||
177 | printk(KERN_INFO "%s: bank%d, name:%s, size:%dbytes \n", __func__, num_banks, | ||
178 | mtd_banks[idx]->name, mtd_banks[idx]->size); | ||
179 | } | ||
180 | } | ||
181 | |||
182 | /* no supported flash chips found */ | ||
183 | if (!num_banks) { | ||
184 | printk(KERN_NOTICE "TQM8xxL: No support flash chips found!\n"); | ||
185 | ret = -ENXIO; | ||
186 | goto error_mem; | ||
187 | } | ||
188 | |||
189 | /* | ||
190 | * Select Static partition definitions | ||
191 | */ | ||
192 | part_banks[0].mtd_part = tqm8xxl_partitions; | ||
193 | part_banks[0].type = "Static image"; | ||
194 | part_banks[0].nums = ARRAY_SIZE(tqm8xxl_partitions); | ||
195 | |||
196 | part_banks[1].mtd_part = tqm8xxl_fs_partitions; | ||
197 | part_banks[1].type = "Static file system"; | ||
198 | part_banks[1].nums = ARRAY_SIZE(tqm8xxl_fs_partitions); | ||
199 | |||
200 | for(idx = 0; idx < num_banks ; idx++) { | ||
201 | if (part_banks[idx].nums == 0) | ||
202 | printk(KERN_NOTICE "TQM flash%d: no partition info available, registering whole flash at once\n", idx); | ||
203 | else | ||
204 | printk(KERN_NOTICE "TQM flash%d: Using %s partition definition\n", | ||
205 | idx, part_banks[idx].type); | ||
206 | mtd_device_register(mtd_banks[idx], part_banks[idx].mtd_part, | ||
207 | part_banks[idx].nums); | ||
208 | } | ||
209 | return 0; | ||
210 | error_mem: | ||
211 | for(idx = 0 ; idx < FLASH_BANK_MAX ; idx++) { | ||
212 | if(map_banks[idx] != NULL) { | ||
213 | kfree(map_banks[idx]->name); | ||
214 | map_banks[idx]->name = NULL; | ||
215 | kfree(map_banks[idx]); | ||
216 | map_banks[idx] = NULL; | ||
217 | } | ||
218 | } | ||
219 | error: | ||
220 | iounmap(start_scan_addr); | ||
221 | return ret; | ||
222 | } | ||
223 | |||
224 | static void __exit cleanup_tqm_mtd(void) | ||
225 | { | ||
226 | unsigned int idx = 0; | ||
227 | for(idx = 0 ; idx < num_banks ; idx++) { | ||
228 | /* destroy mtd_info previously allocated */ | ||
229 | if (mtd_banks[idx]) { | ||
230 | mtd_device_unregister(mtd_banks[idx]); | ||
231 | map_destroy(mtd_banks[idx]); | ||
232 | } | ||
233 | /* release map_info not used anymore */ | ||
234 | kfree(map_banks[idx]->name); | ||
235 | kfree(map_banks[idx]); | ||
236 | } | ||
237 | |||
238 | if (start_scan_addr) { | ||
239 | iounmap(start_scan_addr); | ||
240 | start_scan_addr = 0; | ||
241 | } | ||
242 | } | ||
243 | |||
244 | module_init(init_tqm_mtd); | ||
245 | module_exit(cleanup_tqm_mtd); | ||
246 | |||
247 | MODULE_LICENSE("GPL"); | ||
248 | MODULE_AUTHOR("Kirk Lee <kirk@hpc.ee.ntu.edu.tw>"); | ||
249 | MODULE_DESCRIPTION("MTD map driver for TQM8xxL boards"); | ||
diff --git a/drivers/mtd/maps/tsunami_flash.c b/drivers/mtd/maps/tsunami_flash.c index 1de390e1c2fb..da2cdb5fd6db 100644 --- a/drivers/mtd/maps/tsunami_flash.c +++ b/drivers/mtd/maps/tsunami_flash.c | |||
@@ -82,11 +82,12 @@ static void __exit cleanup_tsunami_flash(void) | |||
82 | tsunami_flash_mtd = 0; | 82 | tsunami_flash_mtd = 0; |
83 | } | 83 | } |
84 | 84 | ||
85 | static const char * const rom_probe_types[] = { | ||
86 | "cfi_probe", "jedec_probe", "map_rom", NULL }; | ||
85 | 87 | ||
86 | static int __init init_tsunami_flash(void) | 88 | static int __init init_tsunami_flash(void) |
87 | { | 89 | { |
88 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", "map_rom", NULL }; | 90 | const char * const *type; |
89 | char **type; | ||
90 | 91 | ||
91 | tsunami_tig_writeb(FLASH_ENABLE_BYTE, FLASH_ENABLE_PORT); | 92 | tsunami_tig_writeb(FLASH_ENABLE_BYTE, FLASH_ENABLE_PORT); |
92 | 93 | ||