diff options
Diffstat (limited to 'drivers/mtd/chips/map_ram.c')
-rw-r--r-- | drivers/mtd/chips/map_ram.c | 17 |
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 | |||
21 | static int mapram_erase (struct mtd_info *, struct erase_info *); | 21 | static int mapram_erase (struct mtd_info *, struct erase_info *); |
22 | static void mapram_nop (struct mtd_info *); | 22 | static void mapram_nop (struct mtd_info *); |
23 | static struct mtd_info *map_ram_probe(struct map_info *map); | 23 | static struct mtd_info *map_ram_probe(struct map_info *map); |
24 | static unsigned long mapram_unmapped_area(struct mtd_info *, unsigned long, | ||
25 | unsigned long, unsigned long); | ||
24 | 26 | ||
25 | 27 | ||
26 | static struct mtd_chip_driver mapram_chipdrv = { | 28 | static 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 | */ | ||
90 | static 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 | |||
82 | static int mapram_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) | 99 | static 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; |