aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/pmc551.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/pmc551.c')
-rw-r--r--drivers/mtd/devices/pmc551.c27
1 files changed, 17 insertions, 10 deletions
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
172static int pmc551_point(struct mtd_info *mtd, loff_t from, size_t len, 174static 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
206static void pmc551_unpoint(struct mtd_info *mtd, u_char * addr, loff_t from, 212static 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;