aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Pitre <nicolas.pitre@linaro.org>2017-10-30 14:48:31 -0400
committerRichard Weinberger <richard@nod.at>2017-11-13 15:39:18 -0500
commit55100cfa339db9c391f8c4667af02a6f7160125b (patch)
tree92ab06525792d163d0776578ba4c6e37a8489b18
parent2caaf2d83a76bc35b4694f48d62ff2cab2d1105d (diff)
mtd: chips/map_rom.c: implement point and unpoint methods
This will allow for the removal of the get_unmapped_area method later. Signed-off-by: Nicolas Pitre <nico@linaro.org> Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Chris Brandt <chris.brandt@renesas.com> [rw: fixed build] Signed-off-by: Richard Weinberger <richard@nod.at>
-rw-r--r--drivers/mtd/chips/map_rom.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/mtd/chips/map_rom.c b/drivers/mtd/chips/map_rom.c
index e67f73ab44c9..72934c1fbbe0 100644
--- a/drivers/mtd/chips/map_rom.c
+++ b/drivers/mtd/chips/map_rom.c
@@ -22,6 +22,10 @@ static struct mtd_info *map_rom_probe(struct map_info *map);
22static int maprom_erase (struct mtd_info *mtd, struct erase_info *info); 22static int maprom_erase (struct mtd_info *mtd, struct erase_info *info);
23static unsigned long maprom_unmapped_area(struct mtd_info *, unsigned long, 23static unsigned long maprom_unmapped_area(struct mtd_info *, unsigned long,
24 unsigned long, unsigned long); 24 unsigned long, unsigned long);
25static int maprom_point (struct mtd_info *mtd, loff_t from, size_t len,
26 size_t *retlen, void **virt, resource_size_t *phys);
27static int maprom_unpoint(struct mtd_info *mtd, loff_t from, size_t len);
28
25 29
26static struct mtd_chip_driver maprom_chipdrv = { 30static struct mtd_chip_driver maprom_chipdrv = {
27 .probe = map_rom_probe, 31 .probe = map_rom_probe,
@@ -52,6 +56,8 @@ static struct mtd_info *map_rom_probe(struct map_info *map)
52 mtd->type = MTD_ROM; 56 mtd->type = MTD_ROM;
53 mtd->size = map->size; 57 mtd->size = map->size;
54 mtd->_get_unmapped_area = maprom_unmapped_area; 58 mtd->_get_unmapped_area = maprom_unmapped_area;
59 mtd->_point = maprom_point;
60 mtd->_unpoint = maprom_unpoint;
55 mtd->_read = maprom_read; 61 mtd->_read = maprom_read;
56 mtd->_write = maprom_write; 62 mtd->_write = maprom_write;
57 mtd->_sync = maprom_nop; 63 mtd->_sync = maprom_nop;
@@ -80,6 +86,25 @@ static unsigned long maprom_unmapped_area(struct mtd_info *mtd,
80 return (unsigned long) map->virt + offset; 86 return (unsigned long) map->virt + offset;
81} 87}
82 88
89static int maprom_point(struct mtd_info *mtd, loff_t from, size_t len,
90 size_t *retlen, void **virt, resource_size_t *phys)
91{
92 struct map_info *map = mtd->priv;
93
94 if (!map->virt)
95 return -EINVAL;
96 *virt = map->virt + from;
97 if (phys)
98 *phys = map->phys + from;
99 *retlen = len;
100 return 0;
101}
102
103static int maprom_unpoint(struct mtd_info *mtd, loff_t from, size_t len)
104{
105 return 0;
106}
107
83static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf) 108static int maprom_read (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf)
84{ 109{
85 struct map_info *map = mtd->priv; 110 struct map_info *map = mtd->priv;