diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 13:07:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 13:07:49 -0400 |
commit | a7c367b95a9d8e65e0f0e7da31f700a556794efb (patch) | |
tree | 5b1bb202801e29e3237381aa7aad5aa288378d5b /drivers/mtd/maps/physmap_of.c | |
parent | 15f964bed054821d6d940d3752508c5f96a9ffd3 (diff) | |
parent | e1070211f7327a1f197d535aa886f721a241c32f (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (58 commits)
mtd: jedec_probe: add PSD4256G6V id
mtd: OneNand support for Nomadik 8815 SoC (on NHK8815 board)
mtd: nand: driver for Nomadik 8815 SoC (on NHK8815 board)
m25p80: Add Spansion S25FL129P serial flashes
jffs2: Use SLAB_HWCACHE_ALIGN for jffs2_raw_{dirent,inode} slabs
mtd: sh_flctl: register sh_flctl using platform_driver_probe()
mtd: nand: txx9ndfmc: transfer 512 byte at a time if possible
mtd: nand: fix tmio_nand ecc correction
mtd: nand: add __nand_correct_data helper function
mtd: cfi_cmdset_0002: add 0xFF intolerance for M29W128G
mtd: inftl: fix fold chain block number
mtd: jedec: fix compilation problem with I28F640C3B definition
mtd: nand: fix ECC Correction bug for SMC ordering for NDFC driver
mtd: ofpart: Check availability of reg property instead of name property
driver/Makefile: Initialize "mtd" and "spi" before "net"
mtd: omap: adding DMA mode support in nand prefetch/post-write
mtd: omap: add support for nand prefetch-read and post-write
mtd: add nand support for w90p910 (v2)
mtd: maps: add mtd-ram support to physmap_of
mtd: pxa3xx_nand: add single-bit error corrections reporting
...
Diffstat (limited to 'drivers/mtd/maps/physmap_of.c')
-rw-r--r-- | drivers/mtd/maps/physmap_of.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c index 39d357b2eb47..61e4eb48bb2d 100644 --- a/drivers/mtd/maps/physmap_of.c +++ b/drivers/mtd/maps/physmap_of.c | |||
@@ -190,6 +190,7 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
190 | const u32 *p; | 190 | const u32 *p; |
191 | int reg_tuple_size; | 191 | int reg_tuple_size; |
192 | struct mtd_info **mtd_list = NULL; | 192 | struct mtd_info **mtd_list = NULL; |
193 | resource_size_t res_size; | ||
193 | 194 | ||
194 | reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32); | 195 | reg_tuple_size = (of_n_addr_cells(dp) + of_n_size_cells(dp)) * sizeof(u32); |
195 | 196 | ||
@@ -204,7 +205,7 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
204 | dev_err(&dev->dev, "Malformed reg property on %s\n", | 205 | dev_err(&dev->dev, "Malformed reg property on %s\n", |
205 | dev->node->full_name); | 206 | dev->node->full_name); |
206 | err = -EINVAL; | 207 | err = -EINVAL; |
207 | goto err_out; | 208 | goto err_flash_remove; |
208 | } | 209 | } |
209 | count /= reg_tuple_size; | 210 | count /= reg_tuple_size; |
210 | 211 | ||
@@ -212,14 +213,14 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
212 | info = kzalloc(sizeof(struct of_flash) + | 213 | info = kzalloc(sizeof(struct of_flash) + |
213 | sizeof(struct of_flash_list) * count, GFP_KERNEL); | 214 | sizeof(struct of_flash_list) * count, GFP_KERNEL); |
214 | if (!info) | 215 | if (!info) |
215 | goto err_out; | 216 | goto err_flash_remove; |
216 | |||
217 | mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); | ||
218 | if (!info) | ||
219 | goto err_out; | ||
220 | 217 | ||
221 | dev_set_drvdata(&dev->dev, info); | 218 | dev_set_drvdata(&dev->dev, info); |
222 | 219 | ||
220 | mtd_list = kzalloc(sizeof(struct mtd_info) * count, GFP_KERNEL); | ||
221 | if (!mtd_list) | ||
222 | goto err_flash_remove; | ||
223 | |||
223 | for (i = 0; i < count; i++) { | 224 | for (i = 0; i < count; i++) { |
224 | err = -ENXIO; | 225 | err = -ENXIO; |
225 | if (of_address_to_resource(dp, i, &res)) { | 226 | if (of_address_to_resource(dp, i, &res)) { |
@@ -233,8 +234,8 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
233 | (unsigned long long)res.end); | 234 | (unsigned long long)res.end); |
234 | 235 | ||
235 | err = -EBUSY; | 236 | err = -EBUSY; |
236 | info->list[i].res = request_mem_region(res.start, res.end - | 237 | res_size = resource_size(&res); |
237 | res.start + 1, | 238 | info->list[i].res = request_mem_region(res.start, res_size, |
238 | dev_name(&dev->dev)); | 239 | dev_name(&dev->dev)); |
239 | if (!info->list[i].res) | 240 | if (!info->list[i].res) |
240 | goto err_out; | 241 | goto err_out; |
@@ -249,7 +250,7 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
249 | 250 | ||
250 | info->list[i].map.name = dev_name(&dev->dev); | 251 | info->list[i].map.name = dev_name(&dev->dev); |
251 | info->list[i].map.phys = res.start; | 252 | info->list[i].map.phys = res.start; |
252 | info->list[i].map.size = res.end - res.start + 1; | 253 | info->list[i].map.size = res_size; |
253 | info->list[i].map.bankwidth = *width; | 254 | info->list[i].map.bankwidth = *width; |
254 | 255 | ||
255 | err = -ENOMEM; | 256 | err = -ENOMEM; |
@@ -338,6 +339,7 @@ static int __devinit of_flash_probe(struct of_device *dev, | |||
338 | 339 | ||
339 | err_out: | 340 | err_out: |
340 | kfree(mtd_list); | 341 | kfree(mtd_list); |
342 | err_flash_remove: | ||
341 | of_flash_remove(dev); | 343 | of_flash_remove(dev); |
342 | 344 | ||
343 | return err; | 345 | return err; |
@@ -360,6 +362,10 @@ static struct of_device_id of_flash_match[] = { | |||
360 | .data = (void *)"jedec_probe", | 362 | .data = (void *)"jedec_probe", |
361 | }, | 363 | }, |
362 | { | 364 | { |
365 | .compatible = "mtd-ram", | ||
366 | .data = (void *)"map_ram", | ||
367 | }, | ||
368 | { | ||
363 | .type = "rom", | 369 | .type = "rom", |
364 | .compatible = "direct-mapped" | 370 | .compatible = "direct-mapped" |
365 | }, | 371 | }, |