aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips/map_ram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/chips/map_ram.c')
-rw-r--r--drivers/mtd/chips/map_ram.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mtd/chips/map_ram.c b/drivers/mtd/chips/map_ram.c
index 072dd8abf33a..6bdc50c727e7 100644
--- a/drivers/mtd/chips/map_ram.c
+++ b/drivers/mtd/chips/map_ram.c
@@ -21,6 +21,8 @@ static int mapram_write (struct mtd_info *, loff_t, size_t, size_t *, const u_ch
21static int mapram_erase (struct mtd_info *, struct erase_info *); 21static int mapram_erase (struct mtd_info *, struct erase_info *);
22static void mapram_nop (struct mtd_info *); 22static void mapram_nop (struct mtd_info *);
23static struct mtd_info *map_ram_probe(struct map_info *map); 23static struct mtd_info *map_ram_probe(struct map_info *map);
24static unsigned long mapram_unmapped_area(struct mtd_info *, unsigned long,
25 unsigned long, unsigned long);
24 26
25 27
26static struct mtd_chip_driver mapram_chipdrv = { 28static struct mtd_chip_driver mapram_chipdrv = {
@@ -64,6 +66,7 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
64 mtd->type = MTD_RAM; 66 mtd->type = MTD_RAM;
65 mtd->size = map->size; 67 mtd->size = map->size;
66 mtd->erase = mapram_erase; 68 mtd->erase = mapram_erase;
69 mtd->get_unmapped_area = mapram_unmapped_area;
67 mtd->read = mapram_read; 70 mtd->read = mapram_read;
68 mtd->write = mapram_write; 71 mtd->write = mapram_write;
69 mtd->sync = mapram_nop; 72 mtd->sync = mapram_nop;
@@ -79,6 +82,20 @@ static struct mtd_info *map_ram_probe(struct map_info *map)
79} 82}
80 83
81 84
85/*
86 * Allow NOMMU mmap() to directly map the device (if not NULL)
87 * - return the address to which the offset maps
88 * - return -ENOSYS to indicate refusal to do the mapping
89 */
90static unsigned long mapram_unmapped_area(struct mtd_info *mtd,
91 unsigned long len,
92 unsigned long offset,
93 unsigned long flags)
94{
95 struct map_info *map = mtd->priv;
96 return (unsigned long) map->virt + offset;
97}
98
82static int mapram_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) 99static int mapram_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
83{ 100{
84 struct map_info *map = mtd->priv; 101 struct map_info *map = mtd->priv;