aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-04-06 17:56:26 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-04-06 17:56:26 -0400
commit22ae77bc7ac115b9d518d5cbc13d39317079b2b0 (patch)
tree574b7af678c0b1ad2c891ac5066292746788ece8 /drivers/mtd/maps
parente379ec7c42343c6b6ef06a98de7c94db41c1423e (diff)
parent30bbf1406714cf464c56e96e4ad6a291907f5023 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (53 commits) [MTD] struct device - replace bus_id with dev_name(), dev_set_name() [MTD] [NOR] Fixup for Numonyx M29W128 chips [MTD] mtdpart: Make ecc_stats more realistic. powerpc/85xx: TQM8548: Update DTS file for multi-chip support powerpc: NAND: FSL UPM: document new bindings [MTD] [NAND] FSL-UPM: Add wait flags to support board/chip specific delays [MTD] [NAND] FSL-UPM: add multi chip support [MTD] [NOR] Add device parent info to physmap_of [MTD] [NAND] Add support for NAND on the Socrates board [MTD] [NAND] Add support for 4KiB pages. [MTD] sysfs support should not depend on CONFIG_PROC_FS [MTD] [NAND] Add parent info for CAFÉ controller [MTD] support driver model updates [MTD] driver model updates (part 2) [MTD] driver model updates [MTD] [NAND] move gen_nand's probe function to .devinit.text [MTD] [MAPS] move sa1100 flash's probe function to .devinit.text [MTD] fix use after free in register_mtd_blktrans [MTD] [MAPS] Drop now unused sharpsl-flash map [MTD] ofpart: Check name property to determine partition nodes. ... Manually fix trivial conflict in drivers/mtd/maps/Makefile
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/Kconfig12
-rw-r--r--drivers/mtd/maps/Makefile2
-rw-r--r--drivers/mtd/maps/omap_nor.c2
-rw-r--r--drivers/mtd/maps/physmap.c1
-rw-r--r--drivers/mtd/maps/physmap_of.c1
-rw-r--r--drivers/mtd/maps/plat-ram.c1
-rw-r--r--drivers/mtd/maps/rbtx4939-flash.c208
-rw-r--r--drivers/mtd/maps/sa1100-flash.c2
-rw-r--r--drivers/mtd/maps/sharpsl-flash.c116
9 files changed, 221 insertions, 124 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 729f899a5cd5..82923bd2d9c5 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -529,12 +529,6 @@ config MTD_DMV182
529 help 529 help
530 Map driver for Dy-4 SVME/DMV-182 board. 530 Map driver for Dy-4 SVME/DMV-182 board.
531 531
532config MTD_SHARP_SL
533 tristate "ROM mapped on Sharp SL Series"
534 depends on ARCH_PXA
535 help
536 This enables access to the flash chip on the Sharp SL Series of PDAs.
537
538config MTD_INTEL_VR_NOR 532config MTD_INTEL_VR_NOR
539 tristate "NOR flash on Intel Vermilion Range Expansion Bus CS0" 533 tristate "NOR flash on Intel Vermilion Range Expansion Bus CS0"
540 depends on PCI 534 depends on PCI
@@ -542,6 +536,12 @@ config MTD_INTEL_VR_NOR
542 Map driver for a NOR flash bank located on the Expansion Bus of the 536 Map driver for a NOR flash bank located on the Expansion Bus of the
543 Intel Vermilion Range chipset. 537 Intel Vermilion Range chipset.
544 538
539config MTD_RBTX4939
540 tristate "Map driver for RBTX4939 board"
541 depends on TOSHIBA_RBTX4939 && MTD_CFI && MTD_COMPLEX_MAPPINGS
542 help
543 Map driver for NOR flash chips on RBTX4939 board.
544
545config MTD_PLATRAM 545config MTD_PLATRAM
546 tristate "Map driver for platform device RAM (mtd-ram)" 546 tristate "Map driver for platform device RAM (mtd-ram)"
547 select MTD_RAM 547 select MTD_RAM
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile
index 26b28a7a90b5..2dbc1bec8488 100644
--- a/drivers/mtd/maps/Makefile
+++ b/drivers/mtd/maps/Makefile
@@ -56,9 +56,9 @@ obj-$(CONFIG_MTD_IXP4XX) += ixp4xx.o
56obj-$(CONFIG_MTD_IXP2000) += ixp2000.o 56obj-$(CONFIG_MTD_IXP2000) += ixp2000.o
57obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o 57obj-$(CONFIG_MTD_WRSBC8260) += wr_sbc82xx_flash.o
58obj-$(CONFIG_MTD_DMV182) += dmv182.o 58obj-$(CONFIG_MTD_DMV182) += dmv182.o
59obj-$(CONFIG_MTD_SHARP_SL) += sharpsl-flash.o
60obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o 59obj-$(CONFIG_MTD_PLATRAM) += plat-ram.o
61obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o 60obj-$(CONFIG_MTD_OMAP_NOR) += omap_nor.o
62obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o 61obj-$(CONFIG_MTD_INTEL_VR_NOR) += intel_vr_nor.o
63obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o 62obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-async-flash.o
63obj-$(CONFIG_MTD_RBTX4939) += rbtx4939-flash.o
64obj-$(CONFIG_MTD_VMU) += vmu-flash.o 64obj-$(CONFIG_MTD_VMU) += vmu-flash.o
diff --git a/drivers/mtd/maps/omap_nor.c b/drivers/mtd/maps/omap_nor.c
index 7e50e9b1b781..a24478102b11 100644
--- a/drivers/mtd/maps/omap_nor.c
+++ b/drivers/mtd/maps/omap_nor.c
@@ -115,6 +115,8 @@ static int __init omapflash_probe(struct platform_device *pdev)
115 } 115 }
116 info->mtd->owner = THIS_MODULE; 116 info->mtd->owner = THIS_MODULE;
117 117
118 info->mtd->dev.parent = &pdev->dev;
119
118#ifdef CONFIG_MTD_PARTITIONS 120#ifdef CONFIG_MTD_PARTITIONS
119 err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0); 121 err = parse_mtd_partitions(info->mtd, part_probes, &info->parts, 0);
120 if (err > 0) 122 if (err > 0)
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c
index 229718222db7..29a901157352 100644
--- a/drivers/mtd/maps/physmap.c
+++ b/drivers/mtd/maps/physmap.c
@@ -147,6 +147,7 @@ static int physmap_flash_probe(struct platform_device *dev)
147 devices_found++; 147 devices_found++;
148 } 148 }
149 info->mtd[i]->owner = THIS_MODULE; 149 info->mtd[i]->owner = THIS_MODULE;
150 info->mtd[i]->dev.parent = &dev->dev;
150 } 151 }
151 152
152 if (devices_found == 1) { 153 if (devices_found == 1) {
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index fbf0ca939d72..c83a60fada53 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -219,6 +219,7 @@ static int __devinit of_flash_probe(struct of_device *dev,
219 goto err_out; 219 goto err_out;
220 } 220 }
221 info->mtd->owner = THIS_MODULE; 221 info->mtd->owner = THIS_MODULE;
222 info->mtd->dev.parent = &dev->dev;
222 223
223#ifdef CONFIG_MTD_PARTITIONS 224#ifdef CONFIG_MTD_PARTITIONS
224 /* First look for RedBoot table or partitions on the command 225 /* First look for RedBoot table or partitions on the command
diff --git a/drivers/mtd/maps/plat-ram.c b/drivers/mtd/maps/plat-ram.c
index e7dd9c8a965e..49c9ece76477 100644
--- a/drivers/mtd/maps/plat-ram.c
+++ b/drivers/mtd/maps/plat-ram.c
@@ -224,6 +224,7 @@ static int platram_probe(struct platform_device *pdev)
224 } 224 }
225 225
226 info->mtd->owner = THIS_MODULE; 226 info->mtd->owner = THIS_MODULE;
227 info->mtd->dev.parent = &pdev->dev;
227 228
228 platram_setrw(info, PLATRAM_RW); 229 platram_setrw(info, PLATRAM_RW);
229 230
diff --git a/drivers/mtd/maps/rbtx4939-flash.c b/drivers/mtd/maps/rbtx4939-flash.c
new file mode 100644
index 000000000000..d39f0adac846
--- /dev/null
+++ b/drivers/mtd/maps/rbtx4939-flash.c
@@ -0,0 +1,208 @@
1/*
2 * rbtx4939-flash (based on physmap.c)
3 *
4 * This is a simplified physmap driver with map_init callback function.
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 * Copyright (C) 2009 Atsushi Nemoto <anemo@mba.ocn.ne.jp>
11 */
12
13#include <linux/module.h>
14#include <linux/types.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/slab.h>
18#include <linux/device.h>
19#include <linux/platform_device.h>
20#include <linux/mtd/mtd.h>
21#include <linux/mtd/map.h>
22#include <linux/mtd/partitions.h>
23#include <asm/txx9/rbtx4939.h>
24
25struct rbtx4939_flash_info {
26 struct mtd_info *mtd;
27 struct map_info map;
28#ifdef CONFIG_MTD_PARTITIONS
29 int nr_parts;
30 struct mtd_partition *parts;
31#endif
32};
33
34static int rbtx4939_flash_remove(struct platform_device *dev)
35{
36 struct rbtx4939_flash_info *info;
37
38 info = platform_get_drvdata(dev);
39 if (!info)
40 return 0;
41 platform_set_drvdata(dev, NULL);
42
43 if (info->mtd) {
44#ifdef CONFIG_MTD_PARTITIONS
45 struct rbtx4939_flash_data *pdata = dev->dev.platform_data;
46
47 if (info->nr_parts) {
48 del_mtd_partitions(info->mtd);
49 kfree(info->parts);
50 } else if (pdata->nr_parts)
51 del_mtd_partitions(info->mtd);
52 else
53 del_mtd_device(info->mtd);
54#else
55 del_mtd_device(info->mtd);
56#endif
57 map_destroy(info->mtd);
58 }
59 return 0;
60}
61
62static const char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
63#ifdef CONFIG_MTD_PARTITIONS
64static const char *part_probe_types[] = { "cmdlinepart", NULL };
65#endif
66
67static int rbtx4939_flash_probe(struct platform_device *dev)
68{
69 struct rbtx4939_flash_data *pdata;
70 struct rbtx4939_flash_info *info;
71 struct resource *res;
72 const char **probe_type;
73 int err = 0;
74 unsigned long size;
75
76 pdata = dev->dev.platform_data;
77 if (!pdata)
78 return -ENODEV;
79
80 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
81 if (!res)
82 return -ENODEV;
83 info = devm_kzalloc(&dev->dev, sizeof(struct rbtx4939_flash_info),
84 GFP_KERNEL);
85 if (!info)
86 return -ENOMEM;
87
88 platform_set_drvdata(dev, info);
89
90 size = resource_size(res);
91 pr_notice("rbtx4939 platform flash device: %pR\n", res);
92
93 if (!devm_request_mem_region(&dev->dev, res->start, size,
94 dev_name(&dev->dev)))
95 return -EBUSY;
96
97 info->map.name = dev_name(&dev->dev);
98 info->map.phys = res->start;
99 info->map.size = size;
100 info->map.bankwidth = pdata->width;
101
102 info->map.virt = devm_ioremap(&dev->dev, info->map.phys, size);
103 if (!info->map.virt)
104 return -EBUSY;
105
106 if (pdata->map_init)
107 (*pdata->map_init)(&info->map);
108 else
109 simple_map_init(&info->map);
110
111 probe_type = rom_probe_types;
112 for (; !info->mtd && *probe_type; probe_type++)
113 info->mtd = do_map_probe(*probe_type, &info->map);
114 if (!info->mtd) {
115 dev_err(&dev->dev, "map_probe failed\n");
116 err = -ENXIO;
117 goto err_out;
118 }
119 info->mtd->owner = THIS_MODULE;
120 if (err)
121 goto err_out;
122
123#ifdef CONFIG_MTD_PARTITIONS
124 err = parse_mtd_partitions(info->mtd, part_probe_types,
125 &info->parts, 0);
126 if (err > 0) {
127 add_mtd_partitions(info->mtd, info->parts, err);
128 info->nr_parts = err;
129 return 0;
130 }
131
132 if (pdata->nr_parts) {
133 pr_notice("Using rbtx4939 partition information\n");
134 add_mtd_partitions(info->mtd, pdata->parts, pdata->nr_parts);
135 return 0;
136 }
137#endif
138
139 add_mtd_device(info->mtd);
140 return 0;
141
142err_out:
143 rbtx4939_flash_remove(dev);
144 return err;
145}
146
147#ifdef CONFIG_PM
148static int rbtx4939_flash_suspend(struct platform_device *dev,
149 pm_message_t state)
150{
151 struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
152
153 if (info->mtd->suspend)
154 return info->mtd->suspend(info->mtd);
155 return 0;
156}
157
158static int rbtx4939_flash_resume(struct platform_device *dev)
159{
160 struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
161
162 if (info->mtd->resume)
163 info->mtd->resume(info->mtd);
164 return 0;
165}
166
167static void rbtx4939_flash_shutdown(struct platform_device *dev)
168{
169 struct rbtx4939_flash_info *info = platform_get_drvdata(dev);
170
171 if (info->mtd->suspend && info->mtd->resume)
172 if (info->mtd->suspend(info->mtd) == 0)
173 info->mtd->resume(info->mtd);
174}
175#else
176#define rbtx4939_flash_suspend NULL
177#define rbtx4939_flash_resume NULL
178#define rbtx4939_flash_shutdown NULL
179#endif
180
181static struct platform_driver rbtx4939_flash_driver = {
182 .probe = rbtx4939_flash_probe,
183 .remove = rbtx4939_flash_remove,
184 .suspend = rbtx4939_flash_suspend,
185 .resume = rbtx4939_flash_resume,
186 .shutdown = rbtx4939_flash_shutdown,
187 .driver = {
188 .name = "rbtx4939-flash",
189 .owner = THIS_MODULE,
190 },
191};
192
193static int __init rbtx4939_flash_init(void)
194{
195 return platform_driver_register(&rbtx4939_flash_driver);
196}
197
198static void __exit rbtx4939_flash_exit(void)
199{
200 platform_driver_unregister(&rbtx4939_flash_driver);
201}
202
203module_init(rbtx4939_flash_init);
204module_exit(rbtx4939_flash_exit);
205
206MODULE_LICENSE("GPL");
207MODULE_DESCRIPTION("RBTX4939 MTD map driver");
208MODULE_ALIAS("platform:rbtx4939-flash");
diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c
index 8f57b6f40aa2..05e9362dc7f0 100644
--- a/drivers/mtd/maps/sa1100-flash.c
+++ b/drivers/mtd/maps/sa1100-flash.c
@@ -351,7 +351,7 @@ sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat)
351 351
352static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL }; 352static const char *part_probes[] = { "cmdlinepart", "RedBoot", NULL };
353 353
354static int __init sa1100_mtd_probe(struct platform_device *pdev) 354static int __devinit sa1100_mtd_probe(struct platform_device *pdev)
355{ 355{
356 struct flash_platform_data *plat = pdev->dev.platform_data; 356 struct flash_platform_data *plat = pdev->dev.platform_data;
357 struct mtd_partition *parts; 357 struct mtd_partition *parts;
diff --git a/drivers/mtd/maps/sharpsl-flash.c b/drivers/mtd/maps/sharpsl-flash.c
deleted file mode 100644
index b392f096c706..000000000000
--- a/drivers/mtd/maps/sharpsl-flash.c
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * sharpsl-flash.c
3 *
4 * Copyright (C) 2001 Lineo Japan, Inc.
5 * Copyright (C) 2002 SHARP
6 *
7 * based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp
8 * Handle mapping of the flash on the RPX Lite and CLLF boards
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 */
21
22#include <linux/module.h>
23#include <linux/types.h>
24#include <linux/kernel.h>
25#include <linux/mtd/mtd.h>
26#include <linux/mtd/map.h>
27#include <linux/mtd/partitions.h>
28#include <asm/io.h>
29#include <asm/mach-types.h>
30
31#define WINDOW_ADDR 0x00000000
32#define WINDOW_SIZE 0x00800000
33#define BANK_WIDTH 2
34
35static struct mtd_info *mymtd;
36
37struct map_info sharpsl_map = {
38 .name = "sharpsl-flash",
39 .size = WINDOW_SIZE,
40 .bankwidth = BANK_WIDTH,
41 .phys = WINDOW_ADDR
42};
43
44static struct mtd_partition sharpsl_partitions[1] = {
45 {
46 name: "Boot PROM Filesystem",
47 }
48};
49
50static int __init init_sharpsl(void)
51{
52 struct mtd_partition *parts;
53 int nb_parts = 0;
54 char *part_type = "static";
55
56 printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n",
57 WINDOW_SIZE, WINDOW_ADDR);
58 sharpsl_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
59 if (!sharpsl_map.virt) {
60 printk("Failed to ioremap\n");
61 return -EIO;
62 }
63
64 simple_map_init(&sharpsl_map);
65
66 mymtd = do_map_probe("map_rom", &sharpsl_map);
67 if (!mymtd) {
68 iounmap(sharpsl_map.virt);
69 return -ENXIO;
70 }
71
72 mymtd->owner = THIS_MODULE;
73
74 if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()
75 || machine_is_poodle()) {
76 sharpsl_partitions[0].size=0x006d0000;
77 sharpsl_partitions[0].offset=0x00120000;
78 } else if (machine_is_tosa()) {
79 sharpsl_partitions[0].size=0x006a0000;
80 sharpsl_partitions[0].offset=0x00160000;
81 } else if (machine_is_spitz() || machine_is_akita() || machine_is_borzoi()) {
82 sharpsl_partitions[0].size=0x006b0000;
83 sharpsl_partitions[0].offset=0x00140000;
84 } else {
85 map_destroy(mymtd);
86 iounmap(sharpsl_map.virt);
87 return -ENODEV;
88 }
89
90 parts = sharpsl_partitions;
91 nb_parts = ARRAY_SIZE(sharpsl_partitions);
92
93 printk(KERN_NOTICE "Using %s partition definition\n", part_type);
94 add_mtd_partitions(mymtd, parts, nb_parts);
95
96 return 0;
97}
98
99static void __exit cleanup_sharpsl(void)
100{
101 if (mymtd) {
102 del_mtd_partitions(mymtd);
103 map_destroy(mymtd);
104 }
105 if (sharpsl_map.virt) {
106 iounmap(sharpsl_map.virt);
107 sharpsl_map.virt = 0;
108 }
109}
110
111module_init(init_sharpsl);
112module_exit(cleanup_sharpsl);
113
114MODULE_LICENSE("GPL");
115MODULE_AUTHOR("SHARP (Original: Arnold Christensen <AKC@pel.dk>)");
116MODULE_DESCRIPTION("MTD map driver for SHARP SL series");