diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 13:20:31 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-07 13:20:31 -0500 |
commit | a8e98d6d51a3eb7bb061b1625193a129c8bd094f (patch) | |
tree | 0fa58b6e11e37023b024e55b8f0e7e01438706d4 /drivers/mtd/maps | |
parent | f0f1b3364ae7f48084bdf2837fb979ff59622523 (diff) | |
parent | f9f7dd222364a6428d2ad99a515935dd1dd89d18 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (120 commits)
[MTD] Fix mtdoops.c compilation
[MTD] [NOR] fix startup lock when using multiple nor flash chips
[MTD] [DOC200x] eccbuf is statically defined and always evaluate to true
[MTD] Fix maps/physmap.c compilation with CONFIG_PM
[MTD] onenand: Add panic_write function to the onenand driver
[MTD] mtdoops: Use the panic_write function when present
[MTD] Add mtd panic_write function pointer
[MTD] [NAND] Freescale enhanced Local Bus Controller FCM NAND support.
[MTD] physmap.c: Add support for multiple resources
[MTD] [NAND] Fix misparenthesization introduced by commit 78b65179...
[MTD] [NAND] Fix Blackfin NFC ECC calculating bug with page size 512 bytes
[MTD] [NAND] Remove wrong operation in PM function of the BF54x NFC driver
[MTD] [NAND] Remove unused variable in plat_nand_remove
[MTD] Unlocking all Intel flash that is locked on power up.
[MTD] [NAND] at91_nand: Make mtdparts option can override board info
[MTD] mtdoops: Various minor cleanups
[MTD] mtdoops: Ensure sequential write to the buffer
[MTD] mtdoops: Perform write operations in a workqueue
[MTD] mtdoops: Add further error return code checking
[MTD] [NOR] Test devtype, not definition in flash_probe(), drivers/mtd/devices/lart.c
...
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r-- | drivers/mtd/maps/Kconfig | 9 | ||||
-rw-r--r-- | drivers/mtd/maps/Makefile | 1 | ||||
-rw-r--r-- | drivers/mtd/maps/physmap.c | 168 | ||||
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 88 | ||||
-rw-r--r-- | drivers/mtd/maps/pnc2000.c | 93 | ||||
-rw-r--r-- | drivers/mtd/maps/scb2_flash.c | 2 |
6 files changed, 137 insertions, 224 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig index a592fc04cf78..12c253664eb2 100644 --- a/drivers/mtd/maps/Kconfig +++ b/drivers/mtd/maps/Kconfig | |||
@@ -110,13 +110,6 @@ config MTD_SUN_UFLASH | |||
110 | Sun Microsystems boardsets. This driver will require CFI support | 110 | Sun Microsystems boardsets. This driver will require CFI support |
111 | in the kernel, so if you did not enable CFI previously, do that now. | 111 | in the kernel, so if you did not enable CFI previously, do that now. |
112 | 112 | ||
113 | config MTD_PNC2000 | ||
114 | tristate "CFI Flash device mapped on Photron PNC-2000" | ||
115 | depends on X86 && MTD_CFI && MTD_PARTITIONS | ||
116 | help | ||
117 | PNC-2000 is the name of Network Camera product from PHOTRON | ||
118 | Ltd. in Japan. It uses CFI-compliant flash. | ||
119 | |||
120 | config MTD_SC520CDP | 113 | config MTD_SC520CDP |
121 | tristate "CFI Flash device mapped on AMD SC520 CDP" | 114 | tristate "CFI Flash device mapped on AMD SC520 CDP" |
122 | depends on X86 && MTD_CFI && MTD_CONCAT | 115 | depends on X86 && MTD_CFI && MTD_CONCAT |
@@ -576,7 +569,7 @@ config MTD_BAST_MAXSIZE | |||
576 | default "4" | 569 | default "4" |
577 | 570 | ||
578 | config MTD_SHARP_SL | 571 | config MTD_SHARP_SL |
579 | bool "ROM mapped on Sharp SL Series" | 572 | tristate "ROM mapped on Sharp SL Series" |
580 | depends on ARCH_PXA | 573 | depends on ARCH_PXA |
581 | help | 574 | help |
582 | This enables access to the flash chip on the Sharp SL Series of PDAs. | 575 | This enables access to the flash chip on the Sharp SL Series of PDAs. |
diff --git a/drivers/mtd/maps/Makefile b/drivers/mtd/maps/Makefile index 316382a1401b..a9cbe80f99a0 100644 --- a/drivers/mtd/maps/Makefile +++ b/drivers/mtd/maps/Makefile | |||
@@ -28,7 +28,6 @@ obj-$(CONFIG_MTD_PHYSMAP) += physmap.o | |||
28 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o | 28 | obj-$(CONFIG_MTD_PHYSMAP_OF) += physmap_of.o |
29 | obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o | 29 | obj-$(CONFIG_MTD_PMC_MSP_EVM) += pmcmsp-flash.o |
30 | obj-$(CONFIG_MTD_PMC_MSP_RAMROOT)+= pmcmsp-ramroot.o | 30 | obj-$(CONFIG_MTD_PMC_MSP_RAMROOT)+= pmcmsp-ramroot.o |
31 | obj-$(CONFIG_MTD_PNC2000) += pnc2000.o | ||
32 | obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o | 31 | obj-$(CONFIG_MTD_PCMCIA) += pcmciamtd.o |
33 | obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o | 32 | obj-$(CONFIG_MTD_RPXLITE) += rpxlite.o |
34 | obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o | 33 | obj-$(CONFIG_MTD_TQM8XXL) += tqm8xxl.o |
diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 28c5ffd75233..f00e04efbe28 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c | |||
@@ -20,11 +20,15 @@ | |||
20 | #include <linux/mtd/map.h> | 20 | #include <linux/mtd/map.h> |
21 | #include <linux/mtd/partitions.h> | 21 | #include <linux/mtd/partitions.h> |
22 | #include <linux/mtd/physmap.h> | 22 | #include <linux/mtd/physmap.h> |
23 | #include <linux/mtd/concat.h> | ||
23 | #include <asm/io.h> | 24 | #include <asm/io.h> |
24 | 25 | ||
26 | #define MAX_RESOURCES 4 | ||
27 | |||
25 | struct physmap_flash_info { | 28 | struct physmap_flash_info { |
26 | struct mtd_info *mtd; | 29 | struct mtd_info *mtd[MAX_RESOURCES]; |
27 | struct map_info map; | 30 | struct mtd_info *cmtd; |
31 | struct map_info map[MAX_RESOURCES]; | ||
28 | struct resource *res; | 32 | struct resource *res; |
29 | #ifdef CONFIG_MTD_PARTITIONS | 33 | #ifdef CONFIG_MTD_PARTITIONS |
30 | int nr_parts; | 34 | int nr_parts; |
@@ -32,11 +36,11 @@ struct physmap_flash_info { | |||
32 | #endif | 36 | #endif |
33 | }; | 37 | }; |
34 | 38 | ||
35 | |||
36 | static int physmap_flash_remove(struct platform_device *dev) | 39 | static int physmap_flash_remove(struct platform_device *dev) |
37 | { | 40 | { |
38 | struct physmap_flash_info *info; | 41 | struct physmap_flash_info *info; |
39 | struct physmap_flash_data *physmap_data; | 42 | struct physmap_flash_data *physmap_data; |
43 | int i; | ||
40 | 44 | ||
41 | info = platform_get_drvdata(dev); | 45 | info = platform_get_drvdata(dev); |
42 | if (info == NULL) | 46 | if (info == NULL) |
@@ -45,24 +49,33 @@ static int physmap_flash_remove(struct platform_device *dev) | |||
45 | 49 | ||
46 | physmap_data = dev->dev.platform_data; | 50 | physmap_data = dev->dev.platform_data; |
47 | 51 | ||
48 | if (info->mtd != NULL) { | 52 | #ifdef CONFIG_MTD_CONCAT |
53 | if (info->cmtd != info->mtd[0]) { | ||
54 | del_mtd_device(info->cmtd); | ||
55 | mtd_concat_destroy(info->cmtd); | ||
56 | } | ||
57 | #endif | ||
58 | |||
59 | for (i = 0; i < MAX_RESOURCES; i++) { | ||
60 | if (info->mtd[i] != NULL) { | ||
49 | #ifdef CONFIG_MTD_PARTITIONS | 61 | #ifdef CONFIG_MTD_PARTITIONS |
50 | if (info->nr_parts) { | 62 | if (info->nr_parts) { |
51 | del_mtd_partitions(info->mtd); | 63 | del_mtd_partitions(info->mtd[i]); |
52 | kfree(info->parts); | 64 | kfree(info->parts); |
53 | } else if (physmap_data->nr_parts) { | 65 | } else if (physmap_data->nr_parts) { |
54 | del_mtd_partitions(info->mtd); | 66 | del_mtd_partitions(info->mtd[i]); |
55 | } else { | 67 | } else { |
56 | del_mtd_device(info->mtd); | 68 | del_mtd_device(info->mtd[i]); |
57 | } | 69 | } |
58 | #else | 70 | #else |
59 | del_mtd_device(info->mtd); | 71 | del_mtd_device(info->mtd[i]); |
60 | #endif | 72 | #endif |
61 | map_destroy(info->mtd); | 73 | map_destroy(info->mtd[i]); |
62 | } | 74 | } |
63 | 75 | ||
64 | if (info->map.virt != NULL) | 76 | if (info->map[i].virt != NULL) |
65 | iounmap(info->map.virt); | 77 | iounmap(info->map[i].virt); |
78 | } | ||
66 | 79 | ||
67 | if (info->res != NULL) { | 80 | if (info->res != NULL) { |
68 | release_resource(info->res); | 81 | release_resource(info->res); |
@@ -82,16 +95,14 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
82 | struct physmap_flash_data *physmap_data; | 95 | struct physmap_flash_data *physmap_data; |
83 | struct physmap_flash_info *info; | 96 | struct physmap_flash_info *info; |
84 | const char **probe_type; | 97 | const char **probe_type; |
85 | int err; | 98 | int err = 0; |
99 | int i; | ||
100 | int devices_found = 0; | ||
86 | 101 | ||
87 | physmap_data = dev->dev.platform_data; | 102 | physmap_data = dev->dev.platform_data; |
88 | if (physmap_data == NULL) | 103 | if (physmap_data == NULL) |
89 | return -ENODEV; | 104 | return -ENODEV; |
90 | 105 | ||
91 | printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n", | ||
92 | (unsigned long long)(dev->resource->end - dev->resource->start + 1), | ||
93 | (unsigned long long)dev->resource->start); | ||
94 | |||
95 | info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL); | 106 | info = kzalloc(sizeof(struct physmap_flash_info), GFP_KERNEL); |
96 | if (info == NULL) { | 107 | if (info == NULL) { |
97 | err = -ENOMEM; | 108 | err = -ENOMEM; |
@@ -100,56 +111,83 @@ static int physmap_flash_probe(struct platform_device *dev) | |||
100 | 111 | ||
101 | platform_set_drvdata(dev, info); | 112 | platform_set_drvdata(dev, info); |
102 | 113 | ||
103 | info->res = request_mem_region(dev->resource->start, | 114 | for (i = 0; i < dev->num_resources; i++) { |
104 | dev->resource->end - dev->resource->start + 1, | 115 | printk(KERN_NOTICE "physmap platform flash device: %.8llx at %.8llx\n", |
105 | dev->dev.bus_id); | 116 | (unsigned long long)(dev->resource[i].end - dev->resource[i].start + 1), |
106 | if (info->res == NULL) { | 117 | (unsigned long long)dev->resource[i].start); |
107 | dev_err(&dev->dev, "Could not reserve memory region\n"); | 118 | |
108 | err = -ENOMEM; | 119 | info->res = request_mem_region(dev->resource[i].start, |
109 | goto err_out; | 120 | dev->resource[i].end - dev->resource[i].start + 1, |
110 | } | 121 | dev->dev.bus_id); |
122 | if (info->res == NULL) { | ||
123 | dev_err(&dev->dev, "Could not reserve memory region\n"); | ||
124 | err = -ENOMEM; | ||
125 | goto err_out; | ||
126 | } | ||
111 | 127 | ||
112 | info->map.name = dev->dev.bus_id; | 128 | info->map[i].name = dev->dev.bus_id; |
113 | info->map.phys = dev->resource->start; | 129 | info->map[i].phys = dev->resource[i].start; |
114 | info->map.size = dev->resource->end - dev->resource->start + 1; | 130 | info->map[i].size = dev->resource[i].end - dev->resource[i].start + 1; |
115 | info->map.bankwidth = physmap_data->width; | 131 | info->map[i].bankwidth = physmap_data->width; |
116 | info->map.set_vpp = physmap_data->set_vpp; | 132 | info->map[i].set_vpp = physmap_data->set_vpp; |
133 | |||
134 | info->map[i].virt = ioremap(info->map[i].phys, info->map[i].size); | ||
135 | if (info->map[i].virt == NULL) { | ||
136 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); | ||
137 | err = EIO; | ||
138 | goto err_out; | ||
139 | } | ||
117 | 140 | ||
118 | info->map.virt = ioremap(info->map.phys, info->map.size); | 141 | simple_map_init(&info->map[i]); |
119 | if (info->map.virt == NULL) { | ||
120 | dev_err(&dev->dev, "Failed to ioremap flash region\n"); | ||
121 | err = EIO; | ||
122 | goto err_out; | ||
123 | } | ||
124 | 142 | ||
125 | simple_map_init(&info->map); | 143 | probe_type = rom_probe_types; |
144 | for (; info->mtd[i] == NULL && *probe_type != NULL; probe_type++) | ||
145 | info->mtd[i] = do_map_probe(*probe_type, &info->map[i]); | ||
146 | if (info->mtd[i] == NULL) { | ||
147 | dev_err(&dev->dev, "map_probe failed\n"); | ||
148 | err = -ENXIO; | ||
149 | goto err_out; | ||
150 | } else { | ||
151 | devices_found++; | ||
152 | } | ||
153 | info->mtd[i]->owner = THIS_MODULE; | ||
154 | } | ||
126 | 155 | ||
127 | probe_type = rom_probe_types; | 156 | if (devices_found == 1) { |
128 | for (; info->mtd == NULL && *probe_type != NULL; probe_type++) | 157 | info->cmtd = info->mtd[0]; |
129 | info->mtd = do_map_probe(*probe_type, &info->map); | 158 | } else if (devices_found > 1) { |
130 | if (info->mtd == NULL) { | 159 | /* |
131 | dev_err(&dev->dev, "map_probe failed\n"); | 160 | * We detected multiple devices. Concatenate them together. |
161 | */ | ||
162 | #ifdef CONFIG_MTD_CONCAT | ||
163 | info->cmtd = mtd_concat_create(info->mtd, devices_found, dev->dev.bus_id); | ||
164 | if (info->cmtd == NULL) | ||
165 | err = -ENXIO; | ||
166 | #else | ||
167 | printk(KERN_ERR "physmap-flash: multiple devices " | ||
168 | "found but MTD concat support disabled.\n"); | ||
132 | err = -ENXIO; | 169 | err = -ENXIO; |
133 | goto err_out; | 170 | #endif |
134 | } | 171 | } |
135 | info->mtd->owner = THIS_MODULE; | 172 | if (err) |
173 | goto err_out; | ||
136 | 174 | ||
137 | #ifdef CONFIG_MTD_PARTITIONS | 175 | #ifdef CONFIG_MTD_PARTITIONS |
138 | err = parse_mtd_partitions(info->mtd, part_probe_types, &info->parts, 0); | 176 | err = parse_mtd_partitions(info->cmtd, part_probe_types, &info->parts, 0); |
139 | if (err > 0) { | 177 | if (err > 0) { |
140 | add_mtd_partitions(info->mtd, info->parts, err); | 178 | add_mtd_partitions(info->cmtd, info->parts, err); |
141 | return 0; | 179 | return 0; |
142 | } | 180 | } |
143 | 181 | ||
144 | if (physmap_data->nr_parts) { | 182 | if (physmap_data->nr_parts) { |
145 | printk(KERN_NOTICE "Using physmap partition information\n"); | 183 | printk(KERN_NOTICE "Using physmap partition information\n"); |
146 | add_mtd_partitions(info->mtd, physmap_data->parts, | 184 | add_mtd_partitions(info->cmtd, physmap_data->parts, |
147 | physmap_data->nr_parts); | 185 | physmap_data->nr_parts); |
148 | return 0; | 186 | return 0; |
149 | } | 187 | } |
150 | #endif | 188 | #endif |
151 | 189 | ||
152 | add_mtd_device(info->mtd); | 190 | add_mtd_device(info->cmtd); |
153 | return 0; | 191 | return 0; |
154 | 192 | ||
155 | err_out: | 193 | err_out: |
@@ -162,9 +200,11 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state | |||
162 | { | 200 | { |
163 | struct physmap_flash_info *info = platform_get_drvdata(dev); | 201 | struct physmap_flash_info *info = platform_get_drvdata(dev); |
164 | int ret = 0; | 202 | int ret = 0; |
203 | int i; | ||
165 | 204 | ||
166 | if (info) | 205 | if (info) |
167 | ret = info->mtd->suspend(info->mtd); | 206 | for (i = 0; i < MAX_RESOURCES; i++) |
207 | ret |= info->mtd[i]->suspend(info->mtd[i]); | ||
168 | 208 | ||
169 | return ret; | 209 | return ret; |
170 | } | 210 | } |
@@ -172,27 +212,35 @@ static int physmap_flash_suspend(struct platform_device *dev, pm_message_t state | |||
172 | static int physmap_flash_resume(struct platform_device *dev) | 212 | static int physmap_flash_resume(struct platform_device *dev) |
173 | { | 213 | { |
174 | struct physmap_flash_info *info = platform_get_drvdata(dev); | 214 | struct physmap_flash_info *info = platform_get_drvdata(dev); |
215 | int i; | ||
216 | |||
175 | if (info) | 217 | if (info) |
176 | info->mtd->resume(info->mtd); | 218 | for (i = 0; i < MAX_RESOURCES; i++) |
219 | info->mtd[i]->resume(info->mtd[i]); | ||
177 | return 0; | 220 | return 0; |
178 | } | 221 | } |
179 | 222 | ||
180 | static void physmap_flash_shutdown(struct platform_device *dev) | 223 | static void physmap_flash_shutdown(struct platform_device *dev) |
181 | { | 224 | { |
182 | struct physmap_flash_info *info = platform_get_drvdata(dev); | 225 | struct physmap_flash_info *info = platform_get_drvdata(dev); |
183 | if (info && info->mtd->suspend(info->mtd) == 0) | 226 | int i; |
184 | info->mtd->resume(info->mtd); | 227 | |
228 | for (i = 0; i < MAX_RESOURCES; i++) | ||
229 | if (info && info->mtd[i]->suspend(info->mtd[i]) == 0) | ||
230 | info->mtd[i]->resume(info->mtd[i]); | ||
185 | } | 231 | } |
232 | #else | ||
233 | #define physmap_flash_suspend NULL | ||
234 | #define physmap_flash_resume NULL | ||
235 | #define physmap_flash_shutdown NULL | ||
186 | #endif | 236 | #endif |
187 | 237 | ||
188 | static struct platform_driver physmap_flash_driver = { | 238 | static struct platform_driver physmap_flash_driver = { |
189 | .probe = physmap_flash_probe, | 239 | .probe = physmap_flash_probe, |
190 | .remove = physmap_flash_remove, | 240 | .remove = physmap_flash_remove, |
191 | #ifdef CONFIG_PM | ||
192 | .suspend = physmap_flash_suspend, | 241 | .suspend = physmap_flash_suspend, |
193 | .resume = physmap_flash_resume, | 242 | .resume = physmap_flash_resume, |
194 | .shutdown = physmap_flash_shutdown, | 243 | .shutdown = physmap_flash_shutdown, |
195 | #endif | ||
196 | .driver = { | 244 | .driver = { |
197 | .name = "physmap-flash", | 245 | .name = "physmap-flash", |
198 | }, | 246 | }, |
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index aeed9ea79714..49acd4171893 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -80,64 +80,6 @@ static int parse_obsolete_partitions(struct of_device *dev, | |||
80 | 80 | ||
81 | return nr_parts; | 81 | return nr_parts; |
82 | } | 82 | } |
83 | |||
84 | static int __devinit parse_partitions(struct of_flash *info, | ||
85 | struct of_device *dev) | ||
86 | { | ||
87 | const char *partname; | ||
88 | static const char *part_probe_types[] | ||
89 | = { "cmdlinepart", "RedBoot", NULL }; | ||
90 | struct device_node *dp = dev->node, *pp; | ||
91 | int nr_parts, i; | ||
92 | |||
93 | /* First look for RedBoot table or partitions on the command | ||
94 | * line, these take precedence over device tree information */ | ||
95 | nr_parts = parse_mtd_partitions(info->mtd, part_probe_types, | ||
96 | &info->parts, 0); | ||
97 | if (nr_parts > 0) { | ||
98 | add_mtd_partitions(info->mtd, info->parts, nr_parts); | ||
99 | return 0; | ||
100 | } | ||
101 | |||
102 | /* First count the subnodes */ | ||
103 | nr_parts = 0; | ||
104 | for (pp = dp->child; pp; pp = pp->sibling) | ||
105 | nr_parts++; | ||
106 | |||
107 | if (nr_parts == 0) | ||
108 | return parse_obsolete_partitions(dev, info, dp); | ||
109 | |||
110 | info->parts = kzalloc(nr_parts * sizeof(*info->parts), | ||
111 | GFP_KERNEL); | ||
112 | if (!info->parts) | ||
113 | return -ENOMEM; | ||
114 | |||
115 | for (pp = dp->child, i = 0; pp; pp = pp->sibling, i++) { | ||
116 | const u32 *reg; | ||
117 | int len; | ||
118 | |||
119 | reg = of_get_property(pp, "reg", &len); | ||
120 | if (!reg || (len != 2*sizeof(u32))) { | ||
121 | dev_err(&dev->dev, "Invalid 'reg' on %s\n", | ||
122 | dp->full_name); | ||
123 | kfree(info->parts); | ||
124 | info->parts = NULL; | ||
125 | return -EINVAL; | ||
126 | } | ||
127 | info->parts[i].offset = reg[0]; | ||
128 | info->parts[i].size = reg[1]; | ||
129 | |||
130 | partname = of_get_property(pp, "label", &len); | ||
131 | if (!partname) | ||
132 | partname = of_get_property(pp, "name", &len); | ||
133 | info->parts[i].name = (char *)partname; | ||
134 | |||
135 | if (of_get_property(pp, "read-only", &len)) | ||
136 | info->parts[i].mask_flags = MTD_WRITEABLE; | ||
137 | } | ||
138 | |||
139 | return nr_parts; | ||
140 | } | ||
141 | #else /* MTD_PARTITIONS */ | 83 | #else /* MTD_PARTITIONS */ |
142 | #define OF_FLASH_PARTS(info) (0) | 84 | #define OF_FLASH_PARTS(info) (0) |
143 | #define parse_partitions(info, dev) (0) | 85 | #define parse_partitions(info, dev) (0) |
@@ -212,6 +154,10 @@ static struct mtd_info * __devinit obsolete_probe(struct of_device *dev, | |||
212 | static int __devinit of_flash_probe(struct of_device *dev, | 154 | static int __devinit of_flash_probe(struct of_device *dev, |
213 | const struct of_device_id *match) | 155 | const struct of_device_id *match) |
214 | { | 156 | { |
157 | #ifdef CONFIG_MTD_PARTITIONS | ||
158 | static const char *part_probe_types[] | ||
159 | = { "cmdlinepart", "RedBoot", NULL }; | ||
160 | #endif | ||
215 | struct device_node *dp = dev->node; | 161 | struct device_node *dp = dev->node; |
216 | struct resource res; | 162 | struct resource res; |
217 | struct of_flash *info; | 163 | struct of_flash *info; |
@@ -274,13 +220,33 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
274 | } | 220 | } |
275 | info->mtd->owner = THIS_MODULE; | 221 | info->mtd->owner = THIS_MODULE; |
276 | 222 | ||
277 | err = parse_partitions(info, dev); | 223 | #ifdef CONFIG_MTD_PARTITIONS |
224 | /* First look for RedBoot table or partitions on the command | ||
225 | * line, these take precedence over device tree information */ | ||
226 | err = parse_mtd_partitions(info->mtd, part_probe_types, | ||
227 | &info->parts, 0); | ||
278 | if (err < 0) | 228 | if (err < 0) |
279 | goto err_out; | 229 | return err; |
230 | |||
231 | #ifdef CONFIG_MTD_OF_PARTS | ||
232 | if (err == 0) { | ||
233 | err = of_mtd_parse_partitions(&dev->dev, info->mtd, | ||
234 | dp, &info->parts); | ||
235 | if (err < 0) | ||
236 | return err; | ||
237 | } | ||
238 | #endif | ||
239 | |||
240 | if (err == 0) { | ||
241 | err = parse_obsolete_partitions(dev, info, dp); | ||
242 | if (err < 0) | ||
243 | return err; | ||
244 | } | ||
280 | 245 | ||
281 | if (err > 0) | 246 | if (err > 0) |
282 | add_mtd_partitions(info->mtd, OF_FLASH_PARTS(info), err); | 247 | add_mtd_partitions(info->mtd, info->parts, err); |
283 | else | 248 | else |
249 | #endif | ||
284 | add_mtd_device(info->mtd); | 250 | add_mtd_device(info->mtd); |
285 | 251 | ||
286 | return 0; | 252 | return 0; |
diff --git a/drivers/mtd/maps/pnc2000.c b/drivers/mtd/maps/pnc2000.c deleted file mode 100644 index d7e16c2d5c44..000000000000 --- a/drivers/mtd/maps/pnc2000.c +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | /* | ||
2 | * pnc2000.c - mapper for Photron PNC-2000 board. | ||
3 | * | ||
4 | * Copyright (C) 2000 Crossnet Co. <info@crossnet.co.jp> | ||
5 | * | ||
6 | * This code is GPL | ||
7 | * | ||
8 | * $Id: pnc2000.c,v 1.18 2005/11/07 11:14:28 gleixner Exp $ | ||
9 | */ | ||
10 | |||
11 | #include <linux/module.h> | ||
12 | #include <linux/types.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/init.h> | ||
15 | |||
16 | #include <linux/mtd/mtd.h> | ||
17 | #include <linux/mtd/map.h> | ||
18 | #include <linux/mtd/partitions.h> | ||
19 | |||
20 | |||
21 | #define WINDOW_ADDR 0xbf000000 | ||
22 | #define WINDOW_SIZE 0x00400000 | ||
23 | |||
24 | /* | ||
25 | * MAP DRIVER STUFF | ||
26 | */ | ||
27 | |||
28 | |||
29 | static struct map_info pnc_map = { | ||
30 | .name = "PNC-2000", | ||
31 | .size = WINDOW_SIZE, | ||
32 | .bankwidth = 4, | ||
33 | .phys = 0xFFFFFFFF, | ||
34 | .virt = (void __iomem *)WINDOW_ADDR, | ||
35 | }; | ||
36 | |||
37 | |||
38 | /* | ||
39 | * MTD 'PARTITIONING' STUFF | ||
40 | */ | ||
41 | static struct mtd_partition pnc_partitions[3] = { | ||
42 | { | ||
43 | .name = "PNC-2000 boot firmware", | ||
44 | .size = 0x20000, | ||
45 | .offset = 0 | ||
46 | }, | ||
47 | { | ||
48 | .name = "PNC-2000 kernel", | ||
49 | .size = 0x1a0000, | ||
50 | .offset = 0x20000 | ||
51 | }, | ||
52 | { | ||
53 | .name = "PNC-2000 filesystem", | ||
54 | .size = 0x240000, | ||
55 | .offset = 0x1c0000 | ||
56 | } | ||
57 | }; | ||
58 | |||
59 | /* | ||
60 | * This is the master MTD device for which all the others are just | ||
61 | * auto-relocating aliases. | ||
62 | */ | ||
63 | static struct mtd_info *mymtd; | ||
64 | |||
65 | static int __init init_pnc2000(void) | ||
66 | { | ||
67 | printk(KERN_NOTICE "Photron PNC-2000 flash mapping: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR); | ||
68 | |||
69 | simple_map_init(&pnc_map); | ||
70 | |||
71 | mymtd = do_map_probe("cfi_probe", &pnc_map); | ||
72 | if (mymtd) { | ||
73 | mymtd->owner = THIS_MODULE; | ||
74 | return add_mtd_partitions(mymtd, pnc_partitions, 3); | ||
75 | } | ||
76 | |||
77 | return -ENXIO; | ||
78 | } | ||
79 | |||
80 | static void __exit cleanup_pnc2000(void) | ||
81 | { | ||
82 | if (mymtd) { | ||
83 | del_mtd_partitions(mymtd); | ||
84 | map_destroy(mymtd); | ||
85 | } | ||
86 | } | ||
87 | |||
88 | module_init(init_pnc2000); | ||
89 | module_exit(cleanup_pnc2000); | ||
90 | |||
91 | MODULE_LICENSE("GPL"); | ||
92 | MODULE_AUTHOR("Crossnet Co. <info@crossnet.co.jp>"); | ||
93 | MODULE_DESCRIPTION("MTD map driver for Photron PNC-2000 board"); | ||
diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c index dcfb85840d1e..0fc5584324e3 100644 --- a/drivers/mtd/maps/scb2_flash.c +++ b/drivers/mtd/maps/scb2_flash.c | |||
@@ -79,7 +79,7 @@ scb2_fixup_mtd(struct mtd_info *mtd) | |||
79 | struct cfi_private *cfi = map->fldrv_priv; | 79 | struct cfi_private *cfi = map->fldrv_priv; |
80 | 80 | ||
81 | /* barf if this doesn't look right */ | 81 | /* barf if this doesn't look right */ |
82 | if (cfi->cfiq->InterfaceDesc != 1) { | 82 | if (cfi->cfiq->InterfaceDesc != CFI_INTERFACE_X16_ASYNC) { |
83 | printk(KERN_ERR MODNAME ": unsupported InterfaceDesc: %#x\n", | 83 | printk(KERN_ERR MODNAME ": unsupported InterfaceDesc: %#x\n", |
84 | cfi->cfiq->InterfaceDesc); | 84 | cfi->cfiq->InterfaceDesc); |
85 | return -1; | 85 | return -1; |