diff options
Diffstat (limited to 'drivers/mtd/chips/map_rom.c')
-rw-r--r-- | drivers/mtd/chips/map_rom.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c index c76d6e5f47ee..076090a67b90 100644 --- a/drivers/mtd/chips/map_rom.c +++ b/drivers/mtd/chips/map_rom.c | |||
@@ -20,6 +20,8 @@ static int maprom_write (struct mtd_info *, loff_t, size_t, size_t *, const u_ch | |||
20 | static void maprom_nop (struct mtd_info *); | 20 | static void maprom_nop (struct mtd_info *); |
21 | static struct mtd_info *map_rom_probe(struct map_info *map); | 21 | static struct mtd_info *map_rom_probe(struct map_info *map); |
22 | static int maprom_erase (struct mtd_info *mtd, struct erase_info *info); | 22 | static int maprom_erase (struct mtd_info *mtd, struct erase_info *info); |
23 | static unsigned long maprom_unmapped_area(struct mtd_info *, unsigned long, | ||
24 | unsigned long, unsigned long); | ||
23 | 25 | ||
24 | static struct mtd_chip_driver maprom_chipdrv = { | 26 | static struct mtd_chip_driver maprom_chipdrv = { |
25 | .probe = map_rom_probe, | 27 | .probe = map_rom_probe, |
@@ -40,6 +42,7 @@ static struct mtd_info *map_rom_probe(struct map_info *map) | |||
40 | mtd->name = map->name; | 42 | mtd->name = map->name; |
41 | mtd->type = MTD_ROM; | 43 | mtd->type = MTD_ROM; |
42 | mtd->size = map->size; | 44 | mtd->size = map->size; |
45 | mtd->get_unmapped_area = maprom_unmapped_area; | ||
43 | mtd->read = maprom_read; | 46 | mtd->read = maprom_read; |
44 | mtd->write = maprom_write; | 47 | mtd->write = maprom_write; |
45 | mtd->sync = maprom_nop; | 48 | mtd->sync = maprom_nop; |
@@ -53,6 +56,20 @@ static struct mtd_info *map_rom_probe(struct map_info *map) | |||
53 | } | 56 | } |
54 | 57 | ||
55 | 58 | ||
59 | /* | ||
60 | * Allow NOMMU mmap() to directly map the device (if not NULL) | ||
61 | * - return the address to which the offset maps | ||
62 | * - return -ENOSYS to indicate refusal to do the mapping | ||
63 | */ | ||
64 | static unsigned long maprom_unmapped_area(struct mtd_info *mtd, | ||
65 | unsigned long len, | ||
66 | unsigned long offset, | ||
67 | unsigned long flags) | ||
68 | { | ||
69 | struct map_info *map = mtd->priv; | ||
70 | return (unsigned long) map->virt + offset; | ||
71 | } | ||
72 | |||
56 | static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) | 73 | static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) |
57 | { | 74 | { |
58 | struct map_info *map = mtd->priv; | 75 | struct map_info *map = mtd->priv; |