diff options
author | Jared Hulbert <jaredeh@gmail.com> | 2008-04-30 02:26:49 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2008-05-01 13:59:11 -0400 |
commit | a98889f3d8882995b5aa2255b931cf0202325cc0 (patch) | |
tree | 686a1d3369143dc46c43709e0c40b2cc8ef619d7 | |
parent | 27c72b040c0be8f3704ed0b6b84c12cbba24a7e8 (diff) |
[MTD][NOR] Add physical address to point() method
Adding the ability to get a physical address from point() in addition
to virtual address. This physical address is required for XIP of
userspace code from flash.
Signed-off-by: Jared Hulbert <jaredeh@gmail.com>
Reviewed-by: Jörn Engel <joern@logfs.org>
Acked-by: Nicolas Pitre <nico@cam.org>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 14 | ||||
-rw-r--r-- | drivers/mtd/devices/mtdram.c | 11 | ||||
-rw-r--r-- | drivers/mtd/devices/phram.c | 13 | ||||
-rw-r--r-- | drivers/mtd/devices/pmc551.c | 27 | ||||
-rw-r--r-- | drivers/mtd/devices/slram.c | 15 | ||||
-rw-r--r-- | drivers/mtd/maps/uclinux.c | 6 | ||||
-rw-r--r-- | drivers/mtd/mtdpart.c | 8 | ||||
-rw-r--r-- | fs/jffs2/erase.c | 7 | ||||
-rw-r--r-- | fs/jffs2/readinode.c | 9 | ||||
-rw-r--r-- | fs/jffs2/scan.c | 7 | ||||
-rw-r--r-- | include/linux/mtd/mtd.h | 6 | ||||
-rw-r--r-- | include/linux/mtd/pmc551.h | 5 |
12 files changed, 77 insertions, 51 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index e812df607a5c..fcd1aeccdf93 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -82,9 +82,8 @@ static struct mtd_info *cfi_intelext_setup (struct mtd_info *); | |||
82 | static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); | 82 | static int cfi_intelext_partition_fixup(struct mtd_info *, struct cfi_private **); |
83 | 83 | ||
84 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, | 84 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, |
85 | size_t *retlen, u_char **mtdbuf); | 85 | size_t *retlen, void **virt, resource_size_t *phys); |
86 | static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, | 86 | static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len); |
87 | size_t len); | ||
88 | 87 | ||
89 | static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); | 88 | static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long adr, int mode); |
90 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); | 89 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode); |
@@ -1240,7 +1239,8 @@ static int do_point_onechip (struct map_info *map, struct flchip *chip, loff_t a | |||
1240 | return ret; | 1239 | return ret; |
1241 | } | 1240 | } |
1242 | 1241 | ||
1243 | static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf) | 1242 | static int cfi_intelext_point(struct mtd_info *mtd, loff_t from, size_t len, |
1243 | size_t *retlen, void **virt, resource_size_t *phys) | ||
1244 | { | 1244 | { |
1245 | struct map_info *map = mtd->priv; | 1245 | struct map_info *map = mtd->priv; |
1246 | struct cfi_private *cfi = map->fldrv_priv; | 1246 | struct cfi_private *cfi = map->fldrv_priv; |
@@ -1257,8 +1257,10 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si | |||
1257 | chipnum = (from >> cfi->chipshift); | 1257 | chipnum = (from >> cfi->chipshift); |
1258 | ofs = from - (chipnum << cfi->chipshift); | 1258 | ofs = from - (chipnum << cfi->chipshift); |
1259 | 1259 | ||
1260 | *mtdbuf = (void *)map->virt + cfi->chips[chipnum].start + ofs; | 1260 | *virt = map->virt + cfi->chips[chipnum].start + ofs; |
1261 | *retlen = 0; | 1261 | *retlen = 0; |
1262 | if (phys) | ||
1263 | *phys = map->phys + cfi->chips[chipnum].start + ofs; | ||
1262 | 1264 | ||
1263 | while (len) { | 1265 | while (len) { |
1264 | unsigned long thislen; | 1266 | unsigned long thislen; |
@@ -1291,7 +1293,7 @@ static int cfi_intelext_point (struct mtd_info *mtd, loff_t from, size_t len, si | |||
1291 | return 0; | 1293 | return 0; |
1292 | } | 1294 | } |
1293 | 1295 | ||
1294 | static void cfi_intelext_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 1296 | static void cfi_intelext_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
1295 | { | 1297 | { |
1296 | struct map_info *map = mtd->priv; | 1298 | struct map_info *map = mtd->priv; |
1297 | struct cfi_private *cfi = map->fldrv_priv; | 1299 | struct cfi_private *cfi = map->fldrv_priv; |
diff --git a/drivers/mtd/devices/mtdram.c b/drivers/mtd/devices/mtdram.c index bf485ff49457..0399be178620 100644 --- a/drivers/mtd/devices/mtdram.c +++ b/drivers/mtd/devices/mtdram.c | |||
@@ -48,18 +48,21 @@ static int ram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
48 | } | 48 | } |
49 | 49 | ||
50 | static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, | 50 | static int ram_point(struct mtd_info *mtd, loff_t from, size_t len, |
51 | size_t *retlen, u_char **mtdbuf) | 51 | size_t *retlen, void **virt, resource_size_t *phys) |
52 | { | 52 | { |
53 | if (from + len > mtd->size) | 53 | if (from + len > mtd->size) |
54 | return -EINVAL; | 54 | return -EINVAL; |
55 | 55 | ||
56 | *mtdbuf = mtd->priv + from; | 56 | /* can we return a physical address with this driver? */ |
57 | if (phys) | ||
58 | return -EINVAL; | ||
59 | |||
60 | *virt = mtd->priv + from; | ||
57 | *retlen = len; | 61 | *retlen = len; |
58 | return 0; | 62 | return 0; |
59 | } | 63 | } |
60 | 64 | ||
61 | static void ram_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, | 65 | static void ram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
62 | size_t len) | ||
63 | { | 66 | { |
64 | } | 67 | } |
65 | 68 | ||
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 5f960182da95..c7987b1c5e01 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c | |||
@@ -57,20 +57,21 @@ static int phram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
57 | } | 57 | } |
58 | 58 | ||
59 | static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, | 59 | static int phram_point(struct mtd_info *mtd, loff_t from, size_t len, |
60 | size_t *retlen, u_char **mtdbuf) | 60 | size_t *retlen, void **virt, resource_size_t *phys) |
61 | { | 61 | { |
62 | u_char *start = mtd->priv; | ||
63 | |||
64 | if (from + len > mtd->size) | 62 | if (from + len > mtd->size) |
65 | return -EINVAL; | 63 | return -EINVAL; |
66 | 64 | ||
67 | *mtdbuf = start + from; | 65 | /* can we return a physical address with this driver? */ |
66 | if (phys) | ||
67 | return -EINVAL; | ||
68 | |||
69 | *virt = mtd->priv + from; | ||
68 | *retlen = len; | 70 | *retlen = len; |
69 | return 0; | 71 | return 0; |
70 | } | 72 | } |
71 | 73 | ||
72 | static void phram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, | 74 | static void phram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
73 | size_t len) | ||
74 | { | 75 | { |
75 | } | 76 | } |
76 | 77 | ||
diff --git a/drivers/mtd/devices/pmc551.c b/drivers/mtd/devices/pmc551.c index 7060a0895ce2..bc9981749064 100644 --- a/drivers/mtd/devices/pmc551.c +++ b/drivers/mtd/devices/pmc551.c | |||
@@ -134,7 +134,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
134 | eoff_lo = end & (priv->asize - 1); | 134 | eoff_lo = end & (priv->asize - 1); |
135 | soff_lo = instr->addr & (priv->asize - 1); | 135 | soff_lo = instr->addr & (priv->asize - 1); |
136 | 136 | ||
137 | pmc551_point(mtd, instr->addr, instr->len, &retlen, &ptr); | 137 | pmc551_point(mtd, instr->addr, instr->len, &retlen, |
138 | (void **)&ptr, NULL); | ||
138 | 139 | ||
139 | if (soff_hi == eoff_hi || mtd->size == priv->asize) { | 140 | if (soff_hi == eoff_hi || mtd->size == priv->asize) { |
140 | /* The whole thing fits within one access, so just one shot | 141 | /* The whole thing fits within one access, so just one shot |
@@ -154,7 +155,8 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
154 | } | 155 | } |
155 | soff_hi += priv->asize; | 156 | soff_hi += priv->asize; |
156 | pmc551_point(mtd, (priv->base_map0 | soff_hi), | 157 | pmc551_point(mtd, (priv->base_map0 | soff_hi), |
157 | priv->asize, &retlen, &ptr); | 158 | priv->asize, &retlen, |
159 | (void **)&ptr, NULL); | ||
158 | } | 160 | } |
159 | memset(ptr, 0xff, eoff_lo); | 161 | memset(ptr, 0xff, eoff_lo); |
160 | } | 162 | } |
@@ -170,7 +172,7 @@ static int pmc551_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
170 | } | 172 | } |
171 | 173 | ||
172 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | 174 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, |
173 | size_t * retlen, u_char ** mtdbuf) | 175 | size_t *retlen, void **virt, resource_size_t *phys) |
174 | { | 176 | { |
175 | struct mypriv *priv = mtd->priv; | 177 | struct mypriv *priv = mtd->priv; |
176 | u32 soff_hi; | 178 | u32 soff_hi; |
@@ -188,6 +190,10 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
188 | return -EINVAL; | 190 | return -EINVAL; |
189 | } | 191 | } |
190 | 192 | ||
193 | /* can we return a physical address with this driver? */ | ||
194 | if (phys) | ||
195 | return -EINVAL; | ||
196 | |||
191 | soff_hi = from & ~(priv->asize - 1); | 197 | soff_hi = from & ~(priv->asize - 1); |
192 | soff_lo = from & (priv->asize - 1); | 198 | soff_lo = from & (priv->asize - 1); |
193 | 199 | ||
@@ -198,13 +204,12 @@ static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, | |||
198 | priv->curr_map0 = soff_hi; | 204 | priv->curr_map0 = soff_hi; |
199 | } | 205 | } |
200 | 206 | ||
201 | *mtdbuf = priv->start + soff_lo; | 207 | *virt = priv->start + soff_lo; |
202 | *retlen = len; | 208 | *retlen = len; |
203 | return 0; | 209 | return 0; |
204 | } | 210 | } |
205 | 211 | ||
206 | static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, | 212 | static void pmc551_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
207 | size_t len) | ||
208 | { | 213 | { |
209 | #ifdef CONFIG_MTD_PMC551_DEBUG | 214 | #ifdef CONFIG_MTD_PMC551_DEBUG |
210 | printk(KERN_DEBUG "pmc551_unpoint()\n"); | 215 | printk(KERN_DEBUG "pmc551_unpoint()\n"); |
@@ -242,7 +247,7 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
242 | soff_lo = from & (priv->asize - 1); | 247 | soff_lo = from & (priv->asize - 1); |
243 | eoff_lo = end & (priv->asize - 1); | 248 | eoff_lo = end & (priv->asize - 1); |
244 | 249 | ||
245 | pmc551_point(mtd, from, len, retlen, &ptr); | 250 | pmc551_point(mtd, from, len, retlen, (void **)&ptr, NULL); |
246 | 251 | ||
247 | if (soff_hi == eoff_hi) { | 252 | if (soff_hi == eoff_hi) { |
248 | /* The whole thing fits within one access, so just one shot | 253 | /* The whole thing fits within one access, so just one shot |
@@ -263,7 +268,8 @@ static int pmc551_read(struct mtd_info *mtd, loff_t from, size_t len, | |||
263 | goto out; | 268 | goto out; |
264 | } | 269 | } |
265 | soff_hi += priv->asize; | 270 | soff_hi += priv->asize; |
266 | pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); | 271 | pmc551_point(mtd, soff_hi, priv->asize, retlen, |
272 | (void **)&ptr, NULL); | ||
267 | } | 273 | } |
268 | memcpy(copyto, ptr, eoff_lo); | 274 | memcpy(copyto, ptr, eoff_lo); |
269 | copyto += eoff_lo; | 275 | copyto += eoff_lo; |
@@ -308,7 +314,7 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
308 | soff_lo = to & (priv->asize - 1); | 314 | soff_lo = to & (priv->asize - 1); |
309 | eoff_lo = end & (priv->asize - 1); | 315 | eoff_lo = end & (priv->asize - 1); |
310 | 316 | ||
311 | pmc551_point(mtd, to, len, retlen, &ptr); | 317 | pmc551_point(mtd, to, len, retlen, (void **)&ptr, NULL); |
312 | 318 | ||
313 | if (soff_hi == eoff_hi) { | 319 | if (soff_hi == eoff_hi) { |
314 | /* The whole thing fits within one access, so just one shot | 320 | /* The whole thing fits within one access, so just one shot |
@@ -329,7 +335,8 @@ static int pmc551_write(struct mtd_info *mtd, loff_t to, size_t len, | |||
329 | goto out; | 335 | goto out; |
330 | } | 336 | } |
331 | soff_hi += priv->asize; | 337 | soff_hi += priv->asize; |
332 | pmc551_point(mtd, soff_hi, priv->asize, retlen, &ptr); | 338 | pmc551_point(mtd, soff_hi, priv->asize, retlen, |
339 | (void **)&ptr, NULL); | ||
333 | } | 340 | } |
334 | memcpy(ptr, copyfrom, eoff_lo); | 341 | memcpy(ptr, copyfrom, eoff_lo); |
335 | copyfrom += eoff_lo; | 342 | copyfrom += eoff_lo; |
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c index d293add1857c..cb86db746f28 100644 --- a/drivers/mtd/devices/slram.c +++ b/drivers/mtd/devices/slram.c | |||
@@ -76,8 +76,9 @@ static char *map; | |||
76 | static slram_mtd_list_t *slram_mtdlist = NULL; | 76 | static slram_mtd_list_t *slram_mtdlist = NULL; |
77 | 77 | ||
78 | static int slram_erase(struct mtd_info *, struct erase_info *); | 78 | static int slram_erase(struct mtd_info *, struct erase_info *); |
79 | static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, u_char **); | 79 | static int slram_point(struct mtd_info *, loff_t, size_t, size_t *, void **, |
80 | static void slram_unpoint(struct mtd_info *, u_char *, loff_t, size_t); | 80 | resource_size_t *); |
81 | static void slram_unpoint(struct mtd_info *, loff_t, size_t); | ||
81 | static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 82 | static int slram_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
82 | static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 83 | static int slram_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
83 | 84 | ||
@@ -104,19 +105,23 @@ static int slram_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
104 | } | 105 | } |
105 | 106 | ||
106 | static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, | 107 | static int slram_point(struct mtd_info *mtd, loff_t from, size_t len, |
107 | size_t *retlen, u_char **mtdbuf) | 108 | size_t *retlen, void **virt, resource_size_t *phys) |
108 | { | 109 | { |
109 | slram_priv_t *priv = mtd->priv; | 110 | slram_priv_t *priv = mtd->priv; |
110 | 111 | ||
112 | /* can we return a physical address with this driver? */ | ||
113 | if (phys) | ||
114 | return -EINVAL; | ||
115 | |||
111 | if (from + len > mtd->size) | 116 | if (from + len > mtd->size) |
112 | return -EINVAL; | 117 | return -EINVAL; |
113 | 118 | ||
114 | *mtdbuf = priv->start + from; | 119 | *virt = priv->start + from; |
115 | *retlen = len; | 120 | *retlen = len; |
116 | return(0); | 121 | return(0); |
117 | } | 122 | } |
118 | 123 | ||
119 | static void slram_unpoint(struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 124 | static void slram_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
120 | { | 125 | { |
121 | } | 126 | } |
122 | 127 | ||
diff --git a/drivers/mtd/maps/uclinux.c b/drivers/mtd/maps/uclinux.c index 14ffb1a9302a..c42f4b83f686 100644 --- a/drivers/mtd/maps/uclinux.c +++ b/drivers/mtd/maps/uclinux.c | |||
@@ -40,10 +40,12 @@ struct mtd_partition uclinux_romfs[] = { | |||
40 | /****************************************************************************/ | 40 | /****************************************************************************/ |
41 | 41 | ||
42 | int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, | 42 | int uclinux_point(struct mtd_info *mtd, loff_t from, size_t len, |
43 | size_t *retlen, u_char **mtdbuf) | 43 | size_t *retlen, void **virt, resource_size_t *phys) |
44 | { | 44 | { |
45 | struct map_info *map = mtd->priv; | 45 | struct map_info *map = mtd->priv; |
46 | *mtdbuf = (u_char *) (map->virt + ((int) from)); | 46 | *virt = map->virt + from; |
47 | if (phys) | ||
48 | *phys = map->phys + from; | ||
47 | *retlen = len; | 49 | *retlen = len; |
48 | return(0); | 50 | return(0); |
49 | } | 51 | } |
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index c66902df3171..07c701169344 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c | |||
@@ -68,7 +68,7 @@ static int part_read (struct mtd_info *mtd, loff_t from, size_t len, | |||
68 | } | 68 | } |
69 | 69 | ||
70 | static int part_point (struct mtd_info *mtd, loff_t from, size_t len, | 70 | static int part_point (struct mtd_info *mtd, loff_t from, size_t len, |
71 | size_t *retlen, u_char **buf) | 71 | size_t *retlen, void **virt, resource_size_t *phys) |
72 | { | 72 | { |
73 | struct mtd_part *part = PART(mtd); | 73 | struct mtd_part *part = PART(mtd); |
74 | if (from >= mtd->size) | 74 | if (from >= mtd->size) |
@@ -76,14 +76,14 @@ static int part_point (struct mtd_info *mtd, loff_t from, size_t len, | |||
76 | else if (from + len > mtd->size) | 76 | else if (from + len > mtd->size) |
77 | len = mtd->size - from; | 77 | len = mtd->size - from; |
78 | return part->master->point (part->master, from + part->offset, | 78 | return part->master->point (part->master, from + part->offset, |
79 | len, retlen, buf); | 79 | len, retlen, virt, phys); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void part_unpoint (struct mtd_info *mtd, u_char *addr, loff_t from, size_t len) | 82 | static void part_unpoint(struct mtd_info *mtd, loff_t from, size_t len) |
83 | { | 83 | { |
84 | struct mtd_part *part = PART(mtd); | 84 | struct mtd_part *part = PART(mtd); |
85 | 85 | ||
86 | part->master->unpoint (part->master, addr, from + part->offset, len); | 86 | part->master->unpoint(part->master, from + part->offset, len); |
87 | } | 87 | } |
88 | 88 | ||
89 | static int part_read_oob(struct mtd_info *mtd, loff_t from, | 89 | static int part_read_oob(struct mtd_info *mtd, loff_t from, |
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index 5e86f43616a1..dddb2a6c9e2c 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -332,7 +332,8 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
332 | if (c->mtd->point) { | 332 | if (c->mtd->point) { |
333 | unsigned long *wordebuf; | 333 | unsigned long *wordebuf; |
334 | 334 | ||
335 | ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, &retlen, (unsigned char **)&ebuf); | 335 | ret = c->mtd->point(c->mtd, jeb->offset, c->sector_size, |
336 | &retlen, &ebuf, NULL); | ||
336 | if (ret) { | 337 | if (ret) { |
337 | D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); | 338 | D1(printk(KERN_DEBUG "MTD point failed %d\n", ret)); |
338 | goto do_flash_read; | 339 | goto do_flash_read; |
@@ -340,7 +341,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
340 | if (retlen < c->sector_size) { | 341 | if (retlen < c->sector_size) { |
341 | /* Don't muck about if it won't let us point to the whole erase sector */ | 342 | /* Don't muck about if it won't let us point to the whole erase sector */ |
342 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); | 343 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", retlen)); |
343 | c->mtd->unpoint(c->mtd, ebuf, jeb->offset, retlen); | 344 | c->mtd->unpoint(c->mtd, jeb->offset, retlen); |
344 | goto do_flash_read; | 345 | goto do_flash_read; |
345 | } | 346 | } |
346 | wordebuf = ebuf-sizeof(*wordebuf); | 347 | wordebuf = ebuf-sizeof(*wordebuf); |
@@ -349,7 +350,7 @@ static int jffs2_block_check_erase(struct jffs2_sb_info *c, struct jffs2_erasebl | |||
349 | if (*++wordebuf != ~0) | 350 | if (*++wordebuf != ~0) |
350 | break; | 351 | break; |
351 | } while(--retlen); | 352 | } while(--retlen); |
352 | c->mtd->unpoint(c->mtd, ebuf, jeb->offset, c->sector_size); | 353 | c->mtd->unpoint(c->mtd, jeb->offset, c->sector_size); |
353 | if (retlen) { | 354 | if (retlen) { |
354 | printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", | 355 | printk(KERN_WARNING "Newly-erased block contained word 0x%lx at offset 0x%08tx\n", |
355 | *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); | 356 | *wordebuf, jeb->offset + c->sector_size-retlen*sizeof(*wordebuf)); |
diff --git a/fs/jffs2/readinode.c b/fs/jffs2/readinode.c index 9fc4833c117c..6ca08ad887c0 100644 --- a/fs/jffs2/readinode.c +++ b/fs/jffs2/readinode.c | |||
@@ -63,10 +63,11 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
63 | /* TODO: instead, incapsulate point() stuff to jffs2_flash_read(), | 63 | /* TODO: instead, incapsulate point() stuff to jffs2_flash_read(), |
64 | * adding and jffs2_flash_read_end() interface. */ | 64 | * adding and jffs2_flash_read_end() interface. */ |
65 | if (c->mtd->point) { | 65 | if (c->mtd->point) { |
66 | err = c->mtd->point(c->mtd, ofs, len, &retlen, &buffer); | 66 | err = c->mtd->point(c->mtd, ofs, len, &retlen, |
67 | (void **)&buffer, NULL); | ||
67 | if (!err && retlen < len) { | 68 | if (!err && retlen < len) { |
68 | JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); | 69 | JFFS2_WARNING("MTD point returned len too short: %zu instead of %u.\n", retlen, tn->csize); |
69 | c->mtd->unpoint(c->mtd, buffer, ofs, retlen); | 70 | c->mtd->unpoint(c->mtd, ofs, retlen); |
70 | } else if (err) | 71 | } else if (err) |
71 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); | 72 | JFFS2_WARNING("MTD point failed: error code %d.\n", err); |
72 | else | 73 | else |
@@ -100,7 +101,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info | |||
100 | kfree(buffer); | 101 | kfree(buffer); |
101 | #ifndef __ECOS | 102 | #ifndef __ECOS |
102 | else | 103 | else |
103 | c->mtd->unpoint(c->mtd, buffer, ofs, len); | 104 | c->mtd->unpoint(c->mtd, ofs, len); |
104 | #endif | 105 | #endif |
105 | 106 | ||
106 | if (crc != tn->data_crc) { | 107 | if (crc != tn->data_crc) { |
@@ -136,7 +137,7 @@ free_out: | |||
136 | kfree(buffer); | 137 | kfree(buffer); |
137 | #ifndef __ECOS | 138 | #ifndef __ECOS |
138 | else | 139 | else |
139 | c->mtd->unpoint(c->mtd, buffer, ofs, len); | 140 | c->mtd->unpoint(c->mtd, ofs, len); |
140 | #endif | 141 | #endif |
141 | return err; | 142 | return err; |
142 | } | 143 | } |
diff --git a/fs/jffs2/scan.c b/fs/jffs2/scan.c index 8c1e692bef79..1d437de1e9a8 100644 --- a/fs/jffs2/scan.c +++ b/fs/jffs2/scan.c | |||
@@ -97,11 +97,12 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
97 | size_t pointlen; | 97 | size_t pointlen; |
98 | 98 | ||
99 | if (c->mtd->point) { | 99 | if (c->mtd->point) { |
100 | ret = c->mtd->point (c->mtd, 0, c->mtd->size, &pointlen, &flashbuf); | 100 | ret = c->mtd->point(c->mtd, 0, c->mtd->size, &pointlen, |
101 | (void **)&flashbuf, NULL); | ||
101 | if (!ret && pointlen < c->mtd->size) { | 102 | if (!ret && pointlen < c->mtd->size) { |
102 | /* Don't muck about if it won't let us point to the whole flash */ | 103 | /* Don't muck about if it won't let us point to the whole flash */ |
103 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); | 104 | D1(printk(KERN_DEBUG "MTD point returned len too short: 0x%zx\n", pointlen)); |
104 | c->mtd->unpoint(c->mtd, flashbuf, 0, pointlen); | 105 | c->mtd->unpoint(c->mtd, 0, pointlen); |
105 | flashbuf = NULL; | 106 | flashbuf = NULL; |
106 | } | 107 | } |
107 | if (ret) | 108 | if (ret) |
@@ -267,7 +268,7 @@ int jffs2_scan_medium(struct jffs2_sb_info *c) | |||
267 | kfree(flashbuf); | 268 | kfree(flashbuf); |
268 | #ifndef __ECOS | 269 | #ifndef __ECOS |
269 | else | 270 | else |
270 | c->mtd->unpoint(c->mtd, flashbuf, 0, c->mtd->size); | 271 | c->mtd->unpoint(c->mtd, 0, c->mtd->size); |
271 | #endif | 272 | #endif |
272 | if (s) | 273 | if (s) |
273 | kfree(s); | 274 | kfree(s); |
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 0a13bb35f044..245f9098e171 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
@@ -143,10 +143,12 @@ struct mtd_info { | |||
143 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); | 143 | int (*erase) (struct mtd_info *mtd, struct erase_info *instr); |
144 | 144 | ||
145 | /* This stuff for eXecute-In-Place */ | 145 | /* This stuff for eXecute-In-Place */ |
146 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); | 146 | /* phys is optional and may be set to NULL */ |
147 | int (*point) (struct mtd_info *mtd, loff_t from, size_t len, | ||
148 | size_t *retlen, void **virt, resource_size_t *phys); | ||
147 | 149 | ||
148 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ | 150 | /* We probably shouldn't allow XIP if the unpoint isn't a NULL */ |
149 | void (*unpoint) (struct mtd_info *mtd, u_char * addr, loff_t from, size_t len); | 151 | void (*unpoint) (struct mtd_info *mtd, loff_t from, size_t len); |
150 | 152 | ||
151 | 153 | ||
152 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); | 154 | int (*read) (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char *buf); |
diff --git a/include/linux/mtd/pmc551.h b/include/linux/mtd/pmc551.h index a7f6d20ad407..5cc070c24d88 100644 --- a/include/linux/mtd/pmc551.h +++ b/include/linux/mtd/pmc551.h | |||
@@ -36,8 +36,9 @@ struct mypriv { | |||
36 | * Function Prototypes | 36 | * Function Prototypes |
37 | */ | 37 | */ |
38 | static int pmc551_erase(struct mtd_info *, struct erase_info *); | 38 | static int pmc551_erase(struct mtd_info *, struct erase_info *); |
39 | static void pmc551_unpoint(struct mtd_info *, u_char *, loff_t, size_t); | 39 | static void pmc551_unpoint(struct mtd_info *, loff_t, size_t); |
40 | static int pmc551_point (struct mtd_info *mtd, loff_t from, size_t len, size_t *retlen, u_char **mtdbuf); | 40 | static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, |
41 | size_t *retlen, void **virt, resource_size_t *phys); | ||
41 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); | 42 | static int pmc551_read(struct mtd_info *, loff_t, size_t, size_t *, u_char *); |
42 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); | 43 | static int pmc551_write(struct mtd_info *, loff_t, size_t, size_t *, const u_char *); |
43 | 44 | ||