Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Uwe Kleine-König and committed by
Artem Bityutskiy
81f53ff8 a2f74a7d

+20 -6
+1 -1
drivers/mtd/maps/Kconfig
··· 429 429 430 430 config MTD_UCLINUX 431 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 433 help 434 434 Map driver to support image based filesystems for uClinux. 435 435
+19 -5
drivers/mtd/maps/uclinux.c
··· 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 32 struct map_info uclinux_ram_map = { 27 - .name = "RAM", 28 - .phys = (unsigned long)__bss_stop, 33 + .name = MAP_NAME, 29 34 .size = 0, 30 35 }; 36 + 37 + static unsigned long physaddr = -1; 38 + module_param(physaddr, ulong, S_IRUGO); 31 39 32 40 static struct mtd_info *uclinux_ram_mtdinfo; 33 41 ··· 68 60 struct map_info *mapp; 69 61 70 62 mapp = &uclinux_ram_map; 63 + 64 + if (physaddr == -1) 65 + mapp->phys = (resource_size_t)__bss_stop; 66 + else 67 + mapp->phys = physaddr; 68 + 71 69 if (!mapp->size) 72 70 mapp->size = PAGE_ALIGN(ntohl(*((unsigned long *)(mapp->phys + 8)))); 73 71 mapp->bankwidth = 4; 74 72 75 - printk("uclinux[mtd]: RAM probe address=0x%x size=0x%x\n", 73 + printk("uclinux[mtd]: probe address=0x%x size=0x%x\n", 76 74 (int) mapp->phys, (int) mapp->size); 77 75 78 76 /* ··· 96 82 97 83 simple_map_init(mapp); 98 84 99 - mtd = do_map_probe("map_ram", mapp); 85 + mtd = do_map_probe("map_" MAP_NAME, mapp); 100 86 if (!mtd) { 101 87 printk("uclinux[mtd]: failed to find a mapping?\n"); 102 88 return(-ENXIO); ··· 132 118 133 119 MODULE_LICENSE("GPL"); 134 120 MODULE_AUTHOR("Greg Ungerer <gerg@snapgear.com>"); 135 - MODULE_DESCRIPTION("Generic RAM based MTD for uClinux"); 121 + MODULE_DESCRIPTION("Generic MTD for uClinux"); 136 122 137 123 /****************************************************************************/