Commit 81f53ff8 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Artem Bityutskiy

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: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarGreg Ungerer <gerg@uclinux.org>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
parent a2f74a7d
...@@ -429,7 +429,7 @@ config MTD_GPIO_ADDR ...@@ -429,7 +429,7 @@ config MTD_GPIO_ADDR
config MTD_UCLINUX config MTD_UCLINUX
bool "Generic uClinux RAM/ROM filesystem support" bool "Generic uClinux RAM/ROM filesystem support"
depends on MTD_RAM=y && (!MMU || COLDFIRE) depends on (MTD_RAM=y || MTD_ROM=y) && (!MMU || COLDFIRE)
help help
Map driver to support image based filesystems for uClinux. Map driver to support image based filesystems for uClinux.
......
...@@ -23,12 +23,20 @@ ...@@ -23,12 +23,20 @@
/****************************************************************************/ /****************************************************************************/
#ifdef CONFIG_MTD_ROM
#define MAP_NAME "rom"
#else
#define MAP_NAME "ram"
#endif
struct map_info uclinux_ram_map = { struct map_info uclinux_ram_map = {
.name = "RAM", .name = MAP_NAME,
.phys = (unsigned long)__bss_stop,
.size = 0, .size = 0,
}; };
static unsigned long physaddr = -1;
module_param(physaddr, ulong, S_IRUGO);
static struct mtd_info *uclinux_ram_mtdinfo; static struct mtd_info *uclinux_ram_mtdinfo;
/****************************************************************************/ /****************************************************************************/
...@@ -60,11 +68,17 @@ static int __init uclinux_mtd_init(void) ...@@ -60,11 +68,17 @@ static int __init uclinux_mtd_init(void)
struct map_info *mapp; struct map_info *mapp;
mapp = &uclinux_ram_map; mapp = &uclinux_ram_map;
if (physaddr == -1)
mapp->phys = (resource_size_t)__bss_stop;
else
mapp->phys = physaddr;
if (!mapp->size) if (!mapp->size)
mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8)))); mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8))));
mapp->bankwidth = 4; mapp->bankwidth = 4;
printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", printk("uclinux[mtd]: probe address=0x%x size=0x%x\n",
(int) mapp->phys, (int) mapp->size); (int) mapp->phys, (int) mapp->size);
/* /*
...@@ -82,7 +96,7 @@ static int __init uclinux_mtd_init(void) ...@@ -82,7 +96,7 @@ static int __init uclinux_mtd_init(void)
simple_map_init(mapp); simple_map_init(mapp);
mtd = do_map_probe("map_ram", mapp); mtd = do_map_probe("map_" MAP_NAME, mapp);
if (!mtd) { if (!mtd) {
printk("uclinux[mtd]: failed to find a mapping?\n"); printk("uclinux[mtd]: failed to find a mapping?\n");
return(-ENXIO); return(-ENXIO);
...@@ -118,6 +132,6 @@ module_exit(uclinux_mtd_cleanup); ...@@ -118,6 +132,6 @@ module_exit(uclinux_mtd_cleanup);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>");
MODULE_DESCRIPTION("Generic RAM based MTD for uClinux"); MODULE_DESCRIPTION("Generic MTD for uClinux");
/****************************************************************************/ /****************************************************************************/
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment