diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-04-13 01:32:13 -0400 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:06:00 -0400 |
commit | cbca4c75212da1ea82c10c054bbca36145cd13d8 (patch) | |
tree | 61908304af950f0fbb7fa4da600d4a36140cac0e | |
parent | e29e85ebaacd078a7c5e65f0d5ddbb634d7bd06a (diff) |
mtd: nand_base: Use io{read, write}*_rep functions for transfer
This patch replaces the usage of loops in the nand_base code with
io{read,write}{8,16}_rep calls instead.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Huang Shijie <b32955@freescale.com>
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index c6275a428730..d18cae55357c 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -211,11 +211,9 @@ static void nand_select_chip(struct mtd_info *mtd, int chipnr) | |||
211 | */ | 211 | */ |
212 | static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) | 212 | static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) |
213 | { | 213 | { |
214 | int i; | ||
215 | struct nand_chip *chip = mtd->priv; | 214 | struct nand_chip *chip = mtd->priv; |
216 | 215 | ||
217 | for (i = 0; i < len; i++) | 216 | iowrite8_rep(chip->IO_ADDR_W, buf, len); |
218 | writeb(buf[i], chip->IO_ADDR_W); | ||
219 | } | 217 | } |
220 | 218 | ||
221 | /** | 219 | /** |
@@ -228,11 +226,9 @@ static void nand_write_buf(struct mtd_info *mtd, const uint8_t *buf, int len) | |||
228 | */ | 226 | */ |
229 | static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) | 227 | static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) |
230 | { | 228 | { |
231 | int i; | ||
232 | struct nand_chip *chip = mtd->priv; | 229 | struct nand_chip *chip = mtd->priv; |
233 | 230 | ||
234 | for (i = 0; i < len; i++) | 231 | ioread8_rep(chip->IO_ADDR_R, buf, len); |
235 | buf[i] = readb(chip->IO_ADDR_R); | ||
236 | } | 232 | } |
237 | 233 | ||
238 | /** | 234 | /** |
@@ -245,14 +241,10 @@ static void nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len) | |||
245 | */ | 241 | */ |
246 | static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len) | 242 | static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len) |
247 | { | 243 | { |
248 | int i; | ||
249 | struct nand_chip *chip = mtd->priv; | 244 | struct nand_chip *chip = mtd->priv; |
250 | u16 *p = (u16 *) buf; | 245 | u16 *p = (u16 *) buf; |
251 | len >>= 1; | ||
252 | |||
253 | for (i = 0; i < len; i++) | ||
254 | writew(p[i], chip->IO_ADDR_W); | ||
255 | 246 | ||
247 | iowrite16_rep(chip->IO_ADDR_W, p, len >> 1); | ||
256 | } | 248 | } |
257 | 249 | ||
258 | /** | 250 | /** |
@@ -265,13 +257,10 @@ static void nand_write_buf16(struct mtd_info *mtd, const uint8_t *buf, int len) | |||
265 | */ | 257 | */ |
266 | static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len) | 258 | static void nand_read_buf16(struct mtd_info *mtd, uint8_t *buf, int len) |
267 | { | 259 | { |
268 | int i; | ||
269 | struct nand_chip *chip = mtd->priv; | 260 | struct nand_chip *chip = mtd->priv; |
270 | u16 *p = (u16 *) buf; | 261 | u16 *p = (u16 *) buf; |
271 | len >>= 1; | ||
272 | 262 | ||
273 | for (i = 0; i < len; i++) | 263 | ioread16_rep(chip->IO_ADDR_R, p, len >> 1); |
274 | p[i] = readw(chip->IO_ADDR_R); | ||
275 | } | 264 | } |
276 | 265 | ||
277 | /** | 266 | /** |