diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 12:11:16 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-07 12:11:16 -0500 |
| commit | e0d65113a70f1dc514e625cc4e7a7485a4bf72df (patch) | |
| tree | 7320a130dc304623f5cf4b5dd8f67fb1776225ca /drivers/mtd/maps | |
| parent | cf5e15fbd72c13977720aa15b7b7e00e1d8fd8f2 (diff) | |
| parent | 48e546b7f281f251893baa40769581fd15f085fb (diff) | |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (226 commits)
mtd: tests: annotate as DANGEROUS in Kconfig
mtd: tests: don't use mtd0 as a default
mtd: clean up usage of MTD_DOCPROBE_ADDRESS
jffs2: add compr=lzo and compr=zlib options
jffs2: implement mount option parsing and compression overriding
mtd: nand: initialize ops.mode
mtd: provide an alias for the redboot module name
mtd: m25p80: don't probe device which has status of 'disabled'
mtd: nand_h1900 never worked
mtd: Add DiskOnChip G3 support
mtd: m25p80: add EON flash EN25Q32B into spi flash id table
mtd: mark block device queue as non-rotational
mtd: r852: make r852_pm_ops static
mtd: m25p80: add support for at25df321a spi data flash
mtd: mxc_nand: preset_v1_v2: unlock all NAND flash blocks
mtd: nand: switch `check_pattern()' to standard `memcmp()'
mtd: nand: invalidate cache on unaligned reads
mtd: nand: do not scan bad blocks with NAND_BBT_NO_OOB set
mtd: nand: wait to set BBT version
mtd: nand: scrub BBT on ECC errors
...
Fix up trivial conflicts:
- arch/arm/mach-at91/board-usb-a9260.c
Merged into board-usb-a926x.c
- drivers/mtd/maps/lantiq-flash.c
add_mtd_partitions -> mtd_device_register vs changed to use
mtd_device_parse_register.
Diffstat (limited to 'drivers/mtd/maps')
| -rw-r--r-- | drivers/mtd/maps/Kconfig | 26 | ||||
| -rw-r--r-- | drivers/mtd/maps/Makefile | 2 | ||||
| -rw-r--r-- | drivers/mtd/maps/bfin-async-flash.c | 16 | ||||
| -rw-r--r-- | drivers/mtd/maps/ceiva.c | 341 | ||||
| -rw-r--r-- | drivers/mtd/maps/dc21285.c | 9 | ||||
| -rw-r--r-- | drivers/mtd/maps/edb7312.c | 134 | ||||
| -rw-r--r-- | drivers/mtd/maps/gpio-addr-flash.c | 16 | ||||
| -rw-r--r-- | drivers/mtd/maps/h720x-flash.c | 23 | ||||
| -rw-r--r-- | drivers/mtd/maps/impa7.c | 28 | ||||
| -rw-r--r-- | drivers/mtd/maps/intel_vr_nor.c | 7 | ||||
| -rw-r--r-- | drivers/mtd/maps/ixp2000.c | 11 | ||||
| -rw-r--r-- | drivers/mtd/maps/ixp4xx.c | 29 | ||||
| -rw-r--r-- | drivers/mtd/maps/lantiq-flash.c | 17 | ||||
| -rw-r--r-- | drivers/mtd/maps/latch-addr-flash.c | 24 | ||||
| -rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 124 | ||||
| -rw-r--r-- | drivers/mtd/maps/physmap.c | 38 | ||||
| -rw-r--r-- | drivers/mtd/maps/physmap_of.c | 80 | ||||
| -rw-r--r-- | drivers/mtd/maps/plat-ram.c | 23 | ||||
| -rw-r--r-- | drivers/mtd/maps/pxa2xx-flash.c | 20 | ||||
| -rw-r--r-- | drivers/mtd/maps/rbtx4939-flash.c | 24 | ||||
| -rw-r--r-- | drivers/mtd/maps/sa1100-flash.c | 30 | ||||
| -rw-r--r-- | drivers/mtd/maps/solutionengine.c | 30 | ||||
| -rw-r--r-- | drivers/mtd/maps/wr_sbc82xx_flash.c | 33 |
23 files changed, 112 insertions, 973 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index c0c328c5b133..8e0c4bf9f7fb 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
| @@ -41,8 +41,6 @@ config MTD_PHYSMAP_START | |||
| 41 | are mapped on your particular target board. Refer to the | 41 | are mapped on your particular target board. Refer to the |
| 42 | memory map which should hopefully be in the documentation for | 42 | memory map which should hopefully be in the documentation for |
| 43 | your board. | 43 | your board. |
| 44 | Ignore this option if you use run-time physmap configuration | ||
| 45 | (i.e., run-time calling physmap_configure()). | ||
| 46 | 44 | ||
| 47 | config MTD_PHYSMAP_LEN | 45 | config MTD_PHYSMAP_LEN |
| 48 | hex "Physical length of flash mapping" | 46 | hex "Physical length of flash mapping" |
| @@ -55,8 +53,6 @@ config MTD_PHYSMAP_LEN | |||
| 55 | than the total amount of flash present. Refer to the memory | 53 | than the total amount of flash present. Refer to the memory |
| 56 | map which should hopefully be in the documentation for your | 54 | map which should hopefully be in the documentation for your |
| 57 | board. | 55 | board. |
| 58 | Ignore this option if you use run-time physmap configuration | ||
| 59 | (i.e., run-time calling physmap_configure()). | ||
| 60 | 56 | ||
| 61 | config MTD_PHYSMAP_BANKWIDTH | 57 | config MTD_PHYSMAP_BANKWIDTH |
| 62 | int "Bank width in octets" | 58 | int "Bank width in octets" |
| @@ -67,8 +63,6 @@ config MTD_PHYSMAP_BANKWIDTH | |||
| 67 | in octets. For example, if you have a data bus width of 32 | 63 | in octets. For example, if you have a data bus width of 32 |
| 68 | bits, you would set the bus width octet value to 4. This is | 64 | bits, you would set the bus width octet value to 4. This is |
| 69 | used internally by the CFI drivers. | 65 | used internally by the CFI drivers. |
| 70 | Ignore this option if you use run-time physmap configuration | ||
| 71 | (i.e., run-time calling physmap_configure()). | ||
| 72 | 66 | ||
| 73 | config MTD_PHYSMAP_OF | 67 | config MTD_PHYSMAP_OF |
| 74 | tristate "Flash device in physical memory map based on OF description" | 68 | tristate "Flash device in physical memory map based on OF description" |
| @@ -260,7 +254,6 @@ config MTD_BCM963XX | |||
| 260 | config MTD_LANTIQ | 254 | config MTD_LANTIQ |
| 261 | tristate "Lantiq SoC NOR support" | 255 | tristate "Lantiq SoC NOR support" |
| 262 | depends on LANTIQ | 256 | depends on LANTIQ |
| 263 | select MTD_PARTITIONS | ||
| 264 | help | 257 | help |
| 265 | Support for NOR flash attached to the Lantiq SoC's External Bus Unit. | 258 | Support for NOR flash attached to the Lantiq SoC's External Bus Unit. |
| 266 | 259 | ||
| @@ -339,10 +332,6 @@ config MTD_SOLUTIONENGINE | |||
| 339 | This enables access to the flash chips on the Hitachi SolutionEngine and | 332 | This enables access to the flash chips on the Hitachi SolutionEngine and |
| 340 | similar boards. Say 'Y' if you are building a kernel for such a board. | 333 | similar boards. Say 'Y' if you are building a kernel for such a board. |
| 341 | 334 | ||
| 342 | config MTD_ARM_INTEGRATOR | ||
| 343 | tristate "CFI Flash device mapped on ARM Integrator/P720T" | ||
| 344 | depends on ARM && MTD_CFI | ||
| 345 | |||
| 346 | config MTD_CDB89712 | 335 | config MTD_CDB89712 |
| 347 | tristate "Cirrus CDB89712 evaluation board mappings" | 336 | tristate "Cirrus CDB89712 evaluation board mappings" |
| 348 | depends on MTD_CFI && ARCH_CDB89712 | 337 | depends on MTD_CFI && ARCH_CDB89712 |
| @@ -398,13 +387,6 @@ config MTD_AUTCPU12 | |||
| 398 | This enables access to the NV-RAM on autronix autcpu12 board. | 387 | This enables access to the NV-RAM on autronix autcpu12 board. |
| 399 | If you have such a board, say 'Y'. | 388 | If you have such a board, say 'Y'. |
| 400 | 389 | ||
| 401 | config MTD_EDB7312 | ||
| 402 | tristate "CFI Flash device mapped on EDB7312" | ||
| 403 | depends on ARCH_EDB7312 && MTD_CFI | ||
| 404 | help | ||
| 405 | This enables access to the CFI Flash on the Cogent EDB7312 board. | ||
| 406 | If you have such a board, say 'Y' here. | ||
| 407 | |||
| 408 | config MTD_IMPA7 | 390 | config MTD_IMPA7 |
| 409 | tristate "JEDEC Flash device mapped on impA7" | 391 | tristate "JEDEC Flash device mapped on impA7" |
| 410 | depends on ARM && MTD_JEDECPROBE | 392 | depends on ARM && MTD_JEDECPROBE |
| @@ -412,14 +394,6 @@ config MTD_IMPA7 | |||
| 412 | This enables access to the NOR Flash on the impA7 board of | 394 | This enables access to the NOR Flash on the impA7 board of |
| 413 | implementa GmbH. If you have such a board, say 'Y' here. | 395 | implementa GmbH. If you have such a board, say 'Y' here. |
| 414 | 396 | ||
| 415 | config MTD_CEIVA | ||
| 416 | tristate "JEDEC Flash device mapped on Ceiva/Polaroid PhotoMax Digital Picture Frame" | ||
| 417 | depends on MTD_JEDECPROBE && ARCH_CEIVA | ||
| 418 | help | ||
| 419 | This enables access to the flash chips on the Ceiva/Polaroid | ||
| 420 | PhotoMax Digital Picture Frame. | ||
| 421 | If you have such a device, say 'Y'. | ||
| 422 | |||
| 423 | config MTD_H720X | 397 | config MTD_H720X |
| 424 | tristate "Hynix evaluation board mappings" | 398 | tristate "Hynix evaluation board mappings" |
| 425 | depends on MTD_CFI && ( ARCH_H7201 || ARCH_H7202 ) | 399 | depends on MTD_CFI && ( ARCH_H7201 || ARCH_H7202 ) |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index cb48b11affff..45dcb8b14f22 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
| @@ -19,7 +19,6 @@ obj-$(CONFIG_MTD_CK804XROM) += ck804xrom.o | |||
| 19 | obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o | 19 | obj-$(CONFIG_MTD_TSUNAMI) += tsunami_flash.o |
| 20 | obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o | 20 | obj-$(CONFIG_MTD_PXA2XX) += pxa2xx-flash.o |
| 21 | obj-$(CONFIG_MTD_MBX860) += mbx860.o | 21 | obj-$(CONFIG_MTD_MBX860) += mbx860.o |
| 22 | obj-$(CONFIG_MTD_CEIVA) += ceiva.o | ||
| 23 | obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o | 22 | obj-$(CONFIG_MTD_OCTAGON) += octagon-5066.o |
| 24 | obj-$(CONFIG_MTD_PHYSMAP) += physmap.o | 23 | obj-$(CONFIG_MTD_PHYSMAP) += physmap.o |
| 25 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o | 24 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o |
| @@ -40,7 +39,6 @@ obj-$(CONFIG_MTD_DBOX2) += dbox2-flash.o | |||
| 40 | obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o | 39 | obj-$(CONFIG_MTD_SOLUTIONENGINE)+= solutionengine.o |
| 41 | obj-$(CONFIG_MTD_PCI) += pci.o | 40 | obj-$(CONFIG_MTD_PCI) += pci.o |
| 42 | obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o | 41 | obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o |
| 43 | obj-$(CONFIG_MTD_EDB7312) += edb7312.o | ||
| 44 | obj-$(CONFIG_MTD_IMPA7) += impa7.o | 42 | obj-$(CONFIG_MTD_IMPA7) += impa7.o |
| 45 | obj-$(CONFIG_MTD_FORTUNET) += fortunet.o | 43 | obj-$(CONFIG_MTD_FORTUNET) += fortunet.o |
| 46 | obj-$(CONFIG_MTD_UCLINUX) += uclinux.o | 44 | obj-$(CONFIG_MTD_UCLINUX) += uclinux.o |
diff --git a/drivers/mtd/maps/bfin-async-flash.c b/drivers/mtd/maps/bfin-async-flash.c index 67815eed2f00..6d6b2b5674ee 100644 --- a/drivers/mtd/maps/bfin-async-flash.c +++ b/drivers/mtd/maps/bfin-async-flash.c | |||
| @@ -41,7 +41,6 @@ struct async_state { | |||
| 41 | uint32_t flash_ambctl0, flash_ambctl1; | 41 | uint32_t flash_ambctl0, flash_ambctl1; |
| 42 | uint32_t save_ambctl0, save_ambctl1; | 42 | uint32_t save_ambctl0, save_ambctl1; |
| 43 | unsigned long irq_flags; | 43 | unsigned long irq_flags; |
| 44 | struct mtd_partition *parts; | ||
| 45 | }; | 44 | }; |
| 46 | 45 | ||
| 47 | static void switch_to_flash(struct async_state *state) | 46 | static void switch_to_flash(struct async_state *state) |
| @@ -165,18 +164,8 @@ static int __devinit bfin_flash_probe(struct platform_device *pdev) | |||
| 165 | return -ENXIO; | 164 | return -ENXIO; |
| 166 | } | 165 | } |
| 167 | 166 | ||
| 168 | ret = parse_mtd_partitions(state->mtd, part_probe_types, &pdata->parts, 0); | 167 | mtd_device_parse_register(state->mtd, part_probe_types, 0, |
| 169 | if (ret > 0) { | 168 | pdata->parts, pdata->nr_parts); |
| 170 | pr_devinit(KERN_NOTICE DRIVER_NAME ": Using commandline partition definition\n"); | ||
| 171 | mtd_device_register(state->mtd, pdata->parts, ret); | ||
| 172 | state->parts = pdata->parts; | ||
| 173 | } else if (pdata->nr_parts) { | ||
| 174 | pr_devinit(KERN_NOTICE DRIVER_NAME ": Using board partition definition\n"); | ||
| 175 | mtd_device_register(state->mtd, pdata->parts, pdata->nr_parts); | ||
| 176 | } else { | ||
| 177 | pr_devinit(KERN_NOTICE DRIVER_NAME ": no partition info available, registering whole flash at once\n"); | ||
| 178 | mtd_device_register(state->mtd, NULL, 0); | ||
| 179 | } | ||
| 180 | 169 | ||
| 181 | platform_set_drvdata(pdev, state); | 170 | platform_set_drvdata(pdev, state); |
| 182 | 171 | ||
| @@ -188,7 +177,6 @@ static int __devexit bfin_flash_remove(struct platform_device *pdev) | |||
| 188 | struct async_state *state = platform_get_drvdata(pdev); | 177 | struct async_state *state = platform_get_drvdata(pdev); |
| 189 | gpio_free(state->enet_flash_pin); | 178 | gpio_free(state->enet_flash_pin); |
| 190 | mtd_device_unregister(state->mtd); | 179 | mtd_device_unregister(state->mtd); |
| 191 | kfree(state->parts); | ||
| 192 | map_destroy(state->mtd); | 180 | map_destroy(state->mtd); |
| 193 | kfree(state); | 181 | kfree(state); |
| 194 | return 0; | 182 | return 0; |
diff --git a/drivers/mtd/maps/ceiva.c b/drivers/mtd/maps/ceiva.c deleted file mode 100644 index 06f9c9815720..000000000000 --- a/drivers/mtd/maps/ceiva.c +++ /dev/null | |||
| @@ -1,341 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Ceiva flash memory driver. | ||
| 3 | * Copyright (C) 2002 Rob Scott <rscott@mtrob.fdns.net> | ||
| 4 | * | ||
| 5 | * Note: this driver supports jedec compatible devices. Modification | ||
| 6 | * for CFI compatible devices should be straight forward: change | ||
| 7 | * jedec_probe to cfi_probe. | ||
| 8 | * | ||
| 9 | * Based on: sa1100-flash.c, which has the following copyright: | ||
| 10 | * Flash memory access on SA11x0 based devices | ||
| 11 | * | ||
| 12 | * (C) 2000 Nicolas Pitre <nico@fluxnic.net> | ||
| 13 | * | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/module.h> | ||
| 17 | #include <linux/types.h> | ||
| 18 | #include <linux/ioport.h> | ||
| 19 | #include <linux/kernel.h> | ||
| 20 | #include <linux/init.h> | ||
| 21 | #include <linux/slab.h> | ||
| 22 | |||
| 23 | #include <linux/mtd/mtd.h> | ||
| 24 | #include <linux/mtd/map.h> | ||
| 25 | #include <linux/mtd/partitions.h> | ||
| 26 | #include <linux/mtd/concat.h> | ||
| 27 | |||
| 28 | #include <mach/hardware.h> | ||
| 29 | #include <asm/mach-types.h> | ||
| 30 | #include <asm/io.h> | ||
| 31 | #include <asm/sizes.h> | ||
| 32 | |||
| 33 | /* | ||
| 34 | * This isn't complete yet, so... | ||
| 35 | */ | ||
| 36 | #define CONFIG_MTD_CEIVA_STATICMAP | ||
| 37 | |||
| 38 | #ifdef CONFIG_MTD_CEIVA_STATICMAP | ||
| 39 | /* | ||
| 40 | * See include/linux/mtd/partitions.h for definition of the mtd_partition | ||
| 41 | * structure. | ||
| 42 | * | ||
| 43 | * Please note: | ||
| 44 | * 1. The flash size given should be the largest flash size that can | ||
| 45 | * be accommodated. | ||
| 46 | * | ||
| 47 | * 2. The bus width must defined in clps_setup_flash. | ||
| 48 | * | ||
| 49 | * The MTD layer will detect flash chip aliasing and reduce the size of | ||
| 50 | * the map accordingly. | ||
| 51 | * | ||
| 52 | */ | ||
| 53 | |||
| 54 | #ifdef CONFIG_ARCH_CEIVA | ||
| 55 | /* Flash / Partition sizing */ | ||
| 56 | /* For the 28F8003, we use the block mapping to calcuate the sizes */ | ||
| 57 | #define MAX_SIZE_KiB (16 + 8 + 8 + 96 + (7*128)) | ||
| 58 | #define BOOT_PARTITION_SIZE_KiB (16) | ||
| 59 | #define PARAMS_PARTITION_SIZE_KiB (8) | ||
| 60 | #define KERNEL_PARTITION_SIZE_KiB (4*128) | ||
| 61 | /* Use both remaining portion of first flash, and all of second flash */ | ||
| 62 | #define ROOT_PARTITION_SIZE_KiB (3*128) + (8*128) | ||
| 63 | |||
| 64 | static struct mtd_partition ceiva_partitions[] = { | ||
| 65 | { | ||
| 66 | .name = "Ceiva BOOT partition", | ||
| 67 | .size = BOOT_PARTITION_SIZE_KiB*1024, | ||
| 68 | .offset = 0, | ||
| 69 | |||
| 70 | },{ | ||
| 71 | .name = "Ceiva parameters partition", | ||
| 72 | .size = PARAMS_PARTITION_SIZE_KiB*1024, | ||
| 73 | .offset = (16 + 8) * 1024, | ||
| 74 | },{ | ||
| 75 | .name = "Ceiva kernel partition", | ||
| 76 | .size = (KERNEL_PARTITION_SIZE_KiB)*1024, | ||
| 77 | .offset = 0x20000, | ||
| 78 | |||
| 79 | },{ | ||
| 80 | .name = "Ceiva root filesystem partition", | ||
| 81 | .offset = MTDPART_OFS_APPEND, | ||
| 82 | .size = (ROOT_PARTITION_SIZE_KiB)*1024, | ||
| 83 | } | ||
| 84 | }; | ||
| 85 | #endif | ||
| 86 | |||
| 87 | static int __init clps_static_partitions(struct mtd_partition **parts) | ||
| 88 | { | ||
| 89 | int nb_parts = 0; | ||
| 90 | |||
| 91 | #ifdef CONFIG_ARCH_CEIVA | ||
| 92 | if (machine_is_ceiva()) { | ||
| 93 | *parts = ceiva_partitions; | ||
| 94 | nb_parts = ARRAY_SIZE(ceiva_partitions); | ||
| 95 | } | ||
| 96 | #endif | ||
| 97 | return nb_parts; | ||
| 98 | } | ||
| 99 | #endif | ||
| 100 | |||
| 101 | struct clps_info { | ||
| 102 | unsigned long base; | ||
| 103 | unsigned long size; | ||
| 104 | int width; | ||
| 105 | void *vbase; | ||
| 106 | struct map_info *map; | ||
| 107 | struct mtd_info *mtd; | ||
| 108 | struct resource *res; | ||
| 109 | }; | ||
| 110 | |||
| 111 | #define NR_SUBMTD 4 | ||
| 112 | |||
| 113 | static struct clps_info info[NR_SUBMTD]; | ||
| 114 | |||
| 115 | static int __init clps_setup_mtd(struct clps_info *clps, int nr, struct mtd_info **rmtd) | ||
| 116 | { | ||
| 117 | struct mtd_info *subdev[nr]; | ||
| 118 | struct map_info *maps; | ||
| 119 | int i, found = 0, ret = 0; | ||
| 120 | |||
| 121 | /* | ||
| 122 | * Allocate the map_info structs in one go. | ||
| 123 | */ | ||
| 124 | maps = kzalloc(sizeof(struct map_info) * nr, GFP_KERNEL); | ||
| 125 | if (!maps) | ||
| 126 | return -ENOMEM; | ||
| 127 | /* | ||
| 128 | * Claim and then map the memory regions. | ||
| 129 | */ | ||
| 130 | for (i = 0; i < nr; i++) { | ||
| 131 | if (clps[i].base == (unsigned long)-1) | ||
| 132 | break; | ||
| 133 | |||
| 134 | clps[i].res = request_mem_region(clps[i].base, clps[i].size, "clps flash"); | ||
| 135 | if (!clps[i].res) { | ||
| 136 | ret = -EBUSY; | ||
| 137 | break; | ||
| 138 | } | ||
| 139 | |||
| 140 | clps[i].map = maps + i; | ||
| 141 | |||
| 142 | clps[i].map->name = "clps flash"; | ||
| 143 | clps[i].map->phys = clps[i].base; | ||
| 144 | |||
| 145 | clps[i].vbase = ioremap(clps[i].base, clps[i].size); | ||
| 146 | if (!clps[i].vbase) { | ||
| 147 | ret = -ENOMEM; | ||
| 148 | break; | ||
| 149 | } | ||
| 150 | |||
| 151 | clps[i].map->virt = (void __iomem *)clps[i].vbase; | ||
| 152 | clps[i].map->bankwidth = clps[i].width; | ||
| 153 | clps[i].map->size = clps[i].size; | ||
| 154 | |||
| 155 | simple_map_init(&clps[i].map); | ||
| 156 | |||
| 157 | clps[i].mtd = do_map_probe("jedec_probe", clps[i].map); | ||
| 158 | if (clps[i].mtd == NULL) { | ||
| 159 | ret = -ENXIO; | ||
| 160 | break; | ||
| 161 | } | ||
| 162 | clps[i].mtd->owner = THIS_MODULE; | ||
| 163 | subdev[i] = clps[i].mtd; | ||
| 164 | |||
| 165 | printk(KERN_INFO "clps flash: JEDEC device at 0x%08lx, %dMiB, " | ||
| 166 | "%d-bit\n", clps[i].base, clps[i].mtd->size >> 20, | ||
| 167 | clps[i].width * 8); | ||
| 168 | found += 1; | ||
| 169 | } | ||
| 170 | |||
| 171 | /* | ||
| 172 | * ENXIO is special. It means we didn't find a chip when | ||
| 173 | * we probed. We need to tear down the mapping, free the | ||
| 174 | * resource and mark it as such. | ||
| 175 | */ | ||
| 176 | if (ret == -ENXIO) { | ||
| 177 | iounmap(clps[i].vbase); | ||
| 178 | clps[i].vbase = NULL; | ||
| 179 | release_resource(clps[i].res); | ||
| 180 | clps[i].res = NULL; | ||
| 181 | } | ||
| 182 | |||
| 183 | /* | ||
| 184 | * If we found one device, don't bother with concat support. | ||
| 185 | * If we found multiple devices, use concat if we have it | ||
| 186 | * available, otherwise fail. | ||
| 187 | */ | ||
| 188 | if (ret == 0 || ret == -ENXIO) { | ||
| 189 | if (found == 1) { | ||
| 190 | *rmtd = subdev[0]; | ||
| 191 | ret = 0; | ||
| 192 | } else if (found > 1) { | ||
| 193 | /* | ||
| 194 | * We detected multiple devices. Concatenate | ||
| 195 | * them together. | ||
| 196 | */ | ||
| 197 | *rmtd = mtd_concat_create(subdev, found, | ||
| 198 | "clps flash"); | ||
| 199 | if (*rmtd == NULL) | ||
| 200 | ret = -ENXIO; | ||
| 201 | } | ||
| 202 | } | ||
| 203 | |||
| 204 | /* | ||
| 205 | * If we failed, clean up. | ||
| 206 | */ | ||
| 207 | if (ret) { | ||
| 208 | do { | ||
| 209 | if (clps[i].mtd) | ||
| 210 | map_destroy(clps[i].mtd); | ||
| 211 | if (clps[i].vbase) | ||
| 212 | iounmap(clps[i].vbase); | ||
| 213 | if (clps[i].res) | ||
| 214 | release_resource(clps[i].res); | ||
| 215 | } while (i--); | ||
| 216 | |||
| 217 | kfree(maps); | ||
| 218 | } | ||
| 219 | |||
| 220 | return ret; | ||
| 221 | } | ||
| 222 | |||
| 223 | static void __exit clps_destroy_mtd(struct clps_info *clps, struct mtd_info *mtd) | ||
| 224 | { | ||
| 225 | int i; | ||
| 226 | |||
| 227 | mtd_device_unregister(mtd); | ||
| 228 | |||
| 229 | if (mtd != clps[0].mtd) | ||
| 230 | mtd_concat_destroy(mtd); | ||
| 231 | |||
| 232 | for (i = NR_SUBMTD; i >= 0; i--) { | ||
| 233 | if (clps[i].mtd) | ||
| 234 | map_destroy(clps[i].mtd); | ||
| 235 | if (clps[i].vbase) | ||
| 236 | iounmap(clps[i].vbase); | ||
| 237 | if (clps[i].res) | ||
| 238 | release_resource(clps[i].res); | ||
| 239 | } | ||
| 240 | kfree(clps[0].map); | ||
| 241 | } | ||
| 242 | |||
| 243 | /* | ||
| 244 | * We define the memory space, size, and width for the flash memory | ||
| 245 | * space here. | ||
| 246 | */ | ||
| 247 | |||
| 248 | static int __init clps_setup_flash(void) | ||
| 249 | { | ||
| 250 | int nr = 0; | ||
| 251 | |||
| 252 | #ifdef CONFIG_ARCH_CEIVA | ||
| 253 | if (machine_is_ceiva()) { | ||
| 254 | info[0].base = CS0_PHYS_BASE; | ||
| 255 | info[0].size = SZ_32M; | ||
| 256 | info[0].width = CEIVA_FLASH_WIDTH; | ||
| 257 | info[1].base = CS1_PHYS_BASE; | ||
| 258 | info[1].size = SZ_32M; | ||
| 259 | info[1].width = CEIVA_FLASH_WIDTH; | ||
| 260 | nr = 2; | ||
| 261 | } | ||
| 262 | #endif | ||
| 263 | return nr; | ||
| 264 | } | ||
| 265 | |||
| 266 | static struct mtd_partition *parsed_parts; | ||
| 267 | static const char *probes[] = { "cmdlinepart", "RedBoot", NULL }; | ||
| 268 | |||
| 269 | static void __init clps_locate_partitions(struct mtd_info *mtd) | ||
| 270 | { | ||
| 271 | const char *part_type = NULL; | ||
| 272 | int nr_parts = 0; | ||
| 273 | do { | ||
| 274 | /* | ||
| 275 | * Partition selection stuff. | ||
| 276 | */ | ||
| 277 | nr_parts = parse_mtd_partitions(mtd, probes, &parsed_parts, 0); | ||
| 278 | if (nr_parts > 0) { | ||
| 279 | part_type = "command line"; | ||
| 280 | break; | ||
| 281 | } | ||
| 282 | #ifdef CONFIG_MTD_CEIVA_STATICMAP | ||
| 283 | nr_parts = clps_static_partitions(&parsed_parts); | ||
| 284 | if (nr_parts > 0) { | ||
| 285 | part_type = "static"; | ||
| 286 | break; | ||
| 287 | } | ||
| 288 | printk("found: %d partitions\n", nr_parts); | ||
| 289 | #endif | ||
| 290 | } while (0); | ||
| 291 | |||
| 292 | if (nr_parts == 0) { | ||
| 293 | printk(KERN_NOTICE "clps flash: no partition info " | ||
| 294 | "available, registering whole flash\n"); | ||
| 295 | mtd_device_register(mtd, NULL, 0); | ||
| 296 | } else { | ||
| 297 | printk(KERN_NOTICE "clps flash: using %s partition " | ||
| 298 | "definition\n", part_type); | ||
| 299 | mtd_device_register(mtd, parsed_parts, nr_parts); | ||
| 300 | } | ||
| 301 | |||
| 302 | /* Always succeeds. */ | ||
| 303 | } | ||
| 304 | |||
| 305 | static void __exit clps_destroy_partitions(void) | ||
| 306 | { | ||
| 307 | kfree(parsed_parts); | ||
| 308 | } | ||
| 309 | |||
| 310 | static struct mtd_info *mymtd; | ||
| 311 | |||
| 312 | static int __init clps_mtd_init(void) | ||
| 313 | { | ||
| 314 | int ret; | ||
| 315 | int nr; | ||
| 316 | |||
| 317 | nr = clps_setup_flash(); | ||
| 318 | if (nr < 0) | ||
| 319 | return nr; | ||
| 320 | |||
| 321 | ret = clps_setup_mtd(info, nr, &mymtd); | ||
| 322 | if (ret) | ||
| 323 | return ret; | ||
| 324 | |||
| 325 | clps_locate_partitions(mymtd); | ||
| 326 | |||
| 327 | return 0; | ||
| 328 | } | ||
| 329 | |||
| 330 | static void __exit clps_mtd_cleanup(void) | ||
| 331 | { | ||
| 332 | clps_destroy_mtd(info, mymtd); | ||
| 333 | clps_destroy_partitions(); | ||
| 334 | } | ||
| 335 | |||
| 336 | module_init(clps_mtd_init); | ||
| 337 | module_exit(clps_mtd_cleanup); | ||
| 338 | |||
| 339 | MODULE_AUTHOR("Rob Scott"); | ||
| 340 | MODULE_DESCRIPTION("Cirrus Logic JEDEC map driver"); | ||
| 341 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mtd/maps/dc21285.c b/drivers/mtd/maps/dc21285.c index 7a9e1989c977..f43b365b848c 100644 --- a/drivers/mtd/maps/dc21285.c +++ b/drivers/mtd/maps/dc21285.c | |||
| @@ -145,14 +145,10 @@ static struct map_info dc21285_map = { | |||
| 145 | 145 | ||
| 146 | 146 | ||
| 147 | /* Partition stuff */ | 147 | /* Partition stuff */ |
| 148 | static struct mtd_partition *dc21285_parts; | ||
| 149 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | 148 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; |
| 150 | 149 | ||
| 151 | static int __init init_dc21285(void) | 150 | static int __init init_dc21285(void) |
| 152 | { | 151 | { |
| 153 | |||
| 154 | int nrparts; | ||
| 155 | |||
| 156 | /* Determine bankwidth */ | 152 | /* Determine bankwidth */ |
| 157 | switch (*CSR_SA110_CNTL & (3<<14)) { | 153 | switch (*CSR_SA110_CNTL & (3<<14)) { |
| 158 | case SA110_CNTL_ROMWIDTH_8: | 154 | case SA110_CNTL_ROMWIDTH_8: |
| @@ -200,8 +196,7 @@ static int __init init_dc21285(void) | |||
| 200 | 196 | ||
| 201 | dc21285_mtd->owner = THIS_MODULE; | 197 | dc21285_mtd->owner = THIS_MODULE; |
| 202 | 198 | ||
| 203 | nrparts = parse_mtd_partitions(dc21285_mtd, probes, &dc21285_parts, 0); | 199 | mtd_device_parse_register(dc21285_mtd, probes, 0, NULL, 0); |
| 204 | mtd_device_register(dc21285_mtd, dc21285_parts, nrparts); | ||
| 205 | 200 | ||
| 206 | if(machine_is_ebsa285()) { | 201 | if(machine_is_ebsa285()) { |
| 207 | /* | 202 | /* |
| @@ -224,8 +219,6 @@ static int __init init_dc21285(void) | |||
| 224 | static void __exit cleanup_dc21285(void) | 219 | static void __exit cleanup_dc21285(void) |
| 225 | { | 220 | { |
| 226 | mtd_device_unregister(dc21285_mtd); | 221 | mtd_device_unregister(dc21285_mtd); |
| 227 | if (dc21285_parts) | ||
| 228 | kfree(dc21285_parts); | ||
| 229 | map_destroy(dc21285_mtd); | 222 | map_destroy(dc21285_mtd); |
| 230 | iounmap(dc21285_map.virt); | 223 | iounmap(dc21285_map.virt); |
| 231 | } | 224 | } |
diff --git a/drivers/mtd/maps/edb7312.c b/drivers/mtd/maps/edb7312.c deleted file mode 100644 index fe42a212bb3e..000000000000 --- a/drivers/mtd/maps/edb7312.c +++ /dev/null | |||
| @@ -1,134 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Handle mapping of the NOR flash on Cogent EDB7312 boards | ||
| 3 | * | ||
| 4 | * Copyright 2002 SYSGO Real-Time Solutions GmbH | ||
| 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 version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include <linux/module.h> | ||
| 12 | #include <linux/types.h> | ||
| 13 | #include <linux/kernel.h> | ||
| 14 | #include <linux/init.h> | ||
| 15 | #include <asm/io.h> | ||
| 16 | #include <linux/mtd/mtd.h> | ||
| 17 | #include <linux/mtd/map.h> | ||
| 18 | #include <linux/mtd/partitions.h> | ||
| 19 | |||
| 20 | #define WINDOW_ADDR 0x00000000 /* physical properties of flash */ | ||
| 21 | #define WINDOW_SIZE 0x01000000 | ||
| 22 | #define BUSWIDTH 2 | ||
| 23 | #define FLASH_BLOCKSIZE_MAIN 0x20000 | ||
| 24 | #define FLASH_NUMBLOCKS_MAIN 128 | ||
| 25 | /* can be "cfi_probe", "jedec_probe", "map_rom", NULL }; */ | ||
| 26 | #define PROBETYPES { "cfi_probe", NULL } | ||
| 27 | |||
| 28 | #define MSG_PREFIX "EDB7312-NOR:" /* prefix for our printk()'s */ | ||
| 29 | #define MTDID "edb7312-nor" /* for mtdparts= partitioning */ | ||
| 30 | |||
| 31 | static struct mtd_info *mymtd; | ||
| 32 | |||
| 33 | struct map_info edb7312nor_map = { | ||
| 34 | .name = "NOR flash on EDB7312", | ||
| 35 | .size = WINDOW_SIZE, | ||
| 36 | .bankwidth = BUSWIDTH, | ||
| 37 | .phys = WINDOW_ADDR, | ||
| 38 | }; | ||
| 39 | |||
| 40 | /* | ||
| 41 | * MTD partitioning stuff | ||
| 42 | */ | ||
| 43 | static struct mtd_partition static_partitions[3] = | ||
| 44 | { | ||
| 45 | { | ||
| 46 | .name = "ARMboot", | ||
| 47 | .size = 0x40000, | ||
| 48 | .offset = 0 | ||
| 49 | }, | ||
| 50 | { | ||
| 51 | .name = "Kernel", | ||
| 52 | .size = 0x200000, | ||
| 53 | .offset = 0x40000 | ||
| 54 | }, | ||
| 55 | { | ||
| 56 | .name = "RootFS", | ||
| 57 | .size = 0xDC0000, | ||
| 58 | .offset = 0x240000 | ||
| 59 | }, | ||
| 60 | }; | ||
| 61 | |||
| 62 | static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; | ||
| 63 | |||
| 64 | static int mtd_parts_nb = 0; | ||
| 65 | static struct mtd_partition *mtd_parts = 0; | ||
| 66 | |||
| 67 | static int __init init_edb7312nor(void) | ||
| 68 | { | ||
| 69 | static const char *rom_probe_types[] = PROBETYPES; | ||
| 70 | const char **type; | ||
| 71 | const char *part_type = 0; | ||
| 72 | |||
| 73 | printk(KERN_NOTICE MSG_PREFIX "0x%08x at 0x%08x\n", | ||
| 74 | WINDOW_SIZE, WINDOW_ADDR); | ||
| 75 | edb7312nor_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE); | ||
| 76 | |||
| 77 | if (!edb7312nor_map.virt) { | ||
| 78 | printk(MSG_PREFIX "failed to ioremap\n"); | ||
| 79 | return -EIO; | ||
| 80 | } | ||
| 81 | |||
| 82 | simple_map_init(&edb7312nor_map); | ||
| 83 | |||
| 84 | mymtd = 0; | ||
| 85 | type = rom_probe_types; | ||
| 86 | for(; !mymtd && *type; type++) { | ||
| 87 | mymtd = do_map_probe(*type, &edb7312nor_map); | ||
| 88 | } | ||
| 89 | if (mymtd) { | ||
| 90 | mymtd->owner = THIS_MODULE; | ||
| 91 | |||
| 92 | mtd_parts_nb = parse_mtd_partitions(mymtd, probes, &mtd_parts, MTDID); | ||
| 93 | if (mtd_parts_nb > 0) | ||
| 94 | part_type = "detected"; | ||
| 95 | |||
| 96 | if (mtd_parts_nb == 0) { | ||
| 97 | mtd_parts = static_partitions; | ||
| 98 | mtd_parts_nb = ARRAY_SIZE(static_partitions); | ||
| 99 | part_type = "static"; | ||
| 100 | } | ||
| 101 | |||
| 102 | if (mtd_parts_nb == 0) | ||
| 103 | printk(KERN_NOTICE MSG_PREFIX "no partition info available\n"); | ||
| 104 | else | ||
| 105 | printk(KERN_NOTICE MSG_PREFIX | ||
| 106 | "using %s partition definition\n", part_type); | ||
| 107 | /* Register the whole device first. */ | ||
| 108 | mtd_device_register(mymtd, NULL, 0); | ||
| 109 | mtd_device_register(mymtd, mtd_parts, mtd_parts_nb); | ||
| 110 | return 0; | ||
| 111 | } | ||
| 112 | |||
| 113 | iounmap((void *)edb7312nor_map.virt); | ||
| 114 | return -ENXIO; | ||
| 115 | } | ||
| 116 | |||
| 117 | static void __exit cleanup_edb7312nor(void) | ||
| 118 | { | ||
| 119 | if (mymtd) { | ||
| 120 | mtd_device_unregister(mymtd); | ||
| 121 | map_destroy(mymtd); | ||
| 122 | } | ||
| 123 | if (edb7312nor_map.virt) { | ||
| 124 | iounmap((void *)edb7312nor_map.virt); | ||
| 125 | edb7312nor_map.virt = 0; | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | module_init(init_edb7312nor); | ||
| 130 | module_exit(cleanup_edb7312nor); | ||
| 131 | |||
| 132 | MODULE_LICENSE("GPL"); | ||
| 133 | MODULE_AUTHOR("Marius Groeger <mag@sysgo.de>"); | ||
| 134 | MODULE_DESCRIPTION("Generic configurable MTD map driver"); | ||
diff --git a/drivers/mtd/maps/gpio-addr-flash.c b/drivers/mtd/maps/gpio-addr-flash.c index 7568c5f8b8ae..1ec66f031c51 100644 --- a/drivers/mtd/maps/gpio-addr-flash.c +++ b/drivers/mtd/maps/gpio-addr-flash.c | |||
| @@ -187,7 +187,6 @@ static const char *part_probe_types[] = { "cmdlinepart", "RedBoot", NULL }; | |||
| 187 | */ | 187 | */ |
| 188 | static int __devinit gpio_flash_probe(struct platform_device *pdev) | 188 | static int __devinit gpio_flash_probe(struct platform_device *pdev) |
| 189 | { | 189 | { |
| 190 | int nr_parts; | ||
| 191 | size_t i, arr_size; | 190 | size_t i, arr_size; |
| 192 | struct physmap_flash_data *pdata; | 191 | struct physmap_flash_data *pdata; |
| 193 | struct resource *memory; | 192 | struct resource *memory; |
| @@ -252,20 +251,9 @@ static int __devinit gpio_flash_probe(struct platform_device *pdev) | |||
| 252 | return -ENXIO; | 251 | return -ENXIO; |
| 253 | } | 252 | } |
| 254 | 253 | ||
| 255 | nr_parts = parse_mtd_partitions(state->mtd, part_probe_types, | ||
| 256 | &pdata->parts, 0); | ||
| 257 | if (nr_parts > 0) { | ||
| 258 | pr_devinit(KERN_NOTICE PFX "Using commandline partition definition\n"); | ||
| 259 | kfree(pdata->parts); | ||
| 260 | } else if (pdata->nr_parts) { | ||
| 261 | pr_devinit(KERN_NOTICE PFX "Using board partition definition\n"); | ||
| 262 | nr_parts = pdata->nr_parts; | ||
| 263 | } else { | ||
| 264 | pr_devinit(KERN_NOTICE PFX "no partition info available, registering whole flash at once\n"); | ||
| 265 | nr_parts = 0; | ||
| 266 | } | ||
| 267 | 254 | ||
| 268 | mtd_device_register(state->mtd, pdata->parts, nr_parts); | 255 | mtd_device_parse_register(state->mtd, part_probe_types, 0, |
| 256 | pdata->parts, pdata->nr_parts); | ||
| 269 | 257 | ||
| 270 | return 0; | 258 | return 0; |
| 271 | } | 259 | } |
diff --git a/drivers/mtd/maps/h720x-flash.c b/drivers/mtd/maps/h720x-flash.c index 7f035860a36b..49c14187fc66 100644 --- a/drivers/mtd/maps/h720x-flash.c +++ b/drivers/mtd/maps/h720x-flash.c | |||
| @@ -58,18 +58,11 @@ static struct mtd_partition h720x_partitions[] = { | |||
| 58 | 58 | ||
| 59 | #define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions) | 59 | #define NUM_PARTITIONS ARRAY_SIZE(h720x_partitions) |
| 60 | 60 | ||
| 61 | static int nr_mtd_parts; | ||
| 62 | static struct mtd_partition *mtd_parts; | ||
| 63 | static const char *probes[] = { "cmdlinepart", NULL }; | ||
| 64 | |||
| 65 | /* | 61 | /* |
| 66 | * Initialize FLASH support | 62 | * Initialize FLASH support |
| 67 | */ | 63 | */ |
| 68 | static int __init h720x_mtd_init(void) | 64 | static int __init h720x_mtd_init(void) |
| 69 | { | 65 | { |
| 70 | |||
| 71 | char *part_type = NULL; | ||
| 72 | |||
| 73 | h720x_map.virt = ioremap(h720x_map.phys, h720x_map.size); | 66 | h720x_map.virt = ioremap(h720x_map.phys, h720x_map.size); |
| 74 | 67 | ||
| 75 | if (!h720x_map.virt) { | 68 | if (!h720x_map.virt) { |
| @@ -92,16 +85,8 @@ static int __init h720x_mtd_init(void) | |||
| 92 | if (mymtd) { | 85 | if (mymtd) { |
| 93 | mymtd->owner = THIS_MODULE; | 86 | mymtd->owner = THIS_MODULE; |
| 94 | 87 | ||
| 95 | nr_mtd_parts = parse_mtd_partitions(mymtd, probes, &mtd_parts, 0); | 88 | mtd_device_parse_register(mymtd, NULL, 0, |
| 96 | if (nr_mtd_parts > 0) | 89 | h720x_partitions, NUM_PARTITIONS); |
| 97 | part_type = "command line"; | ||
| 98 | if (nr_mtd_parts <= 0) { | ||
| 99 | mtd_parts = h720x_partitions; | ||
| 100 | nr_mtd_parts = NUM_PARTITIONS; | ||
| 101 | part_type = "builtin"; | ||
| 102 | } | ||
| 103 | printk(KERN_INFO "Using %s partition table\n", part_type); | ||
| 104 | mtd_device_register(mymtd, mtd_parts, nr_mtd_parts); | ||
| 105 | return 0; | 90 | return 0; |
| 106 | } | 91 | } |
| 107 | 92 | ||
| @@ -120,10 +105,6 @@ static void __exit h720x_mtd_cleanup(void) | |||
| 120 | map_destroy(mymtd); | 105 | map_destroy(mymtd); |
| 121 | } | 106 | } |
| 122 | 107 | ||
| 123 | /* Free partition info, if commandline partition was used */ | ||
| 124 | if (mtd_parts && (mtd_parts != h720x_partitions)) | ||
| 125 | kfree (mtd_parts); | ||
| 126 | |||
| 127 | if (h720x_map.virt) { | 108 | if (h720x_map.virt) { |
| 128 | iounmap((void *)h720x_map.virt); | 109 | iounmap((void *)h720x_map.virt); |
| 129 | h720x_map.virt = 0; | 110 | h720x_map.virt = 0; |
diff --git a/drivers/mtd/maps/impa7.c b/drivers/mtd/maps/impa7.c index 404a50cbafa0..f47aedb24366 100644 --- a/drivers/mtd/maps/impa7.c +++ b/drivers/mtd/maps/impa7.c | |||
| @@ -49,7 +49,7 @@ static struct map_info impa7_map[NUM_FLASHBANKS] = { | |||
| 49 | /* | 49 | /* |
| 50 | * MTD partitioning stuff | 50 | * MTD partitioning stuff |
| 51 | */ | 51 | */ |
| 52 | static struct mtd_partition static_partitions[] = | 52 | static struct mtd_partition partitions[] = |
| 53 | { | 53 | { |
| 54 | { | 54 | { |
| 55 | .name = "FileSystem", | 55 | .name = "FileSystem", |
| @@ -58,16 +58,10 @@ static struct mtd_partition static_partitions[] = | |||
| 58 | }, | 58 | }, |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | static int mtd_parts_nb[NUM_FLASHBANKS]; | ||
| 62 | static struct mtd_partition *mtd_parts[NUM_FLASHBANKS]; | ||
| 63 | |||
| 64 | static const char *probes[] = { "cmdlinepart", NULL }; | ||
| 65 | |||
| 66 | static int __init init_impa7(void) | 61 | static int __init init_impa7(void) |
| 67 | { | 62 | { |
| 68 | static const char *rom_probe_types[] = PROBETYPES; | 63 | static const char *rom_probe_types[] = PROBETYPES; |
| 69 | const char **type; | 64 | const char **type; |
| 70 | const char *part_type = 0; | ||
| 71 | int i; | 65 | int i; |
| 72 | static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = { | 66 | static struct { u_long addr; u_long size; } pt[NUM_FLASHBANKS] = { |
| 73 | { WINDOW_ADDR0, WINDOW_SIZE0 }, | 67 | { WINDOW_ADDR0, WINDOW_SIZE0 }, |
| @@ -97,23 +91,9 @@ static int __init init_impa7(void) | |||
| 97 | if (impa7_mtd[i]) { | 91 | if (impa7_mtd[i]) { |
| 98 | impa7_mtd[i]->owner = THIS_MODULE; | 92 | impa7_mtd[i]->owner = THIS_MODULE; |
| 99 | devicesfound++; | 93 | devicesfound++; |
| 100 | mtd_parts_nb[i] = parse_mtd_partitions(impa7_mtd[i], | 94 | mtd_device_parse_register(impa7_mtd[i], NULL, 0, |
| 101 | probes, | 95 | partitions, |
| 102 | &mtd_parts[i], | 96 | ARRAY_SIZE(partitions)); |
| 103 | 0); | ||
| 104 | if (mtd_parts_nb[i] > 0) { | ||
| 105 | part_type = "command line"; | ||
| 106 | } else { | ||
| 107 | mtd_parts[i] = static_partitions; | ||
| 108 | mtd_parts_nb[i] = ARRAY_SIZE(static_partitions); | ||
| 109 | part_type = "static"; | ||
| 110 | } | ||
| 111 | |||
| 112 | printk(KERN_NOTICE MSG_PREFIX | ||
| 113 | "using %s partition definition\n", | ||
| 114 | part_type); | ||
| 115 | mtd_device_register(impa7_mtd[i], | ||
| 116 | mtd_parts[i], mtd_parts_nb[i]); | ||
| 117 | } | 97 | } |
| 118 | else | 98 | else |
| 119 | iounmap((void *)impa7_map[i].virt); | 99 | iounmap((void *)impa7_map[i].virt); |
diff --git a/drivers/mtd/maps/intel_vr_nor.c b/drivers/mtd/maps/intel_vr_nor.c index d2f47be8754b..08c239604ee4 100644 --- a/drivers/mtd/maps/intel_vr_nor.c +++ b/drivers/mtd/maps/intel_vr_nor.c | |||
| @@ -44,7 +44,6 @@ struct vr_nor_mtd { | |||
| 44 | void __iomem *csr_base; | 44 | void __iomem *csr_base; |
| 45 | struct map_info map; | 45 | struct map_info map; |
| 46 | struct mtd_info *info; | 46 | struct mtd_info *info; |
| 47 | int nr_parts; | ||
| 48 | struct pci_dev *dev; | 47 | struct pci_dev *dev; |
| 49 | }; | 48 | }; |
| 50 | 49 | ||
| @@ -71,13 +70,9 @@ static void __devexit vr_nor_destroy_partitions(struct vr_nor_mtd *p) | |||
| 71 | 70 | ||
| 72 | static int __devinit vr_nor_init_partitions(struct vr_nor_mtd *p) | 71 | static int __devinit vr_nor_init_partitions(struct vr_nor_mtd *p) |
| 73 | { | 72 | { |
| 74 | struct mtd_partition *parts; | ||
| 75 | static const char *part_probes[] = { "cmdlinepart", NULL }; | ||
| 76 | |||
| 77 | /* register the flash bank */ | 73 | /* register the flash bank */ |
| 78 | /* partition the flash bank */ | 74 | /* partition the flash bank */ |
| 79 | p->nr_parts = parse_mtd_partitions(p->info, part_probes, &parts, 0); | 75 | return mtd_device_parse_register(p->info, NULL, 0, NULL, 0); |
| 80 | return mtd_device_register(p->info, parts, p->nr_parts); | ||
| 81 | } | 76 | } |
| 82 | 77 | ||
| 83 | static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p) | 78 | static void __devexit vr_nor_destroy_mtd_setup(struct vr_nor_mtd *p) |
diff --git a/drivers/mtd/maps/ixp2000.c b/drivers/mtd/maps/ixp2000.c index 1594a802631d..437fcd2f352f 100644 --- a/drivers/mtd/maps/ixp2000.c +++ b/drivers/mtd/maps/ixp2000.c | |||
| @@ -38,7 +38,6 @@ | |||
| 38 | struct ixp2000_flash_info { | 38 | struct ixp2000_flash_info { |
| 39 | struct mtd_info *mtd; | 39 | struct mtd_info *mtd; |
| 40 | struct map_info map; | 40 | struct map_info map; |
| 41 | struct mtd_partition *partitions; | ||
| 42 | struct resource *res; | 41 | struct resource *res; |
| 43 | }; | 42 | }; |
| 44 | 43 | ||
| @@ -125,8 +124,6 @@ static int ixp2000_flash_remove(struct platform_device *dev) | |||
| 125 | if (info->map.map_priv_1) | 124 | if (info->map.map_priv_1) |
| 126 | iounmap((void *) info->map.map_priv_1); | 125 | iounmap((void *) info->map.map_priv_1); |
| 127 | 126 | ||
| 128 | kfree(info->partitions); | ||
| 129 | |||
| 130 | if (info->res) { | 127 | if (info->res) { |
| 131 | release_resource(info->res); | 128 | release_resource(info->res); |
| 132 | kfree(info->res); | 129 | kfree(info->res); |
| @@ -229,13 +226,7 @@ static int ixp2000_flash_probe(struct platform_device *dev) | |||
| 229 | } | 226 | } |
| 230 | info->mtd->owner = THIS_MODULE; | 227 | info->mtd->owner = THIS_MODULE; |
| 231 | 228 | ||
| 232 | err = parse_mtd_partitions(info->mtd, probes, &info->partitions, 0); | 229 | err = mtd_device_parse_register(info->mtd, probes, 0, NULL, 0); |
| 233 | if (err > 0) { | ||
| 234 | err = mtd_device_register(info->mtd, info->partitions, err); | ||
| 235 | if(err) | ||
| 236 | dev_err(&dev->dev, "Could not parse partitions\n"); | ||
| 237 | } | ||
| 238 | |||
| 239 | if (err) | 230 | if (err) |
| 240 | goto Error; | 231 | goto Error; |
| 241 | 232 | ||
diff --git a/drivers/mtd/maps/ixp4xx.c b/drivers/mtd/maps/ixp4xx.c index 155b21942f47..30409015a3de 100644 --- a/drivers/mtd/maps/ixp4xx.c +++ b/drivers/mtd/maps/ixp4xx.c | |||
| @@ -145,7 +145,6 @@ static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr) | |||
| 145 | struct ixp4xx_flash_info { | 145 | struct ixp4xx_flash_info { |
| 146 | struct mtd_info *mtd; | 146 | struct mtd_info *mtd; |
| 147 | struct map_info map; | 147 | struct map_info map; |
| 148 | struct mtd_partition *partitions; | ||
| 149 | struct resource *res; | 148 | struct resource *res; |
| 150 | }; | 149 | }; |
| 151 | 150 | ||
| @@ -168,8 +167,6 @@ static int ixp4xx_flash_remove(struct platform_device *dev) | |||
| 168 | if (info->map.virt) | 167 | if (info->map.virt) |
| 169 | iounmap(info->map.virt); | 168 | iounmap(info->map.virt); |
| 170 | 169 | ||
| 171 | kfree(info->partitions); | ||
| 172 | |||
| 173 | if (info->res) { | 170 | if (info->res) { |
| 174 | release_resource(info->res); | 171 | release_resource(info->res); |
| 175 | kfree(info->res); | 172 | kfree(info->res); |
| @@ -185,8 +182,6 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
| 185 | { | 182 | { |
| 186 | struct flash_platform_data *plat = dev->dev.platform_data; | 183 | struct flash_platform_data *plat = dev->dev.platform_data; |
| 187 | struct ixp4xx_flash_info *info; | 184 | struct ixp4xx_flash_info *info; |
| 188 | const char *part_type = NULL; | ||
| 189 | int nr_parts = 0; | ||
| 190 | int err = -1; | 185 | int err = -1; |
| 191 | 186 | ||
| 192 | if (!plat) | 187 | if (!plat) |
| @@ -252,28 +247,12 @@ static int ixp4xx_flash_probe(struct platform_device *dev) | |||
| 252 | /* Use the fast version */ | 247 | /* Use the fast version */ |
| 253 | info->map.write = ixp4xx_write16; | 248 | info->map.write = ixp4xx_write16; |
| 254 | 249 | ||
| 255 | nr_parts = parse_mtd_partitions(info->mtd, probes, &info->partitions, | 250 | err = mtd_device_parse_register(info->mtd, probes, dev->resource->start, |
| 256 | dev->resource->start); | 251 | plat->parts, plat->nr_parts); |
| 257 | if (nr_parts > 0) { | 252 | if (err) { |
| 258 | part_type = "dynamic"; | ||
| 259 | } else { | ||
| 260 | info->partitions = plat->parts; | ||
| 261 | nr_parts = plat->nr_parts; | ||
| 262 | part_type = "static"; | ||
| 263 | } | ||
| 264 | if (nr_parts == 0) | ||
| 265 | printk(KERN_NOTICE "IXP4xx flash: no partition info " | ||
| 266 | "available, registering whole flash\n"); | ||
| 267 | else | ||
| 268 | printk(KERN_NOTICE "IXP4xx flash: using %s partition " | ||
| 269 | "definition\n", part_type); | ||
| 270 | |||
| 271 | err = mtd_device_register(info->mtd, info->partitions, nr_parts); | ||
| 272 | if (err) | ||
| 273 | printk(KERN_ERR "Could not parse partitions\n"); | 253 | printk(KERN_ERR "Could not parse partitions\n"); |
| 274 | |||
| 275 | if (err) | ||
| 276 | goto Error; | 254 | goto Error; |
| 255 | } | ||
| 277 | 256 | ||
| 278 | return 0; | 257 | return 0; |
| 279 | 258 | ||
diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c index 7e508969239e..4f10e27ada55 100644 --- a/drivers/mtd/maps/lantiq-flash.c +++ b/drivers/mtd/maps/lantiq-flash.c | |||
| @@ -107,16 +107,12 @@ ltq_copy_to(struct map_info *map, unsigned long to, | |||
| 107 | spin_unlock_irqrestore(&ebu_lock, flags); | 107 | spin_unlock_irqrestore(&ebu_lock, flags); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | static const char const *part_probe_types[] = { "cmdlinepart", NULL }; | ||
| 111 | |||
| 112 | static int __init | 110 | static int __init |
| 113 | ltq_mtd_probe(struct platform_device *pdev) | 111 | ltq_mtd_probe(struct platform_device *pdev) |
| 114 | { | 112 | { |
| 115 | struct physmap_flash_data *ltq_mtd_data = dev_get_platdata(&pdev->dev); | 113 | struct physmap_flash_data *ltq_mtd_data = dev_get_platdata(&pdev->dev); |
| 116 | struct ltq_mtd *ltq_mtd; | 114 | struct ltq_mtd *ltq_mtd; |
| 117 | struct mtd_partition *parts; | ||
| 118 | struct resource *res; | 115 | struct resource *res; |
| 119 | int nr_parts = 0; | ||
| 120 | struct cfi_private *cfi; | 116 | struct cfi_private *cfi; |
| 121 | int err; | 117 | int err; |
| 122 | 118 | ||
| @@ -172,17 +168,8 @@ ltq_mtd_probe(struct platform_device *pdev) | |||
| 172 | cfi->addr_unlock1 ^= 1; | 168 | cfi->addr_unlock1 ^= 1; |
| 173 | cfi->addr_unlock2 ^= 1; | 169 | cfi->addr_unlock2 ^= 1; |
| 174 | 170 | ||
| 175 | nr_parts = parse_mtd_partitions(ltq_mtd->mtd, | 171 | err = mtd_device_parse_register(ltq_mtd->mtd, NULL, 0, |
| 176 | part_probe_types, &parts, 0); | 172 | ltq_mtd_data->parts, ltq_mtd_data->nr_parts); |
| 177 | if (nr_parts > 0) { | ||
| 178 | dev_info(&pdev->dev, | ||
| 179 | "using %d partitions from cmdline", nr_parts); | ||
| 180 | } else { | ||
| 181 | nr_parts = ltq_mtd_data->nr_parts; | ||
| 182 | parts = ltq_mtd_data->parts; | ||
| 183 | } | ||
| 184 | |||
| 185 | err = mtd_device_register(ltq_mtd->mtd, parts, nr_parts); | ||
| 186 | if (err) { | 173 | if (err) { |
| 187 | dev_err(&pdev->dev, "failed to add partitions\n"); | 174 | dev_err(&pdev->dev, "failed to add partitions\n"); |
| 188 | goto err_destroy; | 175 | goto err_destroy; |
diff --git a/drivers/mtd/maps/latch-addr-flash.c b/drivers/mtd/maps/latch-addr-flash.c index 5936c466e901..119baa7d7477 100644 --- a/drivers/mtd/maps/latch-addr-flash.c +++ b/drivers/mtd/maps/latch-addr-flash.c | |||
| @@ -33,9 +33,6 @@ struct latch_addr_flash_info { | |||
| 33 | /* cache; could be found out of res */ | 33 | /* cache; could be found out of res */ |
| 34 | unsigned long win_mask; | 34 | unsigned long win_mask; |
| 35 | 35 | ||
| 36 | int nr_parts; | ||
| 37 | struct mtd_partition *parts; | ||
| 38 | |||
| 39 | spinlock_t lock; | 36 | spinlock_t lock; |
| 40 | }; | 37 | }; |
| 41 | 38 | ||
| @@ -97,8 +94,6 @@ static void lf_copy_from(struct map_info *map, void *to, | |||
| 97 | 94 | ||
| 98 | static char *rom_probe_types[] = { "cfi_probe", NULL }; | 95 | static char *rom_probe_types[] = { "cfi_probe", NULL }; |
| 99 | 96 | ||
| 100 | static char *part_probe_types[] = { "cmdlinepart", NULL }; | ||
| 101 | |||
| 102 | static int latch_addr_flash_remove(struct platform_device *dev) | 97 | static int latch_addr_flash_remove(struct platform_device *dev) |
| 103 | { | 98 | { |
| 104 | struct latch_addr_flash_info *info; | 99 | struct latch_addr_flash_info *info; |
| @@ -112,8 +107,6 @@ static int latch_addr_flash_remove(struct platform_device *dev) | |||
| 112 | latch_addr_data = dev->dev.platform_data; | 107 | latch_addr_data = dev->dev.platform_data; |
| 113 | 108 | ||
| 114 | if (info->mtd != NULL) { | 109 | if (info->mtd != NULL) { |
| 115 | if (info->nr_parts) | ||
| 116 | kfree(info->parts); | ||
| 117 | mtd_device_unregister(info->mtd); | 110 | mtd_device_unregister(info->mtd); |
| 118 | map_destroy(info->mtd); | 111 | map_destroy(info->mtd); |
| 119 | } | 112 | } |
| @@ -206,21 +199,8 @@ static int __devinit latch_addr_flash_probe(struct platform_device *dev) | |||
| 206 | } | 199 | } |
| 207 | info->mtd->owner = THIS_MODULE; | 200 | info->mtd->owner = THIS_MODULE; |
| 208 | 201 | ||
| 209 | err = parse_mtd_partitions(info->mtd, (const char **)part_probe_types, | 202 | mtd_device_parse_register(info->mtd, NULL, 0, |
| 210 | &info->parts, 0); | 203 | latch_addr_data->parts, latch_addr_data->nr_parts); |
| 211 | if (err > 0) { | ||
| 212 | mtd_device_register(info->mtd, info->parts, err); | ||
| 213 | return 0; | ||
| 214 | } | ||
| 215 | if (latch_addr_data->nr_parts) { | ||
| 216 | pr_notice("Using latch-addr-flash partition information\n"); | ||
| 217 | mtd_device_register(info->mtd, | ||
| 218 | latch_addr_data->parts, | ||
| 219 | latch_addr_data->nr_parts); | ||
| 220 | return 0; | ||
| 221 | } | ||
| 222 | |||
| 223 | mtd_device_register(info->mtd, NULL, 0); | ||
| 224 | return 0; | 204 | return 0; |
| 225 | 205 | ||
| 226 | iounmap: | 206 | iounmap: |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index bbe168b65c26..e8e9fec23553 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
| @@ -22,22 +22,6 @@ | |||
| 22 | #include <linux/mtd/map.h> | 22 | #include <linux/mtd/map.h> |
| 23 | #include <linux/mtd/mtd.h> | 23 | #include <linux/mtd/mtd.h> |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_MTD_DEBUG | ||
| 26 | static int debug = CONFIG_MTD_DEBUG_VERBOSE; | ||
| 27 | module_param(debug, int, 0); | ||
| 28 | MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy"); | ||
| 29 | #undef DEBUG | ||
| 30 | #define DEBUG(n, format, arg...) \ | ||
| 31 | if (n <= debug) { \ | ||
| 32 | printk(KERN_DEBUG __FILE__ ":%s(): " format "\n", __func__ , ## arg); \ | ||
| 33 | } | ||
| 34 | |||
| 35 | #else | ||
| 36 | #undef DEBUG | ||
| 37 | #define DEBUG(n, arg...) | ||
| 38 | static const int debug = 0; | ||
| 39 | #endif | ||
| 40 | |||
| 41 | #define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg) | 25 | #define info(format, arg...) printk(KERN_INFO "pcmciamtd: " format "\n" , ## arg) |
| 42 | 26 | ||
| 43 | #define DRIVER_DESC "PCMCIA Flash memory card driver" | 27 | #define DRIVER_DESC "PCMCIA Flash memory card driver" |
| @@ -105,13 +89,13 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) | |||
| 105 | int ret; | 89 | int ret; |
| 106 | 90 | ||
| 107 | if (!pcmcia_dev_present(dev->p_dev)) { | 91 | if (!pcmcia_dev_present(dev->p_dev)) { |
| 108 | DEBUG(1, "device removed"); | 92 | pr_debug("device removed\n"); |
| 109 | return 0; | 93 | return 0; |
| 110 | } | 94 | } |
| 111 | 95 | ||
| 112 | offset = to & ~(dev->win_size-1); | 96 | offset = to & ~(dev->win_size-1); |
| 113 | if (offset != dev->offset) { | 97 | if (offset != dev->offset) { |
| 114 | DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", | 98 | pr_debug("Remapping window from 0x%8.8x to 0x%8.8x\n", |
| 115 | dev->offset, offset); | 99 | dev->offset, offset); |
| 116 | ret = pcmcia_map_mem_page(dev->p_dev, win, offset); | 100 | ret = pcmcia_map_mem_page(dev->p_dev, win, offset); |
| 117 | if (ret != 0) | 101 | if (ret != 0) |
| @@ -132,7 +116,7 @@ static map_word pcmcia_read8_remap(struct map_info *map, unsigned long ofs) | |||
| 132 | return d; | 116 | return d; |
| 133 | 117 | ||
| 134 | d.x[0] = readb(addr); | 118 | d.x[0] = readb(addr); |
| 135 | DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx", ofs, addr, d.x[0]); | 119 | pr_debug("ofs = 0x%08lx (%p) data = 0x%02lx\n", ofs, addr, d.x[0]); |
| 136 | return d; | 120 | return d; |
| 137 | } | 121 | } |
| 138 | 122 | ||
| @@ -147,7 +131,7 @@ static map_word pcmcia_read16_remap(struct map_info *map, unsigned long ofs) | |||
| 147 | return d; | 131 | return d; |
| 148 | 132 | ||
| 149 | d.x[0] = readw(addr); | 133 | d.x[0] = readw(addr); |
| 150 | DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx", ofs, addr, d.x[0]); | 134 | pr_debug("ofs = 0x%08lx (%p) data = 0x%04lx\n", ofs, addr, d.x[0]); |
| 151 | return d; | 135 | return d; |
| 152 | } | 136 | } |
| 153 | 137 | ||
| @@ -157,7 +141,7 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long | |||
| 157 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 141 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
| 158 | unsigned long win_size = dev->win_size; | 142 | unsigned long win_size = dev->win_size; |
| 159 | 143 | ||
| 160 | DEBUG(3, "to = %p from = %lu len = %zd", to, from, len); | 144 | pr_debug("to = %p from = %lu len = %zd\n", to, from, len); |
| 161 | while(len) { | 145 | while(len) { |
| 162 | int toread = win_size - (from & (win_size-1)); | 146 | int toread = win_size - (from & (win_size-1)); |
| 163 | caddr_t addr; | 147 | caddr_t addr; |
| @@ -169,7 +153,7 @@ static void pcmcia_copy_from_remap(struct map_info *map, void *to, unsigned long | |||
| 169 | if(!addr) | 153 | if(!addr) |
| 170 | return; | 154 | return; |
| 171 | 155 | ||
| 172 | DEBUG(4, "memcpy from %p to %p len = %d", addr, to, toread); | 156 | pr_debug("memcpy from %p to %p len = %d\n", addr, to, toread); |
| 173 | memcpy_fromio(to, addr, toread); | 157 | memcpy_fromio(to, addr, toread); |
| 174 | len -= toread; | 158 | len -= toread; |
| 175 | to += toread; | 159 | to += toread; |
| @@ -185,7 +169,7 @@ static void pcmcia_write8_remap(struct map_info *map, map_word d, unsigned long | |||
| 185 | if(!addr) | 169 | if(!addr) |
| 186 | return; | 170 | return; |
| 187 | 171 | ||
| 188 | DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx", adr, addr, d.x[0]); | 172 | pr_debug("adr = 0x%08lx (%p) data = 0x%02lx\n", adr, addr, d.x[0]); |
| 189 | writeb(d.x[0], addr); | 173 | writeb(d.x[0], addr); |
| 190 | } | 174 | } |
| 191 | 175 | ||
| @@ -196,7 +180,7 @@ static void pcmcia_write16_remap(struct map_info *map, map_word d, unsigned long | |||
| 196 | if(!addr) | 180 | if(!addr) |
| 197 | return; | 181 | return; |
| 198 | 182 | ||
| 199 | DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx", adr, addr, d.x[0]); | 183 | pr_debug("adr = 0x%08lx (%p) data = 0x%04lx\n", adr, addr, d.x[0]); |
| 200 | writew(d.x[0], addr); | 184 | writew(d.x[0], addr); |
| 201 | } | 185 | } |
| 202 | 186 | ||
| @@ -206,7 +190,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v | |||
| 206 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 190 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
| 207 | unsigned long win_size = dev->win_size; | 191 | unsigned long win_size = dev->win_size; |
| 208 | 192 | ||
| 209 | DEBUG(3, "to = %lu from = %p len = %zd", to, from, len); | 193 | pr_debug("to = %lu from = %p len = %zd\n", to, from, len); |
| 210 | while(len) { | 194 | while(len) { |
| 211 | int towrite = win_size - (to & (win_size-1)); | 195 | int towrite = win_size - (to & (win_size-1)); |
| 212 | caddr_t addr; | 196 | caddr_t addr; |
| @@ -218,7 +202,7 @@ static void pcmcia_copy_to_remap(struct map_info *map, unsigned long to, const v | |||
| 218 | if(!addr) | 202 | if(!addr) |
| 219 | return; | 203 | return; |
| 220 | 204 | ||
| 221 | DEBUG(4, "memcpy from %p to %p len = %d", from, addr, towrite); | 205 | pr_debug("memcpy from %p to %p len = %d\n", from, addr, towrite); |
| 222 | memcpy_toio(addr, from, towrite); | 206 | memcpy_toio(addr, from, towrite); |
| 223 | len -= towrite; | 207 | len -= towrite; |
| 224 | to += towrite; | 208 | to += towrite; |
| @@ -240,7 +224,7 @@ static map_word pcmcia_read8(struct map_info *map, unsigned long ofs) | |||
| 240 | return d; | 224 | return d; |
| 241 | 225 | ||
| 242 | d.x[0] = readb(win_base + ofs); | 226 | d.x[0] = readb(win_base + ofs); |
| 243 | DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%02lx", | 227 | pr_debug("ofs = 0x%08lx (%p) data = 0x%02lx\n", |
| 244 | ofs, win_base + ofs, d.x[0]); | 228 | ofs, win_base + ofs, d.x[0]); |
| 245 | return d; | 229 | return d; |
| 246 | } | 230 | } |
| @@ -255,7 +239,7 @@ static map_word pcmcia_read16(struct map_info *map, unsigned long ofs) | |||
| 255 | return d; | 239 | return d; |
| 256 | 240 | ||
| 257 | d.x[0] = readw(win_base + ofs); | 241 | d.x[0] = readw(win_base + ofs); |
| 258 | DEBUG(3, "ofs = 0x%08lx (%p) data = 0x%04lx", | 242 | pr_debug("ofs = 0x%08lx (%p) data = 0x%04lx\n", |
| 259 | ofs, win_base + ofs, d.x[0]); | 243 | ofs, win_base + ofs, d.x[0]); |
| 260 | return d; | 244 | return d; |
| 261 | } | 245 | } |
| @@ -268,7 +252,7 @@ static void pcmcia_copy_from(struct map_info *map, void *to, unsigned long from, | |||
| 268 | if(DEV_REMOVED(map)) | 252 | if(DEV_REMOVED(map)) |
| 269 | return; | 253 | return; |
| 270 | 254 | ||
| 271 | DEBUG(3, "to = %p from = %lu len = %zd", to, from, len); | 255 | pr_debug("to = %p from = %lu len = %zd\n", to, from, len); |
| 272 | memcpy_fromio(to, win_base + from, len); | 256 | memcpy_fromio(to, win_base + from, len); |
| 273 | } | 257 | } |
| 274 | 258 | ||
| @@ -280,7 +264,7 @@ static void pcmcia_write8(struct map_info *map, map_word d, unsigned long adr) | |||
| 280 | if(DEV_REMOVED(map)) | 264 | if(DEV_REMOVED(map)) |
| 281 | return; | 265 | return; |
| 282 | 266 | ||
| 283 | DEBUG(3, "adr = 0x%08lx (%p) data = 0x%02lx", | 267 | pr_debug("adr = 0x%08lx (%p) data = 0x%02lx\n", |
| 284 | adr, win_base + adr, d.x[0]); | 268 | adr, win_base + adr, d.x[0]); |
| 285 | writeb(d.x[0], win_base + adr); | 269 | writeb(d.x[0], win_base + adr); |
| 286 | } | 270 | } |
| @@ -293,7 +277,7 @@ static void pcmcia_write16(struct map_info *map, map_word d, unsigned long adr) | |||
| 293 | if(DEV_REMOVED(map)) | 277 | if(DEV_REMOVED(map)) |
| 294 | return; | 278 | return; |
| 295 | 279 | ||
| 296 | DEBUG(3, "adr = 0x%08lx (%p) data = 0x%04lx", | 280 | pr_debug("adr = 0x%08lx (%p) data = 0x%04lx\n", |
| 297 | adr, win_base + adr, d.x[0]); | 281 | adr, win_base + adr, d.x[0]); |
| 298 | writew(d.x[0], win_base + adr); | 282 | writew(d.x[0], win_base + adr); |
| 299 | } | 283 | } |
| @@ -306,7 +290,7 @@ static void pcmcia_copy_to(struct map_info *map, unsigned long to, const void *f | |||
| 306 | if(DEV_REMOVED(map)) | 290 | if(DEV_REMOVED(map)) |
| 307 | return; | 291 | return; |
| 308 | 292 | ||
| 309 | DEBUG(3, "to = %lu from = %p len = %zd", to, from, len); | 293 | pr_debug("to = %lu from = %p len = %zd\n", to, from, len); |
| 310 | memcpy_toio(win_base + to, from, len); | 294 | memcpy_toio(win_base + to, from, len); |
| 311 | } | 295 | } |
| 312 | 296 | ||
| @@ -316,7 +300,7 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) | |||
| 316 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; | 300 | struct pcmciamtd_dev *dev = (struct pcmciamtd_dev *)map->map_priv_1; |
| 317 | struct pcmcia_device *link = dev->p_dev; | 301 | struct pcmcia_device *link = dev->p_dev; |
| 318 | 302 | ||
| 319 | DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); | 303 | pr_debug("dev = %p on = %d vpp = %d\n\n", dev, on, dev->vpp); |
| 320 | pcmcia_fixup_vpp(link, on ? dev->vpp : 0); | 304 | pcmcia_fixup_vpp(link, on ? dev->vpp : 0); |
| 321 | } | 305 | } |
| 322 | 306 | ||
| @@ -325,7 +309,7 @@ static void pcmciamtd_release(struct pcmcia_device *link) | |||
| 325 | { | 309 | { |
| 326 | struct pcmciamtd_dev *dev = link->priv; | 310 | struct pcmciamtd_dev *dev = link->priv; |
| 327 | 311 | ||
| 328 | DEBUG(3, "link = 0x%p", link); | 312 | pr_debug("link = 0x%p\n", link); |
| 329 | 313 | ||
| 330 | if (link->resource[2]->end) { | 314 | if (link->resource[2]->end) { |
| 331 | if(dev->win_base) { | 315 | if(dev->win_base) { |
| @@ -337,7 +321,6 @@ static void pcmciamtd_release(struct pcmcia_device *link) | |||
| 337 | } | 321 | } |
| 338 | 322 | ||
| 339 | 323 | ||
| 340 | #ifdef CONFIG_MTD_DEBUG | ||
| 341 | static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev, | 324 | static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev, |
| 342 | tuple_t *tuple, | 325 | tuple_t *tuple, |
| 343 | void *priv_data) | 326 | void *priv_data) |
| @@ -347,7 +330,7 @@ static int pcmciamtd_cistpl_format(struct pcmcia_device *p_dev, | |||
| 347 | if (!pcmcia_parse_tuple(tuple, &parse)) { | 330 | if (!pcmcia_parse_tuple(tuple, &parse)) { |
| 348 | cistpl_format_t *t = &parse.format; | 331 | cistpl_format_t *t = &parse.format; |
| 349 | (void)t; /* Shut up, gcc */ | 332 | (void)t; /* Shut up, gcc */ |
| 350 | DEBUG(2, "Format type: %u, Error Detection: %u, offset = %u, length =%u", | 333 | pr_debug("Format type: %u, Error Detection: %u, offset = %u, length =%u\n", |
| 351 | t->type, t->edc, t->offset, t->length); | 334 | t->type, t->edc, t->offset, t->length); |
| 352 | } | 335 | } |
| 353 | return -ENOSPC; | 336 | return -ENOSPC; |
| @@ -363,12 +346,11 @@ static int pcmciamtd_cistpl_jedec(struct pcmcia_device *p_dev, | |||
| 363 | if (!pcmcia_parse_tuple(tuple, &parse)) { | 346 | if (!pcmcia_parse_tuple(tuple, &parse)) { |
| 364 | cistpl_jedec_t *t = &parse.jedec; | 347 | cistpl_jedec_t *t = &parse.jedec; |
| 365 | for (i = 0; i < t->nid; i++) | 348 | for (i = 0; i < t->nid; i++) |
| 366 | DEBUG(2, "JEDEC: 0x%02x 0x%02x", | 349 | pr_debug("JEDEC: 0x%02x 0x%02x\n", |
| 367 | t->id[i].mfr, t->id[i].info); | 350 | t->id[i].mfr, t->id[i].info); |
| 368 | } | 351 | } |
| 369 | return -ENOSPC; | 352 | return -ENOSPC; |
| 370 | } | 353 | } |
| 371 | #endif | ||
| 372 | 354 | ||
| 373 | static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev, | 355 | static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev, |
| 374 | tuple_t *tuple, | 356 | tuple_t *tuple, |
| @@ -382,14 +364,14 @@ static int pcmciamtd_cistpl_device(struct pcmcia_device *p_dev, | |||
| 382 | if (pcmcia_parse_tuple(tuple, &parse)) | 364 | if (pcmcia_parse_tuple(tuple, &parse)) |
| 383 | return -EINVAL; | 365 | return -EINVAL; |
| 384 | 366 | ||
| 385 | DEBUG(2, "Common memory:"); | 367 | pr_debug("Common memory:\n"); |
| 386 | dev->pcmcia_map.size = t->dev[0].size; | 368 | dev->pcmcia_map.size = t->dev[0].size; |
| 387 | /* from here on: DEBUG only */ | 369 | /* from here on: DEBUG only */ |
| 388 | for (i = 0; i < t->ndev; i++) { | 370 | for (i = 0; i < t->ndev; i++) { |
| 389 | DEBUG(2, "Region %d, type = %u", i, t->dev[i].type); | 371 | pr_debug("Region %d, type = %u\n", i, t->dev[i].type); |
| 390 | DEBUG(2, "Region %d, wp = %u", i, t->dev[i].wp); | 372 | pr_debug("Region %d, wp = %u\n", i, t->dev[i].wp); |
| 391 | DEBUG(2, "Region %d, speed = %u ns", i, t->dev[i].speed); | 373 | pr_debug("Region %d, speed = %u ns\n", i, t->dev[i].speed); |
| 392 | DEBUG(2, "Region %d, size = %u bytes", i, t->dev[i].size); | 374 | pr_debug("Region %d, size = %u bytes\n", i, t->dev[i].size); |
| 393 | } | 375 | } |
| 394 | return 0; | 376 | return 0; |
| 395 | } | 377 | } |
| @@ -409,12 +391,12 @@ static int pcmciamtd_cistpl_geo(struct pcmcia_device *p_dev, | |||
| 409 | dev->pcmcia_map.bankwidth = t->geo[0].buswidth; | 391 | dev->pcmcia_map.bankwidth = t->geo[0].buswidth; |
| 410 | /* from here on: DEBUG only */ | 392 | /* from here on: DEBUG only */ |
| 411 | for (i = 0; i < t->ngeo; i++) { | 393 | for (i = 0; i < t->ngeo; i++) { |
| 412 | DEBUG(2, "region: %d bankwidth = %u", i, t->geo[i].buswidth); | 394 | pr_debug("region: %d bankwidth = %u\n", i, t->geo[i].buswidth); |
| 413 | DEBUG(2, "region: %d erase_block = %u", i, t->geo[i].erase_block); | 395 | pr_debug("region: %d erase_block = %u\n", i, t->geo[i].erase_block); |
| 414 | DEBUG(2, "region: %d read_block = %u", i, t->geo[i].read_block); | 396 | pr_debug("region: %d read_block = %u\n", i, t->geo[i].read_block); |
| 415 | DEBUG(2, "region: %d write_block = %u", i, t->geo[i].write_block); | 397 | pr_debug("region: %d write_block = %u\n", i, t->geo[i].write_block); |
| 416 | DEBUG(2, "region: %d partition = %u", i, t->geo[i].partition); | 398 | pr_debug("region: %d partition = %u\n", i, t->geo[i].partition); |
| 417 | DEBUG(2, "region: %d interleave = %u", i, t->geo[i].interleave); | 399 | pr_debug("region: %d interleave = %u\n", i, t->geo[i].interleave); |
| 418 | } | 400 | } |
| 419 | return 0; | 401 | return 0; |
| 420 | } | 402 | } |
| @@ -432,13 +414,11 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev | |||
| 432 | if (p_dev->prod_id[i]) | 414 | if (p_dev->prod_id[i]) |
| 433 | strcat(dev->mtd_name, p_dev->prod_id[i]); | 415 | strcat(dev->mtd_name, p_dev->prod_id[i]); |
| 434 | } | 416 | } |
| 435 | DEBUG(2, "Found name: %s", dev->mtd_name); | 417 | pr_debug("Found name: %s\n", dev->mtd_name); |
| 436 | } | 418 | } |
| 437 | 419 | ||
| 438 | #ifdef CONFIG_MTD_DEBUG | ||
| 439 | pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL); | 420 | pcmcia_loop_tuple(p_dev, CISTPL_FORMAT, pcmciamtd_cistpl_format, NULL); |
| 440 | pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL); | 421 | pcmcia_loop_tuple(p_dev, CISTPL_JEDEC_C, pcmciamtd_cistpl_jedec, NULL); |
| 441 | #endif | ||
| 442 | pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev); | 422 | pcmcia_loop_tuple(p_dev, CISTPL_DEVICE, pcmciamtd_cistpl_device, dev); |
| 443 | pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev); | 423 | pcmcia_loop_tuple(p_dev, CISTPL_DEVICE_GEO, pcmciamtd_cistpl_geo, dev); |
| 444 | 424 | ||
| @@ -450,12 +430,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev | |||
| 450 | 430 | ||
| 451 | if(force_size) { | 431 | if(force_size) { |
| 452 | dev->pcmcia_map.size = force_size << 20; | 432 | dev->pcmcia_map.size = force_size << 20; |
| 453 | DEBUG(2, "size forced to %dM", force_size); | 433 | pr_debug("size forced to %dM\n", force_size); |
| 454 | } | 434 | } |
| 455 | 435 | ||
| 456 | if(bankwidth) { | 436 | if(bankwidth) { |
| 457 | dev->pcmcia_map.bankwidth = bankwidth; | 437 | dev->pcmcia_map.bankwidth = bankwidth; |
| 458 | DEBUG(2, "bankwidth forced to %d", bankwidth); | 438 | pr_debug("bankwidth forced to %d\n", bankwidth); |
| 459 | } | 439 | } |
| 460 | 440 | ||
| 461 | dev->pcmcia_map.name = dev->mtd_name; | 441 | dev->pcmcia_map.name = dev->mtd_name; |
| @@ -464,7 +444,7 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *p_dev | |||
| 464 | *new_name = 1; | 444 | *new_name = 1; |
| 465 | } | 445 | } |
| 466 | 446 | ||
| 467 | DEBUG(1, "Device: Size: %lu Width:%d Name: %s", | 447 | pr_debug("Device: Size: %lu Width:%d Name: %s\n", |
| 468 | dev->pcmcia_map.size, | 448 | dev->pcmcia_map.size, |
| 469 | dev->pcmcia_map.bankwidth << 3, dev->mtd_name); | 449 | dev->pcmcia_map.bankwidth << 3, dev->mtd_name); |
| 470 | } | 450 | } |
| @@ -479,7 +459,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 479 | static char *probes[] = { "jedec_probe", "cfi_probe" }; | 459 | static char *probes[] = { "jedec_probe", "cfi_probe" }; |
| 480 | int new_name = 0; | 460 | int new_name = 0; |
| 481 | 461 | ||
| 482 | DEBUG(3, "link=0x%p", link); | 462 | pr_debug("link=0x%p\n", link); |
| 483 | 463 | ||
| 484 | card_settings(dev, link, &new_name); | 464 | card_settings(dev, link, &new_name); |
| 485 | 465 | ||
| @@ -512,11 +492,11 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 512 | 492 | ||
| 513 | do { | 493 | do { |
| 514 | int ret; | 494 | int ret; |
| 515 | DEBUG(2, "requesting window with size = %luKiB memspeed = %d", | 495 | pr_debug("requesting window with size = %luKiB memspeed = %d\n", |
| 516 | (unsigned long) resource_size(link->resource[2]) >> 10, | 496 | (unsigned long) resource_size(link->resource[2]) >> 10, |
| 517 | mem_speed); | 497 | mem_speed); |
| 518 | ret = pcmcia_request_window(link, link->resource[2], mem_speed); | 498 | ret = pcmcia_request_window(link, link->resource[2], mem_speed); |
| 519 | DEBUG(2, "ret = %d dev->win_size = %d", ret, dev->win_size); | 499 | pr_debug("ret = %d dev->win_size = %d\n", ret, dev->win_size); |
| 520 | if(ret) { | 500 | if(ret) { |
| 521 | j++; | 501 | j++; |
| 522 | link->resource[2]->start = 0; | 502 | link->resource[2]->start = 0; |
| @@ -524,21 +504,21 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 524 | force_size << 20 : MAX_PCMCIA_ADDR; | 504 | force_size << 20 : MAX_PCMCIA_ADDR; |
| 525 | link->resource[2]->end >>= j; | 505 | link->resource[2]->end >>= j; |
| 526 | } else { | 506 | } else { |
| 527 | DEBUG(2, "Got window of size %luKiB", (unsigned long) | 507 | pr_debug("Got window of size %luKiB\n", (unsigned long) |
| 528 | resource_size(link->resource[2]) >> 10); | 508 | resource_size(link->resource[2]) >> 10); |
| 529 | dev->win_size = resource_size(link->resource[2]); | 509 | dev->win_size = resource_size(link->resource[2]); |
| 530 | break; | 510 | break; |
| 531 | } | 511 | } |
| 532 | } while (link->resource[2]->end >= 0x1000); | 512 | } while (link->resource[2]->end >= 0x1000); |
| 533 | 513 | ||
| 534 | DEBUG(2, "dev->win_size = %d", dev->win_size); | 514 | pr_debug("dev->win_size = %d\n", dev->win_size); |
| 535 | 515 | ||
| 536 | if(!dev->win_size) { | 516 | if(!dev->win_size) { |
| 537 | dev_err(&dev->p_dev->dev, "Cannot allocate memory window\n"); | 517 | dev_err(&dev->p_dev->dev, "Cannot allocate memory window\n"); |
| 538 | pcmciamtd_release(link); | 518 | pcmciamtd_release(link); |
| 539 | return -ENODEV; | 519 | return -ENODEV; |
| 540 | } | 520 | } |
| 541 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 521 | pr_debug("Allocated a window of %dKiB\n", dev->win_size >> 10); |
| 542 | 522 | ||
| 543 | /* Get write protect status */ | 523 | /* Get write protect status */ |
| 544 | dev->win_base = ioremap(link->resource[2]->start, | 524 | dev->win_base = ioremap(link->resource[2]->start, |
| @@ -549,7 +529,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 549 | pcmciamtd_release(link); | 529 | pcmciamtd_release(link); |
| 550 | return -ENODEV; | 530 | return -ENODEV; |
| 551 | } | 531 | } |
| 552 | DEBUG(1, "mapped window dev = %p @ %pR, base = %p", | 532 | pr_debug("mapped window dev = %p @ %pR, base = %p\n", |
| 553 | dev, link->resource[2], dev->win_base); | 533 | dev, link->resource[2], dev->win_base); |
| 554 | 534 | ||
| 555 | dev->offset = 0; | 535 | dev->offset = 0; |
| @@ -564,7 +544,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 564 | } | 544 | } |
| 565 | 545 | ||
| 566 | link->config_index = 0; | 546 | link->config_index = 0; |
| 567 | DEBUG(2, "Setting Configuration"); | 547 | pr_debug("Setting Configuration\n"); |
| 568 | ret = pcmcia_enable_device(link); | 548 | ret = pcmcia_enable_device(link); |
| 569 | if (ret != 0) { | 549 | if (ret != 0) { |
| 570 | if (dev->win_base) { | 550 | if (dev->win_base) { |
| @@ -580,17 +560,17 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 580 | mtd = do_map_probe("map_rom", &dev->pcmcia_map); | 560 | mtd = do_map_probe("map_rom", &dev->pcmcia_map); |
| 581 | } else { | 561 | } else { |
| 582 | for(i = 0; i < ARRAY_SIZE(probes); i++) { | 562 | for(i = 0; i < ARRAY_SIZE(probes); i++) { |
| 583 | DEBUG(1, "Trying %s", probes[i]); | 563 | pr_debug("Trying %s\n", probes[i]); |
| 584 | mtd = do_map_probe(probes[i], &dev->pcmcia_map); | 564 | mtd = do_map_probe(probes[i], &dev->pcmcia_map); |
| 585 | if(mtd) | 565 | if(mtd) |
| 586 | break; | 566 | break; |
| 587 | 567 | ||
| 588 | DEBUG(1, "FAILED: %s", probes[i]); | 568 | pr_debug("FAILED: %s\n", probes[i]); |
| 589 | } | 569 | } |
| 590 | } | 570 | } |
| 591 | 571 | ||
| 592 | if(!mtd) { | 572 | if(!mtd) { |
| 593 | DEBUG(1, "Can not find an MTD"); | 573 | pr_debug("Can not find an MTD\n"); |
| 594 | pcmciamtd_release(link); | 574 | pcmciamtd_release(link); |
| 595 | return -ENODEV; | 575 | return -ENODEV; |
| 596 | } | 576 | } |
| @@ -617,7 +597,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 617 | /* If the memory found is fits completely into the mapped PCMCIA window, | 597 | /* If the memory found is fits completely into the mapped PCMCIA window, |
| 618 | use the faster non-remapping read/write functions */ | 598 | use the faster non-remapping read/write functions */ |
| 619 | if(mtd->size <= dev->win_size) { | 599 | if(mtd->size <= dev->win_size) { |
| 620 | DEBUG(1, "Using non remapping memory functions"); | 600 | pr_debug("Using non remapping memory functions\n"); |
| 621 | dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; | 601 | dev->pcmcia_map.map_priv_2 = (unsigned long)dev->win_base; |
| 622 | if (dev->pcmcia_map.bankwidth == 1) { | 602 | if (dev->pcmcia_map.bankwidth == 1) { |
| 623 | dev->pcmcia_map.read = pcmcia_read8; | 603 | dev->pcmcia_map.read = pcmcia_read8; |
| @@ -645,7 +625,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
| 645 | 625 | ||
| 646 | static int pcmciamtd_suspend(struct pcmcia_device *dev) | 626 | static int pcmciamtd_suspend(struct pcmcia_device *dev) |
| 647 | { | 627 | { |
| 648 | DEBUG(2, "EVENT_PM_RESUME"); | 628 | pr_debug("EVENT_PM_RESUME\n"); |
| 649 | 629 | ||
| 650 | /* get_lock(link); */ | 630 | /* get_lock(link); */ |
| 651 | 631 | ||
| @@ -654,7 +634,7 @@ static int pcmciamtd_suspend(struct pcmcia_device *dev) | |||
| 654 | 634 | ||
| 655 | static int pcmciamtd_resume(struct pcmcia_device *dev) | 635 | static int pcmciamtd_resume(struct pcmcia_device *dev) |
| 656 | { | 636 | { |
| 657 | DEBUG(2, "EVENT_PM_SUSPEND"); | 637 | pr_debug("EVENT_PM_SUSPEND\n"); |
| 658 | 638 | ||
| 659 | /* free_lock(link); */ | 639 | /* free_lock(link); */ |
| 660 | 640 | ||
| @@ -666,7 +646,7 @@ static void pcmciamtd_detach(struct pcmcia_device *link) | |||
| 666 | { | 646 | { |
| 667 | struct pcmciamtd_dev *dev = link->priv; | 647 | struct pcmciamtd_dev *dev = link->priv; |
| 668 | 648 | ||
| 669 | DEBUG(3, "link=0x%p", link); | 649 | pr_debug("link=0x%p\n", link); |
| 670 | 650 | ||
| 671 | if(dev->mtd_info) { | 651 | if(dev->mtd_info) { |
| 672 | mtd_device_unregister(dev->mtd_info); | 652 | mtd_device_unregister(dev->mtd_info); |
| @@ -686,7 +666,7 @@ static int pcmciamtd_probe(struct pcmcia_device *link) | |||
| 686 | /* Create new memory card device */ | 666 | /* Create new memory card device */ |
| 687 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); | 667 | dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 688 | if (!dev) return -ENOMEM; | 668 | if (!dev) return -ENOMEM; |
| 689 | DEBUG(1, "dev=0x%p", dev); | 669 | pr_debug("dev=0x%p\n", dev); |
| 690 | 670 | ||
| 691 | dev->p_dev = link; | 671 | dev->p_dev = link; |
| 692 | link->priv = dev; | 672 | link->priv = dev; |
| @@ -755,7 +735,7 @@ static int __init init_pcmciamtd(void) | |||
| 755 | 735 | ||
| 756 | static void __exit exit_pcmciamtd(void) | 736 | static void __exit exit_pcmciamtd(void) |
| 757 | { | 737 | { |
| 758 | DEBUG(1, DRIVER_DESC " unloading"); | 738 | pr_debug(DRIVER_DESC " unloading"); |
| 759 | pcmcia_unregister_driver(&pcmciamtd_driver); | 739 | pcmcia_unregister_driver(&pcmciamtd_driver); |
| 760 | } | 740 | } |
| 761 | 741 | ||
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index f64cee4a3bfb..66e8200079c2 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
| @@ -27,8 +27,6 @@ struct physmap_flash_info { | |||
| 27 | struct mtd_info *mtd[MAX_RESOURCES]; | 27 | struct mtd_info *mtd[MAX_RESOURCES]; |
| 28 | struct mtd_info *cmtd; | 28 | struct mtd_info *cmtd; |
| 29 | struct map_info map[MAX_RESOURCES]; | 29 | struct map_info map[MAX_RESOURCES]; |
| 30 | int nr_parts; | ||
| 31 | struct mtd_partition *parts; | ||
| 32 | }; | 30 | }; |
| 33 | 31 | ||
| 34 | static int physmap_flash_remove(struct platform_device *dev) | 32 | static int physmap_flash_remove(struct platform_device *dev) |
| @@ -46,8 +44,6 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
| 46 | 44 | ||
| 47 | if (info->cmtd) { | 45 | if (info->cmtd) { |
| 48 | mtd_device_unregister(info->cmtd); | 46 | mtd_device_unregister(info->cmtd); |
| 49 | if (info->nr_parts) | ||
| 50 | kfree(info->parts); | ||
| 51 | if (info->cmtd != info->mtd[0]) | 47 | if (info->cmtd != info->mtd[0]) |
| 52 | mtd_concat_destroy(info->cmtd); | 48 | mtd_concat_destroy(info->cmtd); |
| 53 | } | 49 | } |
| @@ -175,23 +171,8 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
| 175 | if (err) | 171 | if (err) |
| 176 | goto err_out; | 172 | goto err_out; |
| 177 | 173 | ||
| 178 | err = parse_mtd_partitions(info->cmtd, part_probe_types, | 174 | mtd_device_parse_register(info->cmtd, part_probe_types, 0, |
| 179 | &info->parts, 0); | 175 | physmap_data->parts, physmap_data->nr_parts); |
| 180 | if (err > 0) { | ||
| 181 | mtd_device_register(info->cmtd, info->parts, err); | ||
| 182 | info->nr_parts = err; | ||
| 183 | return 0; | ||
| 184 | } | ||
| 185 | |||
| 186 | if (physmap_data->nr_parts) { | ||
| 187 | printk(KERN_NOTICE "Using physmap partition information\n"); | ||
| 188 | mtd_device_register(info->cmtd, physmap_data->parts, | ||
| 189 | physmap_data->nr_parts); | ||
| 190 | return 0; | ||
| 191 | } | ||
| 192 | |||
| 193 | mtd_device_register(info->cmtd, NULL, 0); | ||
| 194 | |||
| 195 | return 0; | 176 | return 0; |
| 196 | 177 | ||
| 197 | err_out: | 178 | err_out: |
| @@ -245,21 +226,6 @@ static struct platform_device physmap_flash = { | |||
| 245 | .num_resources = 1, | 226 | .num_resources = 1, |
| 246 | .resource = &physmap_flash_resource, | 227 | .resource = &physmap_flash_resource, |
| 247 | }; | 228 | }; |
| 248 | |||
| 249 | void physmap_configure(unsigned long addr, unsigned long size, | ||
| 250 | int bankwidth, void (*set_vpp)(struct map_info *, int)) | ||
| 251 | { | ||
| 252 | physmap_flash_resource.start = addr; | ||
| 253 | physmap_flash_resource.end = addr + size - 1; | ||
| 254 | physmap_flash_data.width = bankwidth; | ||
| 255 | physmap_flash_data.set_vpp = set_vpp; | ||
| 256 | } | ||
| 257 | |||
| 258 | void physmap_set_partitions(struct mtd_partition *parts, int num_parts) | ||
| 259 | { | ||
| 260 | physmap_flash_data.nr_parts = num_parts; | ||
| 261 | physmap_flash_data.parts = parts; | ||
| 262 | } | ||
| 263 | #endif | 229 | #endif |
| 264 | 230 | ||
| 265 | static int __init physmap_init(void) | 231 | static int __init physmap_init(void) |
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index d251d1db129b..7d65f9d3e690 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
| @@ -34,58 +34,10 @@ struct of_flash_list { | |||
| 34 | 34 | ||
| 35 | struct of_flash { | 35 | struct of_flash { |
| 36 | struct mtd_info *cmtd; | 36 | struct mtd_info *cmtd; |
| 37 | struct mtd_partition *parts; | ||
| 38 | int list_size; /* number of elements in of_flash_list */ | 37 | int list_size; /* number of elements in of_flash_list */ |
| 39 | struct of_flash_list list[0]; | 38 | struct of_flash_list list[0]; |
| 40 | }; | 39 | }; |
| 41 | 40 | ||
| 42 | #define OF_FLASH_PARTS(info) ((info)->parts) | ||
| 43 | static int parse_obsolete_partitions(struct platform_device *dev, | ||
| 44 | struct of_flash *info, | ||
| 45 | struct device_node *dp) | ||
| 46 | { | ||
| 47 | int i, plen, nr_parts; | ||
| 48 | const struct { | ||
| 49 | __be32 offset, len; | ||
| 50 | } *part; | ||
| 51 | const char *names; | ||
| 52 | |||
| 53 | part = of_get_property(dp, "partitions", &plen); | ||
| 54 | if (!part) | ||
| 55 | return 0; /* No partitions found */ | ||
| 56 | |||
| 57 | dev_warn(&dev->dev, "Device tree uses obsolete partition map binding\n"); | ||
| 58 | |||
| 59 | nr_parts = plen / sizeof(part[0]); | ||
| 60 | |||
| 61 | info->parts = kzalloc(nr_parts * sizeof(*info->parts), GFP_KERNEL); | ||
| 62 | if (!info->parts) | ||
| 63 | return -ENOMEM; | ||
| 64 | |||
| 65 | names = of_get_property(dp, "partition-names", &plen); | ||
| 66 | |||
| 67 | for (i = 0; i < nr_parts; i++) { | ||
| 68 | info->parts[i].offset = be32_to_cpu(part->offset); | ||
| 69 | info->parts[i].size = be32_to_cpu(part->len) & ~1; | ||
| 70 | if (be32_to_cpu(part->len) & 1) /* bit 0 set signifies read only partition */ | ||
| 71 | info->parts[i].mask_flags = MTD_WRITEABLE; | ||
| 72 | |||
| 73 | if (names && (plen > 0)) { | ||
| 74 | int len = strlen(names) + 1; | ||
| 75 | |||
| 76 | info->parts[i].name = (char *)names; | ||
| 77 | plen -= len; | ||
| 78 | names += len; | ||
| 79 | } else { | ||
| 80 | info->parts[i].name = "unnamed"; | ||
| 81 | } | ||
| 82 | |||
| 83 | part++; | ||
| 84 | } | ||
| 85 | |||
| 86 | return nr_parts; | ||
| 87 | } | ||
| 88 | |||
| 89 | static int of_flash_remove(struct platform_device *dev) | 41 | static int of_flash_remove(struct platform_device *dev) |
| 90 | { | 42 | { |
| 91 | struct of_flash *info; | 43 | struct of_flash *info; |
| @@ -101,11 +53,8 @@ static int of_flash_remove(struct platform_device *dev) | |||
| 101 | mtd_concat_destroy(info->cmtd); | 53 | mtd_concat_destroy(info->cmtd); |
| 102 | } | 54 | } |
| 103 | 55 | ||
| 104 | if (info->cmtd) { | 56 | if (info->cmtd) |
| 105 | if (OF_FLASH_PARTS(info)) | ||
| 106 | kfree(OF_FLASH_PARTS(info)); | ||
| 107 | mtd_device_unregister(info->cmtd); | 57 | mtd_device_unregister(info->cmtd); |
| 108 | } | ||
| 109 | 58 | ||
| 110 | for (i = 0; i < info->list_size; i++) { | 59 | for (i = 0; i < info->list_size; i++) { |
| 111 | if (info->list[i].mtd) | 60 | if (info->list[i].mtd) |
| @@ -165,7 +114,8 @@ static struct mtd_info * __devinit obsolete_probe(struct platform_device *dev, | |||
| 165 | specifies the list of partition probers to use. If none is given then the | 114 | specifies the list of partition probers to use. If none is given then the |
| 166 | default is use. These take precedence over other device tree | 115 | default is use. These take precedence over other device tree |
| 167 | information. */ | 116 | information. */ |
| 168 | static const char *part_probe_types_def[] = { "cmdlinepart", "RedBoot", NULL }; | 117 | static const char *part_probe_types_def[] = { "cmdlinepart", "RedBoot", |
| 118 | "ofpart", "ofoldpart", NULL }; | ||
| 169 | static const char ** __devinit of_get_probes(struct device_node *dp) | 119 | static const char ** __devinit of_get_probes(struct device_node *dp) |
| 170 | { | 120 | { |
| 171 | const char *cp; | 121 | const char *cp; |
| @@ -218,6 +168,7 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
| 218 | int reg_tuple_size; | 168 | int reg_tuple_size; |
| 219 | struct mtd_info **mtd_list = NULL; | 169 | struct mtd_info **mtd_list = NULL; |
| 220 | resource_size_t res_size; | 170 | resource_size_t res_size; |
| 171 | struct mtd_part_parser_data ppdata; | ||
| 221 | 172 | ||
| 222 | match = of_match_device(of_flash_match, &dev->dev); | 173 | match = of_match_device(of_flash_match, &dev->dev); |
| 223 | if (!match) | 174 | if (!match) |
| @@ -331,29 +282,12 @@ static int __devinit of_flash_probe(struct platform_device *dev) | |||
| 331 | if (err) | 282 | if (err) |
| 332 | goto err_out; | 283 | goto err_out; |
| 333 | 284 | ||
| 285 | ppdata.of_node = dp; | ||
| 334 | part_probe_types = of_get_probes(dp); | 286 | part_probe_types = of_get_probes(dp); |
| 335 | err = parse_mtd_partitions(info->cmtd, part_probe_types, | 287 | mtd_device_parse_register(info->cmtd, part_probe_types, &ppdata, |
| 336 | &info->parts, 0); | 288 | NULL, 0); |
| 337 | if (err < 0) { | ||
| 338 | of_free_probes(part_probe_types); | ||
| 339 | goto err_out; | ||
| 340 | } | ||
| 341 | of_free_probes(part_probe_types); | 289 | of_free_probes(part_probe_types); |
| 342 | 290 | ||
| 343 | if (err == 0) { | ||
| 344 | err = of_mtd_parse_partitions(&dev->dev, dp, &info->parts); | ||
| 345 | if (err < 0) | ||
| 346 | goto err_out; | ||
| 347 | } | ||
| 348 | |||
| 349 | if (err == 0) { | ||
| 350 | err = parse_obsolete_partitions(dev, info, dp); | ||
| 351 | if (err < 0) | ||
| 352 | goto err_out; | ||
| 353 | } | ||
| 354 | |||
| 355 | mtd_device_register(info->cmtd, info->parts, err); | ||
| 356 | |||
| 357 | kfree(mtd_list); | 291 | kfree(mtd_list); |
| 358 | 292 | ||
| 359 | return 0; | 293 | return 0; |
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c index 9ca1eccba4bc..94f553489725 100644 --- a/drivers/mtd/maps/plat-ram.c +++ b/drivers/mtd/maps/plat-ram.c | |||
| @@ -44,8 +44,6 @@ struct platram_info { | |||
| 44 | struct device *dev; | 44 | struct device *dev; |
| 45 | struct mtd_info *mtd; | 45 | struct mtd_info *mtd; |
| 46 | struct map_info map; | 46 | struct map_info map; |
| 47 | struct mtd_partition *partitions; | ||
| 48 | bool free_partitions; | ||
| 49 | struct resource *area; | 47 | struct resource *area; |
| 50 | struct platdata_mtd_ram *pdata; | 48 | struct platdata_mtd_ram *pdata; |
| 51 | }; | 49 | }; |
| @@ -95,10 +93,6 @@ static int platram_remove(struct platform_device *pdev) | |||
| 95 | 93 | ||
| 96 | if (info->mtd) { | 94 | if (info->mtd) { |
| 97 | mtd_device_unregister(info->mtd); | 95 | mtd_device_unregister(info->mtd); |
| 98 | if (info->partitions) { | ||
| 99 | if (info->free_partitions) | ||
| 100 | kfree(info->partitions); | ||
| 101 | } | ||
| 102 | map_destroy(info->mtd); | 96 | map_destroy(info->mtd); |
| 103 | } | 97 | } |
| 104 | 98 | ||
| @@ -228,21 +222,8 @@ static int platram_probe(struct platform_device *pdev) | |||
| 228 | /* check to see if there are any available partitions, or wether | 222 | /* check to see if there are any available partitions, or wether |
| 229 | * to add this device whole */ | 223 | * to add this device whole */ |
| 230 | 224 | ||
| 231 | if (!pdata->nr_partitions) { | 225 | err = mtd_device_parse_register(info->mtd, pdata->probes, 0, |
| 232 | /* try to probe using the supplied probe type */ | 226 | pdata->partitions, pdata->nr_partitions); |
| 233 | if (pdata->probes) { | ||
| 234 | err = parse_mtd_partitions(info->mtd, pdata->probes, | ||
| 235 | &info->partitions, 0); | ||
| 236 | info->free_partitions = 1; | ||
| 237 | if (err > 0) | ||
| 238 | err = mtd_device_register(info->mtd, | ||
| 239 | info->partitions, err); | ||
| 240 | } | ||
| 241 | } | ||
| 242 | /* use the static mapping */ | ||
| 243 | else | ||
| 244 | err = mtd_device_register(info->mtd, pdata->partitions, | ||
| 245 | pdata->nr_partitions); | ||
| 246 | if (!err) | 227 | if (!err) |
| 247 | dev_info(&pdev->dev, "registered mtd device\n"); | 228 | dev_info(&pdev->dev, "registered mtd device\n"); |
| 248 | 229 | ||
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 7ae137d4b998..411a17df9fc1 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c | |||
| @@ -41,8 +41,6 @@ static void pxa2xx_map_inval_cache(struct map_info *map, unsigned long from, | |||
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | struct pxa2xx_flash_info { | 43 | struct pxa2xx_flash_info { |
| 44 | struct mtd_partition *parts; | ||
| 45 | int nr_parts; | ||
| 46 | struct mtd_info *mtd; | 44 | struct mtd_info *mtd; |
| 47 | struct map_info map; | 45 | struct map_info map; |
| 48 | }; | 46 | }; |
| @@ -55,9 +53,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
| 55 | { | 53 | { |
| 56 | struct flash_platform_data *flash = pdev->dev.platform_data; | 54 | struct flash_platform_data *flash = pdev->dev.platform_data; |
| 57 | struct pxa2xx_flash_info *info; | 55 | struct pxa2xx_flash_info *info; |
| 58 | struct mtd_partition *parts; | ||
| 59 | struct resource *res; | 56 | struct resource *res; |
| 60 | int ret = 0; | ||
| 61 | 57 | ||
| 62 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 58 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
| 63 | if (!res) | 59 | if (!res) |
| @@ -71,8 +67,6 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
| 71 | info->map.bankwidth = flash->width; | 67 | info->map.bankwidth = flash->width; |
| 72 | info->map.phys = res->start; | 68 | info->map.phys = res->start; |
| 73 | info->map.size = resource_size(res); | 69 | info->map.size = resource_size(res); |
| 74 | info->parts = flash->parts; | ||
| 75 | info->nr_parts = flash->nr_parts; | ||
| 76 | 70 | ||
| 77 | info->map.virt = ioremap(info->map.phys, info->map.size); | 71 | info->map.virt = ioremap(info->map.phys, info->map.size); |
| 78 | if (!info->map.virt) { | 72 | if (!info->map.virt) { |
| @@ -104,18 +98,7 @@ static int __devinit pxa2xx_flash_probe(struct platform_device *pdev) | |||
| 104 | } | 98 | } |
| 105 | info->mtd->owner = THIS_MODULE; | 99 | info->mtd->owner = THIS_MODULE; |
| 106 | 100 | ||
| 107 | ret = parse_mtd_partitions(info->mtd, probes, &parts, 0); | 101 | mtd_device_parse_register(info->mtd, probes, 0, NULL, 0); |
| 108 | |||
| 109 | if (ret > 0) { | ||
| 110 | info->nr_parts = ret; | ||
| 111 | info->parts = parts; | ||
| 112 | } | ||
| 113 | |||
| 114 | if (!info->nr_parts) | ||
| 115 | printk("Registering %s as whole device\n", | ||
| 116 | info->map.name); | ||
| 117 | |||
| 118 | mtd_device_register(info->mtd, info->parts, info->nr_parts); | ||
| 119 | 102 | ||
| 120 | platform_set_drvdata(pdev, info); | 103 | platform_set_drvdata(pdev, info); |
| 121 | return 0; | 104 | return 0; |
| @@ -133,7 +116,6 @@ static int __devexit pxa2xx_flash_remove(struct platform_device *dev) | |||
| 133 | iounmap(info->map.virt); | 116 | iounmap(info->map.virt); |
| 134 | if (info->map.cached) | 117 | if (info->map.cached) |
| 135 | iounmap(info->map.cached); | 118 | iounmap(info->map.cached); |
| 136 | kfree(info->parts); | ||
| 137 | kfree(info); | 119 | kfree(info); |
| 138 | return 0; | 120 | return 0; |
| 139 | } | 121 | } |
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c index 761fb459d2c7..0237f197fd12 100644 --- a/drivers/mtd/maps/rbtx4939-flash.c +++ b/drivers/mtd/maps/rbtx4939-flash.c | |||
| @@ -25,8 +25,6 @@ | |||
| 25 | struct rbtx4939_flash_info { | 25 | struct rbtx4939_flash_info { |
| 26 | struct mtd_info *mtd; | 26 | struct mtd_info *mtd; |
| 27 | struct map_info map; | 27 | struct map_info map; |
| 28 | int nr_parts; | ||
| 29 | struct mtd_partition *parts; | ||
| 30 | }; | 28 | }; |
| 31 | 29 | ||
| 32 | static int rbtx4939_flash_remove(struct platform_device *dev) | 30 | static int rbtx4939_flash_remove(struct platform_device *dev) |
| @@ -41,8 +39,6 @@ static int rbtx4939_flash_remove(struct platform_device *dev) | |||
| 41 | if (info->mtd) { | 39 | if (info->mtd) { |
| 42 | struct rbtx4939_flash_data *pdata = dev->dev.platform_data; | 40 | struct rbtx4939_flash_data *pdata = dev->dev.platform_data; |
| 43 | 41 | ||
| 44 | if (info->nr_parts) | ||
| 45 | kfree(info->parts); | ||
| 46 | mtd_device_unregister(info->mtd); | 42 | mtd_device_unregister(info->mtd); |
| 47 | map_destroy(info->mtd); | 43 | map_destroy(info->mtd); |
| 48 | } | 44 | } |
| @@ -50,7 +46,6 @@ static int rbtx4939_flash_remove(struct platform_device *dev) | |||
| 50 | } | 46 | } |
| 51 | 47 | ||
| 52 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; | 48 | static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL }; |
| 53 | static const char *part_probe_types[] = { "cmdlinepart", NULL }; | ||
| 54 | 49 | ||
| 55 | static int rbtx4939_flash_probe(struct platform_device *dev) | 50 | static int rbtx4939_flash_probe(struct platform_device *dev) |
| 56 | { | 51 | { |
| @@ -107,22 +102,11 @@ static int rbtx4939_flash_probe(struct platform_device *dev) | |||
| 107 | info->mtd->owner = THIS_MODULE; | 102 | info->mtd->owner = THIS_MODULE; |
| 108 | if (err) | 103 | if (err) |
| 109 | goto err_out; | 104 | goto err_out; |
| 105 | err = mtd_device_parse_register(info->mtd, NULL, 0, | ||
| 106 | pdata->parts, pdata->nr_parts); | ||
| 110 | 107 | ||
| 111 | err = parse_mtd_partitions(info->mtd, part_probe_types, | 108 | if (err) |
| 112 | &info->parts, 0); | 109 | goto err_out; |
| 113 | if (err > 0) { | ||
| 114 | mtd_device_register(info->mtd, info->parts, err); | ||
| 115 | info->nr_parts = err; | ||
| 116 | return 0; | ||
| 117 | } | ||
| 118 | |||
| 119 | if (pdata->nr_parts) { | ||
| 120 | pr_notice("Using rbtx4939 partition information\n"); | ||
| 121 | mtd_device_register(info->mtd, pdata->parts, pdata->nr_parts); | ||
| 122 | return 0; | ||
| 123 | } | ||
| 124 | |||
| 125 | mtd_device_register(info->mtd, NULL, 0); | ||
| 126 | return 0; | 110 | return 0; |
| 127 | 111 | ||
| 128 | err_out: | 112 | err_out: |
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index a9b5e0e5c4c5..fa9c0a9670cd 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c | |||
| @@ -131,10 +131,8 @@ struct sa_subdev_info { | |||
| 131 | }; | 131 | }; |
| 132 | 132 | ||
| 133 | struct sa_info { | 133 | struct sa_info { |
| 134 | struct mtd_partition *parts; | ||
| 135 | struct mtd_info *mtd; | 134 | struct mtd_info *mtd; |
| 136 | int num_subdev; | 135 | int num_subdev; |
| 137 | unsigned int nr_parts; | ||
| 138 | struct sa_subdev_info subdev[0]; | 136 | struct sa_subdev_info subdev[0]; |
| 139 | }; | 137 | }; |
| 140 | 138 | ||
| @@ -231,8 +229,6 @@ static void sa1100_destroy(struct sa_info *info, struct flash_platform_data *pla | |||
| 231 | mtd_concat_destroy(info->mtd); | 229 | mtd_concat_destroy(info->mtd); |
| 232 | } | 230 | } |
| 233 | 231 | ||
| 234 | kfree(info->parts); | ||
| 235 | |||
| 236 | for (i = info->num_subdev - 1; i >= 0; i--) | 232 | for (i = info->num_subdev - 1; i >= 0; i--) |
| 237 | sa1100_destroy_subdev(&info->subdev[i]); | 233 | sa1100_destroy_subdev(&info->subdev[i]); |
| 238 | kfree(info); | 234 | kfree(info); |
| @@ -341,10 +337,8 @@ static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; | |||
| 341 | static int __devinit sa1100_mtd_probe(struct platform_device *pdev) | 337 | static int __devinit sa1100_mtd_probe(struct platform_device *pdev) |
| 342 | { | 338 | { |
| 343 | struct flash_platform_data *plat = pdev->dev.platform_data; | 339 | struct flash_platform_data *plat = pdev->dev.platform_data; |
| 344 | struct mtd_partition *parts; | ||
| 345 | const char *part_type = NULL; | ||
| 346 | struct sa_info *info; | 340 | struct sa_info *info; |
| 347 | int err, nr_parts = 0; | 341 | int err; |
| 348 | 342 | ||
| 349 | if (!plat) | 343 | if (!plat) |
| 350 | return -ENODEV; | 344 | return -ENODEV; |
| @@ -358,26 +352,8 @@ static int __devinit sa1100_mtd_probe(struct platform_device *pdev) | |||
| 358 | /* | 352 | /* |
| 359 | * Partition selection stuff. | 353 | * Partition selection stuff. |
| 360 | */ | 354 | */ |
| 361 | nr_parts = parse_mtd_partitions(info->mtd, part_probes, &parts, 0); | 355 | mtd_device_parse_register(info->mtd, part_probes, 0, |
| 362 | if (nr_parts > 0) { | 356 | plat->parts, plat->nr_parts); |
| 363 | info->parts = parts; | ||
| 364 | part_type = "dynamic"; | ||
| 365 | } else { | ||
| 366 | parts = plat->parts; | ||
| 367 | nr_parts = plat->nr_parts; | ||
| 368 | part_type = "static"; | ||
| 369 | } | ||
| 370 | |||
| 371 | if (nr_parts == 0) | ||
| 372 | printk(KERN_NOTICE "SA1100 flash: no partition info " | ||
| 373 | "available, registering whole flash\n"); | ||
| 374 | else | ||
| 375 | printk(KERN_NOTICE "SA1100 flash: using %s partition " | ||
| 376 | "definition\n", part_type); | ||
| 377 | |||
| 378 | mtd_device_register(info->mtd, parts, nr_parts); | ||
| 379 | |||
| 380 | info->nr_parts = nr_parts; | ||
| 381 | 357 | ||
| 382 | platform_set_drvdata(pdev, info); | 358 | platform_set_drvdata(pdev, info); |
| 383 | err = 0; | 359 | err = 0; |
diff --git a/drivers/mtd/maps/solutionengine.c b/drivers/mtd/maps/solutionengine.c index cbf6bade9354..496c40704aff 100644 --- a/drivers/mtd/maps/solutionengine.c +++ b/drivers/mtd/maps/solutionengine.c | |||
| @@ -19,8 +19,6 @@ | |||
| 19 | static struct mtd_info *flash_mtd; | 19 | static struct mtd_info *flash_mtd; |
| 20 | static struct mtd_info *eprom_mtd; | 20 | static struct mtd_info *eprom_mtd; |
| 21 | 21 | ||
| 22 | static struct mtd_partition *parsed_parts; | ||
| 23 | |||
| 24 | struct map_info soleng_eprom_map = { | 22 | struct map_info soleng_eprom_map = { |
| 25 | .name = "Solution Engine EPROM", | 23 | .name = "Solution Engine EPROM", |
| 26 | .size = 0x400000, | 24 | .size = 0x400000, |
| @@ -51,12 +49,14 @@ static struct mtd_partition superh_se_partitions[] = { | |||
| 51 | .size = MTDPART_SIZ_FULL, | 49 | .size = MTDPART_SIZ_FULL, |
| 52 | } | 50 | } |
| 53 | }; | 51 | }; |
| 52 | #define NUM_PARTITIONS ARRAY_SIZE(superh_se_partitions) | ||
| 53 | #else | ||
| 54 | #define superh_se_partitions NULL | ||
| 55 | #define NUM_PARTITIONS 0 | ||
| 54 | #endif /* CONFIG_MTD_SUPERH_RESERVE */ | 56 | #endif /* CONFIG_MTD_SUPERH_RESERVE */ |
| 55 | 57 | ||
| 56 | static int __init init_soleng_maps(void) | 58 | static int __init init_soleng_maps(void) |
| 57 | { | 59 | { |
| 58 | int nr_parts = 0; | ||
| 59 | |||
| 60 | /* First probe at offset 0 */ | 60 | /* First probe at offset 0 */ |
| 61 | soleng_flash_map.phys = 0; | 61 | soleng_flash_map.phys = 0; |
| 62 | soleng_flash_map.virt = (void __iomem *)P2SEGADDR(0); | 62 | soleng_flash_map.virt = (void __iomem *)P2SEGADDR(0); |
| @@ -92,21 +92,8 @@ static int __init init_soleng_maps(void) | |||
| 92 | mtd_device_register(eprom_mtd, NULL, 0); | 92 | mtd_device_register(eprom_mtd, NULL, 0); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | nr_parts = parse_mtd_partitions(flash_mtd, probes, &parsed_parts, 0); | 95 | mtd_device_parse_register(flash_mtd, probes, 0, |
| 96 | 96 | superh_se_partitions, NUM_PARTITIONS); | |
| 97 | #ifdef CONFIG_MTD_SUPERH_RESERVE | ||
| 98 | if (nr_parts <= 0) { | ||
| 99 | printk(KERN_NOTICE "Using configured partition at 0x%08x.\n", | ||
| 100 | CONFIG_MTD_SUPERH_RESERVE); | ||
| 101 | parsed_parts = superh_se_partitions; | ||
| 102 | nr_parts = sizeof(superh_se_partitions)/sizeof(*parsed_parts); | ||
| 103 | } | ||
| 104 | #endif /* CONFIG_MTD_SUPERH_RESERVE */ | ||
| 105 | |||
| 106 | if (nr_parts > 0) | ||
| 107 | mtd_device_register(flash_mtd, parsed_parts, nr_parts); | ||
| 108 | else | ||
| 109 | mtd_device_register(flash_mtd, NULL, 0); | ||
| 110 | 97 | ||
| 111 | return 0; | 98 | return 0; |
| 112 | } | 99 | } |
| @@ -118,10 +105,7 @@ static void __exit cleanup_soleng_maps(void) | |||
| 118 | map_destroy(eprom_mtd); | 105 | map_destroy(eprom_mtd); |
| 119 | } | 106 | } |
| 120 | 107 | ||
| 121 | if (parsed_parts) | 108 | mtd_device_unregister(flash_mtd); |
| 122 | mtd_device_unregister(flash_mtd); | ||
| 123 | else | ||
| 124 | mtd_device_unregister(flash_mtd); | ||
| 125 | map_destroy(flash_mtd); | 109 | map_destroy(flash_mtd); |
| 126 | } | 110 | } |
| 127 | 111 | ||
diff --git a/drivers/mtd/maps/wr_sbc82xx_flash.c b/drivers/mtd/maps/wr_sbc82xx_flash.c index 901ce968efae..aa7e0cb2893c 100644 --- a/drivers/mtd/maps/wr_sbc82xx_flash.c +++ b/drivers/mtd/maps/wr_sbc82xx_flash.c | |||
| @@ -20,7 +20,6 @@ | |||
| 20 | #include <asm/immap_cpm2.h> | 20 | #include <asm/immap_cpm2.h> |
| 21 | 21 | ||
| 22 | static struct mtd_info *sbcmtd[3]; | 22 | static struct mtd_info *sbcmtd[3]; |
| 23 | static struct mtd_partition *sbcmtd_parts[3]; | ||
| 24 | 23 | ||
| 25 | struct map_info sbc82xx_flash_map[3] = { | 24 | struct map_info sbc82xx_flash_map[3] = { |
| 26 | {.name = "Boot flash"}, | 25 | {.name = "Boot flash"}, |
| @@ -101,6 +100,7 @@ static int __init init_sbc82xx_flash(void) | |||
| 101 | for (i=0; i<3; i++) { | 100 | for (i=0; i<3; i++) { |
| 102 | int8_t flashcs[3] = { 0, 6, 1 }; | 101 | int8_t flashcs[3] = { 0, 6, 1 }; |
| 103 | int nr_parts; | 102 | int nr_parts; |
| 103 | struct mtd_partition *defparts; | ||
| 104 | 104 | ||
| 105 | printk(KERN_NOTICE "PowerQUICC II %s (%ld MiB on CS%d", | 105 | printk(KERN_NOTICE "PowerQUICC II %s (%ld MiB on CS%d", |
| 106 | sbc82xx_flash_map[i].name, | 106 | sbc82xx_flash_map[i].name, |
| @@ -113,7 +113,8 @@ static int __init init_sbc82xx_flash(void) | |||
| 113 | } | 113 | } |
| 114 | printk(" at %08lx)\n", sbc82xx_flash_map[i].phys); | 114 | printk(" at %08lx)\n", sbc82xx_flash_map[i].phys); |
| 115 | 115 | ||
| 116 | sbc82xx_flash_map[i].virt = ioremap(sbc82xx_flash_map[i].phys, sbc82xx_flash_map[i].size); | 116 | sbc82xx_flash_map[i].virt = ioremap(sbc82xx_flash_map[i].phys, |
| 117 | sbc82xx_flash_map[i].size); | ||
| 117 | 118 | ||
| 118 | if (!sbc82xx_flash_map[i].virt) { | 119 | if (!sbc82xx_flash_map[i].virt) { |
| 119 | printk("Failed to ioremap\n"); | 120 | printk("Failed to ioremap\n"); |
| @@ -129,24 +130,20 @@ static int __init init_sbc82xx_flash(void) | |||
| 129 | 130 | ||
| 130 | sbcmtd[i]->owner = THIS_MODULE; | 131 | sbcmtd[i]->owner = THIS_MODULE; |
| 131 | 132 | ||
| 132 | nr_parts = parse_mtd_partitions(sbcmtd[i], part_probes, | ||
| 133 | &sbcmtd_parts[i], 0); | ||
| 134 | if (nr_parts > 0) { | ||
| 135 | mtd_device_register(sbcmtd[i], sbcmtd_parts[i], | ||
| 136 | nr_parts); | ||
| 137 | continue; | ||
| 138 | } | ||
| 139 | |||
| 140 | /* No partitioning detected. Use default */ | 133 | /* No partitioning detected. Use default */ |
| 141 | if (i == 2) { | 134 | if (i == 2) { |
| 142 | mtd_device_register(sbcmtd[i], NULL, 0); | 135 | defparts = NULL; |
| 136 | nr_parts = 0; | ||
| 143 | } else if (i == bigflash) { | 137 | } else if (i == bigflash) { |
| 144 | mtd_device_register(sbcmtd[i], bigflash_parts, | 138 | defparts = bigflash_parts; |
| 145 | ARRAY_SIZE(bigflash_parts)); | 139 | nr_parts = ARRAY_SIZE(bigflash_parts); |
| 146 | } else { | 140 | } else { |
| 147 | mtd_device_register(sbcmtd[i], smallflash_parts, | 141 | defparts = smallflash_parts; |
| 148 | ARRAY_SIZE(smallflash_parts)); | 142 | nr_parts = ARRAY_SIZE(smallflash_parts); |
| 149 | } | 143 | } |
| 144 | |||
| 145 | mtd_device_parse_register(sbcmtd[i], part_probes, 0, | ||
| 146 | defparts, nr_parts); | ||
| 150 | } | 147 | } |
| 151 | return 0; | 148 | return 0; |
| 152 | } | 149 | } |
| @@ -159,12 +156,8 @@ static void __exit cleanup_sbc82xx_flash(void) | |||
| 159 | if (!sbcmtd[i]) | 156 | if (!sbcmtd[i]) |
| 160 | continue; | 157 | continue; |
| 161 | 158 | ||
| 162 | if (i<2 || sbcmtd_parts[i]) | 159 | mtd_device_unregister(sbcmtd[i]); |
| 163 | mtd_device_unregister(sbcmtd[i]); | ||
| 164 | else | ||
| 165 | mtd_device_unregister(sbcmtd[i]); | ||
| 166 | 160 | ||
| 167 | kfree(sbcmtd_parts[i]); | ||
| 168 | map_destroy(sbcmtd[i]); | 161 | map_destroy(sbcmtd[i]); |
| 169 | 162 | ||
| 170 | iounmap((void *)sbc82xx_flash_map[i].virt); | 163 | iounmap((void *)sbc82xx_flash_map[i].virt); |
