diff -urN kernel-2.4.18.orig/include/linux/mtd/mtd.h kernel-2.4.18/include/linux/mtd/mtd.h --- kernel-2.4.18.orig/include/linux/mtd/mtd.h Tue Jun 12 18:30:27 2001 +++ kernel-2.4.18/include/linux/mtd/mtd.h Wed Nov 6 14:05:30 2002 @@ -39,5 +39,6 @@ #define MTD_NORFLASH 3 #define MTD_NANDFLASH 4 #define MTD_PEROM 5 +#define MTD_SRAM 6 #define MTD_OTHER 14 #define MTD_UNKNOWN 15 diff -urN kernel-2.4.18.orig/drivers/mtd/chips/Config.in kernel-2.4.18/drivers/mtd/chips/Config.in --- kernel-2.4.18.orig/drivers/mtd/chips/Config.in Thu Oct 4 23:13:18 2001 +++ kernel-2.4.18/drivers/mtd/chips/Config.in Tue Nov 12 10:29:27 2002 @@ -44,7 +44,7 @@ dep_tristate ' Support for Intel/Sharp flash chips' CONFIG_MTD_CFI_INTELEXT $CONFIG_MTD_GEN_PROBE dep_tristate ' Support for AMD/Fujitsu flash chips' CONFIG_MTD_CFI_AMDSTD $CONFIG_MTD_GEN_PROBE -dep_tristate ' Support for RAM chips in bus mapping' CONFIG_MTD_RAM $CONFIG_MTD +dep_tristate ' Support for RAM/SRAM chips in bus mapping' CONFIG_MTD_RAM $CONFIG_MTD dep_tristate ' Support for ROM chips in bus mapping' CONFIG_MTD_ROM $CONFIG_MTD dep_tristate ' Support for absent chips in bus mapping' CONFIG_MTD_ABSENT $CONFIG_MTD diff -urN kernel-2.4.18.orig/drivers/mtd/chips/map_ram.c kernel-2.4.18/drivers/mtd/chips/map_ram.c --- kernel-2.4.18.orig/drivers/mtd/chips/map_ram.c Thu Oct 4 23:14:59 2001 +++ kernel-2.4.18/drivers/mtd/chips/map_ram.c Tue Nov 12 10:52:11 2002 @@ -20,6 +20,7 @@ static int mapram_erase (struct mtd_info *, struct erase_info *); static void mapram_nop (struct mtd_info *); static struct mtd_info *map_ram_probe(struct map_info *map); +static struct mtd_info *map_sram_probe(struct map_info *map); static struct mtd_chip_driver mapram_chipdrv = { @@ -27,6 +28,11 @@ name: "map_ram", module: THIS_MODULE }; +static struct mtd_chip_driver mapsram_chipdrv = { + probe: map_sram_probe, + name: "map_sram", + module: THIS_MODULE +}; static struct mtd_info *map_ram_probe(struct map_info *map) { @@ -78,6 +84,34 @@ return mtd; } +static struct mtd_info *map_sram_probe(struct map_info *map) +{ + struct mtd_info *mtd; + + mtd = kmalloc(sizeof(*mtd), GFP_KERNEL); + if (!mtd) + return NULL; + + memset(mtd, 0, sizeof(*mtd)); + + map->fldrv = &mapram_chipdrv; + mtd->priv = map; + mtd->name = map->name; + mtd->type = MTD_SRAM; + mtd->size = map->size; + mtd->erase = mapram_erase; + mtd->read = mapram_read; + mtd->write = mapram_write; + mtd->sync = mapram_nop; + mtd->flags = MTD_CAP_RAM; + + mtd->erasesize = PAGE_SIZE; + while(mtd->size & (mtd->erasesize - 1)) + mtd->erasesize >>= 1; + + MOD_INC_USE_COUNT; + return mtd; +} static int mapram_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) { @@ -107,6 +141,8 @@ for (i=0; ilen; i++) map->write8(map, 0xFF, instr->addr + i); + instr->state = MTD_ERASE_DONE; + if (instr->callback) instr->callback(instr); @@ -121,12 +157,14 @@ int __init map_ram_init(void) { register_mtd_chip_driver(&mapram_chipdrv); + register_mtd_chip_driver(&mapsram_chipdrv); return 0; } static void __exit map_ram_exit(void) { unregister_mtd_chip_driver(&mapram_chipdrv); + unregister_mtd_chip_driver(&mapsram_chipdrv); } module_init(map_ram_init);