diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2013-01-16 09:36:55 -0500 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2013-02-04 02:26:30 -0500 |
commit | 81f53ff89c136b72fc35a91d676aca2bc332bd33 (patch) | |
tree | 7e97e966560c5dfb0bf181872cc7969e1e8e2259 /drivers/mtd | |
parent | a2f74a7dacc1c17a0b146eb3112217874c5db436 (diff) |
mtd: uclinux: support ROM and allow passing the base address
This allows to put the filesystem at a defined address in ROM allowing
to save more precious RAM.
I think it's safe to default to ROM because the intention of using the
uclinux map is to use a romfs and so mtd-ram doesn't give you anything
that mtd-rom doesn't.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/Kconfig | 2 | ||||
-rw-r--r-- | drivers/mtd/maps/uclinux.c | 24 |
2 files changed, 20 insertions, 6 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 | ||
430 | config MTD_UCLINUX | 430 | config 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/uclinux.c b/drivers/mtd/maps/uclinux.c index 299bf88a6f41..f56d0aa4404b 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c | |||
@@ -23,12 +23,20 @@ | |||
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 | |||
26 | struct map_info uclinux_ram_map = { | 32 | struct map_info uclinux_ram_map = { |
27 | .name = "RAM", | 33 | .name = MAP_NAME, |
28 | .phys = (unsigned long)__bss_stop, | ||
29 | .size = 0, | 34 | .size = 0, |
30 | }; | 35 | }; |
31 | 36 | ||
37 | static unsigned long physaddr = -1; | ||
38 | module_param(physaddr, ulong, S_IRUGO); | ||
39 | |||
32 | static struct mtd_info *uclinux_ram_mtdinfo; | 40 | static struct mtd_info *uclinux_ram_mtdinfo; |
33 | 41 | ||
34 | /****************************************************************************/ | 42 | /****************************************************************************/ |
@@ -60,11 +68,17 @@ static int __init uclinux_mtd_init(void) | |||
60 | struct map_info *mapp; | 68 | struct map_info *mapp; |
61 | 69 | ||
62 | mapp = &uclinux_ram_map; | 70 | mapp = &uclinux_ram_map; |
71 | |||
72 | if (physaddr == -1) | ||
73 | mapp->phys = (resource_size_t)__bss_stop; | ||
74 | else | ||
75 | mapp->phys = physaddr; | ||
76 | |||
63 | if (!mapp->size) | 77 | if (!mapp->size) |
64 | mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8)))); | 78 | mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8)))); |
65 | mapp->bankwidth = 4; | 79 | mapp->bankwidth = 4; |
66 | 80 | ||
67 | printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", | 81 | printk("uclinux[mtd]: probe address=0x%x size=0x%x\n", |
68 | (int) mapp->phys, (int) mapp->size); | 82 | (int) mapp->phys, (int) mapp->size); |
69 | 83 | ||
70 | /* | 84 | /* |
@@ -82,7 +96,7 @@ static int __init uclinux_mtd_init(void) | |||
82 | 96 | ||
83 | simple_map_init(mapp); | 97 | simple_map_init(mapp); |
84 | 98 | ||
85 | mtd = do_map_probe("map_ram", mapp); | 99 | mtd = do_map_probe("map_" MAP_NAME, mapp); |
86 | if (!mtd) { | 100 | if (!mtd) { |
87 | printk("uclinux[mtd]: failed to find a mapping?\n"); | 101 | printk("uclinux[mtd]: failed to find a mapping?\n"); |
88 | return(-ENXIO); | 102 | return(-ENXIO); |
@@ -118,6 +132,6 @@ module_exit(uclinux_mtd_cleanup); | |||
118 | 132 | ||
119 | MODULE_LICENSE("GPL"); | 133 | MODULE_LICENSE("GPL"); |
120 | MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); | 134 | MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); |
121 | MODULE_DESCRIPTION("Generic RAM based MTD for uClinux"); | 135 | MODULE_DESCRIPTION("Generic MTD for uClinux"); |
122 | 136 | ||
123 | /****************************************************************************/ | 137 | /****************************************************************************/ |