aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/maps
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-03-02 19:33:54 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-03-02 19:33:54 -0500
commit48476df99894492a0f7239f2f3c9a2dde4ff38e2 (patch)
tree5a1b80f20449968f0de6e5bfbcda5e360e31ba1f /drivers/mtd/maps
parent37cae6ad4c484030fa972241533c32730ec79b7d (diff)
parent24dea0c9feccf699749f860fa2f4ccd84d30390d (diff)
Merge tag 'for-linus-20130301' of git://git.infradead.org/linux-mtd
Pull MTD update from David Woodhouse: "Fairly unexciting MTD merge for 3.9: - misc clean-ups in the MTD command-line partitioning parser (cmdlinepart) - add flash locking support for STmicro chips serial flash chips, as well as for CFI command set 2 chips. - new driver for the ELM error correction HW module found in various TI chips, enable the OMAP NAND driver to use the ELM HW error correction - added number of new serial flash IDs - various fixes and improvements in the gpmi NAND driver - bcm47xx NAND driver improvements - make the mtdpart module actually removable" * tag 'for-linus-20130301' of git://git.infradead.org/linux-mtd: (45 commits) mtd: map: BUG() in non handled cases mtd: bcm47xxnflash: use pr_fmt for module prefix in messages mtd: davinci_nand: Use managed resources mtd: mtd_torturetest can cause stack overflows mtd: physmap_of: Convert device allocation to managed devm_kzalloc() mtd: at91: atmel_nand: for PMECC, add code to check the ONFI parameter ECC requirement. mtd: atmel_nand: make pmecc-cap, pmecc-sector-size in dts is optional. mtd: atmel_nand: avoid to report an error when lookup table offset is 0. mtd: bcm47xxsflash: adjust names of bus-specific functions mtd: bcm47xxpart: improve probing of nvram partition mtd: bcm47xxpart: add support for other erase sizes mtd: bcm47xxnflash: register this as normal driver mtd: bcm47xxnflash: fix message mtd: bcm47xxsflash: register this as normal driver mtd: bcm47xxsflash: write number of written bytes mtd: gpmi: add sanity check for the ECC mtd: gpmi: set the Golois Field bit for mx6q's BCH mtd: devices: elm: Removes <xx> literals in elm DT node mtd: gpmi: fix a dereferencing freed memory error mtd: fix the wrong timeo for panic_nand_wait() ...
Diffstat (limited to 'drivers/mtd/maps')
-rw-r--r--drivers/mtd/maps/Kconfig2
-rw-r--r--drivers/mtd/maps/physmap_of.c9
-rw-r--r--drivers/mtd/maps/uclinux.c30
3 files changed, 30 insertions, 11 deletions
diff --git a/drivers/mtd/maps/Kconfig b/drivers/mtd/maps/Kconfig
index 62ba82c396c2..3ed17c4d4358 100644
--- a/drivers/mtd/maps/Kconfig
+++ b/drivers/mtd/maps/Kconfig
@@ -429,7 +429,7 @@ config MTD_GPIO_ADDR
429 429
430config MTD_UCLINUX 430config MTD_UCLINUX
431 bool "Generic uClinux RAM/ROM filesystem support" 431 bool "Generic uClinux RAM/ROM filesystem support"
432 depends on MTD_RAM=y && (!MMU || COLDFIRE) 432 depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
433 help 433 help
434 Map driver to support image based filesystems for uClinux. 434 Map driver to support image based filesystems for uClinux.
435 435
diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 7901d72c9242..363939dfad05 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -68,9 +68,6 @@ static int of_flash_remove(struct platform_device *dev)
68 kfree(info->list[i].res); 68 kfree(info->list[i].res);
69 } 69 }
70 } 70 }
71
72 kfree(info);
73
74 return 0; 71 return 0;
75} 72}
76 73
@@ -199,8 +196,9 @@ static int of_flash_probe(struct platform_device *dev)
199 map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access"); 196 map_indirect = of_property_read_bool(dp, "no-unaligned-direct-access");
200 197
201 err = -ENOMEM; 198 err = -ENOMEM;
202 info = kzalloc(sizeof(struct of_flash) + 199 info = devm_kzalloc(&dev->dev,
203 sizeof(struct of_flash_list) * count, GFP_KERNEL); 200 sizeof(struct of_flash) +
201 sizeof(struct of_flash_list) * count, GFP_KERNEL);
204 if (!info) 202 if (!info)
205 goto err_flash_remove; 203 goto err_flash_remove;
206 204
@@ -241,6 +239,7 @@ static int of_flash_probe(struct platform_device *dev)
241 info->list[i].map.phys = res.start; 239 info->list[i].map.phys = res.start;
242 info->list[i].map.size = res_size; 240 info->list[i].map.size = res_size;
243 info->list[i].map.bankwidth = be32_to_cpup(width); 241 info->list[i].map.bankwidth = be32_to_cpup(width);
242 info->list[i].map.device_node = dp;
244 243
245 err = -ENOMEM; 244 err = -ENOMEM;
246 info->list[i].map.virt = ioremap(info->list[i].map.phys, 245 info->list[i].map.virt = ioremap(info->list[i].map.phys,
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c
index 299bf88a6f41..c1af83db5202 100644
--- a/drivers/mtd/maps/uclinux.c
+++ b/drivers/mtd/maps/uclinux.c
@@ -23,12 +23,26 @@
23 23
24/****************************************************************************/ 24/****************************************************************************/
25 25
26#ifdef CONFIG_MTD_ROM
27#define MAP_NAME "rom"
28#else
29#define MAP_NAME "ram"
30#endif
31
32/*
33 * Blackfin uses uclinux_ram_map during startup, so it must not be static.
34 * Provide a dummy declaration to make sparse happy.
35 */
36extern struct map_info uclinux_ram_map;
37
26struct map_info uclinux_ram_map = { 38struct map_info uclinux_ram_map = {
27 .name = "RAM", 39 .name = MAP_NAME,
28 .phys = (unsigned long)__bss_stop,
29 .size = 0, 40 .size = 0,
30}; 41};
31 42
43static unsigned long physaddr = -1;
44module_param(physaddr, ulong, S_IRUGO);
45
32static struct mtd_info *uclinux_ram_mtdinfo; 46static struct mtd_info *uclinux_ram_mtdinfo;
33 47
34/****************************************************************************/ 48/****************************************************************************/
@@ -60,11 +74,17 @@ static int __init uclinux_mtd_init(void)
60 struct map_info *mapp; 74 struct map_info *mapp;
61 75
62 mapp = &uclinux_ram_map; 76 mapp = &uclinux_ram_map;
77
78 if (physaddr == -1)
79 mapp->phys = (resource_size_t)__bss_stop;
80 else
81 mapp->phys = physaddr;
82
63 if (!mapp->size) 83 if (!mapp->size)
64 mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8)))); 84 mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
65 mapp->bankwidth = 4; 85 mapp->bankwidth = 4;
66 86
67 printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", 87 printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
68 (int) mapp->phys, (int) mapp->size); 88 (int) mapp->phys, (int) mapp->size);
69 89
70 /* 90 /*
@@ -82,7 +102,7 @@ static int __init uclinux_mtd_init(void)
82 102
83 simple_map_init(mapp); 103 simple_map_init(mapp);
84 104
85 mtd = do_map_probe("map_ram", mapp); 105 mtd = do_map_probe("map_" MAP_NAME, mapp);
86 if (!mtd) { 106 if (!mtd) {
87 printk("uclinux[mtd]: failed to find a mapping?\n"); 107 printk("uclinux[mtd]: failed to find a mapping?\n");
88 return(-ENXIO); 108 return(-ENXIO);
@@ -118,6 +138,6 @@ module_exit(uclinux_mtd_cleanup);
118 138
119MODULE_LICENSE("GPL"); 139MODULE_LICENSE("GPL");
120MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); 140MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
121MODULE_DESCRIPTION("Generic RAM based MTD for uClinux"); 141MODULE_DESCRIPTION("Generic MTD for uClinux");
122 142
123/****************************************************************************/ 143/****************************************************************************/