aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
authorKim Phillips <kim.phillips@freescale.com>2013-01-11 17:23:59 -0500
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-02-04 02:26:30 -0500
commit0c69fb037a6bb1faf06ea776872da54a6705c154 (patch)
treeb9915d1cd623fc6b0652fb9345c5b633eb35488d /drivers/mtd/nand
parent44fe63fc0fcbfef65b5a8c015abb4dbbbcc90f23 (diff)
mtd: fsl_ifc_nand: use more portable i/o accessors
in/out_be32 accessors are Power arch centric whereas ioread/writebe32 are available in other arches. Since the IFC device registers are annotated big endian in fsl_ifc.h, the accessor annotations now match, resulting in the pleasant side-effect of this patch silencing sparse endian warnings such as the following: drivers/mtd/nand/fsl_ifc_nand.c:179:19: warning: incorrect type in argument 1 (different base types) drivers/mtd/nand/fsl_ifc_nand.c:179:19: expected unsigned int volatile [noderef] [usertype] <asn:2>*addr drivers/mtd/nand/fsl_ifc_nand.c:179:19: got restricted __be32 [noderef] <asn:2>*<noident> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/fsl_ifc_nand.c233
1 files changed, 119 insertions, 114 deletions
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index ad6222627fed..f1f7f12ab501 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -176,8 +176,8 @@ static void set_addr(struct mtd_info *mtd, int column, int page_addr, int oob)
176 176
177 ifc_nand_ctrl->page = page_addr; 177 ifc_nand_ctrl->page = page_addr;
178 /* Program ROW0/COL0 */ 178 /* Program ROW0/COL0 */
179 out_be32(&ifc->ifc_nand.row0, page_addr); 179 iowrite32be(page_addr, &ifc->ifc_nand.row0);
180 out_be32(&ifc->ifc_nand.col0, (oob ? IFC_NAND_COL_MS : 0) | column); 180 iowrite32be((oob ? IFC_NAND_COL_MS : 0) | column, &ifc->ifc_nand.col0);
181 181
182 buf_num = page_addr & priv->bufnum_mask; 182 buf_num = page_addr & priv->bufnum_mask;
183 183
@@ -239,18 +239,19 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
239 int i; 239 int i;
240 240
241 /* set the chip select for NAND Transaction */ 241 /* set the chip select for NAND Transaction */
242 out_be32(&ifc->ifc_nand.nand_csel, priv->bank << IFC_NAND_CSEL_SHIFT); 242 iowrite32be(priv->bank << IFC_NAND_CSEL_SHIFT,
243 &ifc->ifc_nand.nand_csel);
243 244
244 dev_vdbg(priv->dev, 245 dev_vdbg(priv->dev,
245 "%s: fir0=%08x fcr0=%08x\n", 246 "%s: fir0=%08x fcr0=%08x\n",
246 __func__, 247 __func__,
247 in_be32(&ifc->ifc_nand.nand_fir0), 248 ioread32be(&ifc->ifc_nand.nand_fir0),
248 in_be32(&ifc->ifc_nand.nand_fcr0)); 249 ioread32be(&ifc->ifc_nand.nand_fcr0));
249 250
250 ctrl->nand_stat = 0; 251 ctrl->nand_stat = 0;
251 252
252 /* start read/write seq */ 253 /* start read/write seq */
253 out_be32(&ifc->ifc_nand.nandseq_strt, IFC_NAND_SEQ_STRT_FIR_STRT); 254 iowrite32be(IFC_NAND_SEQ_STRT_FIR_STRT, &ifc->ifc_nand.nandseq_strt);
254 255
255 /* wait for command complete flag or timeout */ 256 /* wait for command complete flag or timeout */
256 wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat, 257 wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat,
@@ -273,7 +274,7 @@ static void fsl_ifc_run_command(struct mtd_info *mtd)
273 int sector_end = sector + chip->ecc.steps - 1; 274 int sector_end = sector + chip->ecc.steps - 1;
274 275
275 for (i = sector / 4; i <= sector_end / 4; i++) 276 for (i = sector / 4; i <= sector_end / 4; i++)
276 eccstat[i] = in_be32(&ifc->ifc_nand.nand_eccstat[i]); 277 eccstat[i] = ioread32be(&ifc->ifc_nand.nand_eccstat[i]);
277 278
278 for (i = sector; i <= sector_end; i++) { 279 for (i = sector; i <= sector_end; i++) {
279 errors = check_read_ecc(mtd, ctrl, eccstat, i); 280 errors = check_read_ecc(mtd, ctrl, eccstat, i);
@@ -313,31 +314,33 @@ static void fsl_ifc_do_read(struct nand_chip *chip,
313 314
314 /* Program FIR/IFC_NAND_FCR0 for Small/Large page */ 315 /* Program FIR/IFC_NAND_FCR0 for Small/Large page */
315 if (mtd->writesize > 512) { 316 if (mtd->writesize > 512) {
316 out_be32(&ifc->ifc_nand.nand_fir0, 317 iowrite32be((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
317 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 318 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) |
318 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) | 319 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) |
319 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) | 320 (IFC_FIR_OP_CMD1 << IFC_NAND_FIR0_OP3_SHIFT) |
320 (IFC_FIR_OP_CMD1 << IFC_NAND_FIR0_OP3_SHIFT) | 321 (IFC_FIR_OP_RBCD << IFC_NAND_FIR0_OP4_SHIFT),
321 (IFC_FIR_OP_RBCD << IFC_NAND_FIR0_OP4_SHIFT)); 322 &ifc->ifc_nand.nand_fir0);
322 out_be32(&ifc->ifc_nand.nand_fir1, 0x0); 323 iowrite32be(0x0, &ifc->ifc_nand.nand_fir1);
323 324
324 out_be32(&ifc->ifc_nand.nand_fcr0, 325 iowrite32be((NAND_CMD_READ0 << IFC_NAND_FCR0_CMD0_SHIFT) |
325 (NAND_CMD_READ0 << IFC_NAND_FCR0_CMD0_SHIFT) | 326 (NAND_CMD_READSTART << IFC_NAND_FCR0_CMD1_SHIFT),
326 (NAND_CMD_READSTART << IFC_NAND_FCR0_CMD1_SHIFT)); 327 &ifc->ifc_nand.nand_fcr0);
327 } else { 328 } else {
328 out_be32(&ifc->ifc_nand.nand_fir0, 329 iowrite32be((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
329 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 330 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) |
330 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) | 331 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) |
331 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) | 332 (IFC_FIR_OP_RBCD << IFC_NAND_FIR0_OP3_SHIFT),
332 (IFC_FIR_OP_RBCD << IFC_NAND_FIR0_OP3_SHIFT)); 333 &ifc->ifc_nand.nand_fir0);
333 out_be32(&ifc->ifc_nand.nand_fir1, 0x0); 334 iowrite32be(0x0, &ifc->ifc_nand.nand_fir1);
334 335
335 if (oob) 336 if (oob)
336 out_be32(&ifc->ifc_nand.nand_fcr0, 337 iowrite32be(NAND_CMD_READOOB <<
337 NAND_CMD_READOOB << IFC_NAND_FCR0_CMD0_SHIFT); 338 IFC_NAND_FCR0_CMD0_SHIFT,
339 &ifc->ifc_nand.nand_fcr0);
338 else 340 else
339 out_be32(&ifc->ifc_nand.nand_fcr0, 341 iowrite32be(NAND_CMD_READ0 <<
340 NAND_CMD_READ0 << IFC_NAND_FCR0_CMD0_SHIFT); 342 IFC_NAND_FCR0_CMD0_SHIFT,
343 &ifc->ifc_nand.nand_fcr0);
341 } 344 }
342} 345}
343 346
@@ -357,7 +360,7 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
357 switch (command) { 360 switch (command) {
358 /* READ0 read the entire buffer to use hardware ECC. */ 361 /* READ0 read the entire buffer to use hardware ECC. */
359 case NAND_CMD_READ0: 362 case NAND_CMD_READ0:
360 out_be32(&ifc->ifc_nand.nand_fbcr, 0); 363 iowrite32be(0, &ifc->ifc_nand.nand_fbcr);
361 set_addr(mtd, 0, page_addr, 0); 364 set_addr(mtd, 0, page_addr, 0);
362 365
363 ifc_nand_ctrl->read_bytes = mtd->writesize + mtd->oobsize; 366 ifc_nand_ctrl->read_bytes = mtd->writesize + mtd->oobsize;
@@ -372,7 +375,7 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
372 375
373 /* READOOB reads only the OOB because no ECC is performed. */ 376 /* READOOB reads only the OOB because no ECC is performed. */
374 case NAND_CMD_READOOB: 377 case NAND_CMD_READOOB:
375 out_be32(&ifc->ifc_nand.nand_fbcr, mtd->oobsize - column); 378 iowrite32be(mtd->oobsize - column, &ifc->ifc_nand.nand_fbcr);
376 set_addr(mtd, column, page_addr, 1); 379 set_addr(mtd, column, page_addr, 1);
377 380
378 ifc_nand_ctrl->read_bytes = mtd->writesize + mtd->oobsize; 381 ifc_nand_ctrl->read_bytes = mtd->writesize + mtd->oobsize;
@@ -388,19 +391,19 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
388 if (command == NAND_CMD_PARAM) 391 if (command == NAND_CMD_PARAM)
389 timing = IFC_FIR_OP_RBCD; 392 timing = IFC_FIR_OP_RBCD;
390 393
391 out_be32(&ifc->ifc_nand.nand_fir0, 394 iowrite32be((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
392 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 395 (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) |
393 (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) | 396 (timing << IFC_NAND_FIR0_OP2_SHIFT),
394 (timing << IFC_NAND_FIR0_OP2_SHIFT)); 397 &ifc->ifc_nand.nand_fir0);
395 out_be32(&ifc->ifc_nand.nand_fcr0, 398 iowrite32be(command << IFC_NAND_FCR0_CMD0_SHIFT,
396 command << IFC_NAND_FCR0_CMD0_SHIFT); 399 &ifc->ifc_nand.nand_fcr0);
397 out_be32(&ifc->ifc_nand.row3, column); 400 iowrite32be(column, &ifc->ifc_nand.row3);
398 401
399 /* 402 /*
400 * although currently it's 8 bytes for READID, we always read 403 * although currently it's 8 bytes for READID, we always read
401 * the maximum 256 bytes(for PARAM) 404 * the maximum 256 bytes(for PARAM)
402 */ 405 */
403 out_be32(&ifc->ifc_nand.nand_fbcr, 256); 406 iowrite32be(256, &ifc->ifc_nand.nand_fbcr);
404 ifc_nand_ctrl->read_bytes = 256; 407 ifc_nand_ctrl->read_bytes = 256;
405 408
406 set_addr(mtd, 0, 0, 0); 409 set_addr(mtd, 0, 0, 0);
@@ -415,16 +418,16 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
415 418
416 /* ERASE2 uses the block and page address from ERASE1 */ 419 /* ERASE2 uses the block and page address from ERASE1 */
417 case NAND_CMD_ERASE2: 420 case NAND_CMD_ERASE2:
418 out_be32(&ifc->ifc_nand.nand_fir0, 421 iowrite32be((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
419 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 422 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP1_SHIFT) |
420 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP1_SHIFT) | 423 (IFC_FIR_OP_CMD1 << IFC_NAND_FIR0_OP2_SHIFT),
421 (IFC_FIR_OP_CMD1 << IFC_NAND_FIR0_OP2_SHIFT)); 424 &ifc->ifc_nand.nand_fir0);
422 425
423 out_be32(&ifc->ifc_nand.nand_fcr0, 426 iowrite32be((NAND_CMD_ERASE1 << IFC_NAND_FCR0_CMD0_SHIFT) |
424 (NAND_CMD_ERASE1 << IFC_NAND_FCR0_CMD0_SHIFT) | 427 (NAND_CMD_ERASE2 << IFC_NAND_FCR0_CMD1_SHIFT),
425 (NAND_CMD_ERASE2 << IFC_NAND_FCR0_CMD1_SHIFT)); 428 &ifc->ifc_nand.nand_fcr0);
426 429
427 out_be32(&ifc->ifc_nand.nand_fbcr, 0); 430 iowrite32be(0, &ifc->ifc_nand.nand_fbcr);
428 ifc_nand_ctrl->read_bytes = 0; 431 ifc_nand_ctrl->read_bytes = 0;
429 fsl_ifc_run_command(mtd); 432 fsl_ifc_run_command(mtd);
430 return; 433 return;
@@ -440,26 +443,28 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
440 (NAND_CMD_SEQIN << IFC_NAND_FCR0_CMD0_SHIFT) | 443 (NAND_CMD_SEQIN << IFC_NAND_FCR0_CMD0_SHIFT) |
441 (NAND_CMD_PAGEPROG << IFC_NAND_FCR0_CMD1_SHIFT); 444 (NAND_CMD_PAGEPROG << IFC_NAND_FCR0_CMD1_SHIFT);
442 445
443 out_be32(&ifc->ifc_nand.nand_fir0, 446 iowrite32be(
444 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 447 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
445 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) | 448 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) |
446 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) | 449 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) |
447 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP3_SHIFT) | 450 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP3_SHIFT) |
448 (IFC_FIR_OP_CW1 << IFC_NAND_FIR0_OP4_SHIFT)); 451 (IFC_FIR_OP_CW1 << IFC_NAND_FIR0_OP4_SHIFT),
452 &ifc->ifc_nand.nand_fir0);
449 } else { 453 } else {
450 nand_fcr0 = ((NAND_CMD_PAGEPROG << 454 nand_fcr0 = ((NAND_CMD_PAGEPROG <<
451 IFC_NAND_FCR0_CMD1_SHIFT) | 455 IFC_NAND_FCR0_CMD1_SHIFT) |
452 (NAND_CMD_SEQIN << 456 (NAND_CMD_SEQIN <<
453 IFC_NAND_FCR0_CMD2_SHIFT)); 457 IFC_NAND_FCR0_CMD2_SHIFT));
454 458
455 out_be32(&ifc->ifc_nand.nand_fir0, 459 iowrite32be(
456 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 460 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
457 (IFC_FIR_OP_CMD2 << IFC_NAND_FIR0_OP1_SHIFT) | 461 (IFC_FIR_OP_CMD2 << IFC_NAND_FIR0_OP1_SHIFT) |
458 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP2_SHIFT) | 462 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP2_SHIFT) |
459 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP3_SHIFT) | 463 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP3_SHIFT) |
460 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP4_SHIFT)); 464 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP4_SHIFT),
461 out_be32(&ifc->ifc_nand.nand_fir1, 465 &ifc->ifc_nand.nand_fir0);
462 (IFC_FIR_OP_CW1 << IFC_NAND_FIR1_OP5_SHIFT)); 466 iowrite32be(IFC_FIR_OP_CW1 << IFC_NAND_FIR1_OP5_SHIFT,
467 &ifc->ifc_nand.nand_fir1);
463 468
464 if (column >= mtd->writesize) 469 if (column >= mtd->writesize)
465 nand_fcr0 |= 470 nand_fcr0 |=
@@ -474,7 +479,7 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
474 column -= mtd->writesize; 479 column -= mtd->writesize;
475 ifc_nand_ctrl->oob = 1; 480 ifc_nand_ctrl->oob = 1;
476 } 481 }
477 out_be32(&ifc->ifc_nand.nand_fcr0, nand_fcr0); 482 iowrite32be(nand_fcr0, &ifc->ifc_nand.nand_fcr0);
478 set_addr(mtd, column, page_addr, ifc_nand_ctrl->oob); 483 set_addr(mtd, column, page_addr, ifc_nand_ctrl->oob);
479 return; 484 return;
480 } 485 }
@@ -482,10 +487,11 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
482 /* PAGEPROG reuses all of the setup from SEQIN and adds the length */ 487 /* PAGEPROG reuses all of the setup from SEQIN and adds the length */
483 case NAND_CMD_PAGEPROG: { 488 case NAND_CMD_PAGEPROG: {
484 if (ifc_nand_ctrl->oob) { 489 if (ifc_nand_ctrl->oob) {
485 out_be32(&ifc->ifc_nand.nand_fbcr, 490 iowrite32be(ifc_nand_ctrl->index -
486 ifc_nand_ctrl->index - ifc_nand_ctrl->column); 491 ifc_nand_ctrl->column,
492 &ifc->ifc_nand.nand_fbcr);
487 } else { 493 } else {
488 out_be32(&ifc->ifc_nand.nand_fbcr, 0); 494 iowrite32be(0, &ifc->ifc_nand.nand_fbcr);
489 } 495 }
490 496
491 fsl_ifc_run_command(mtd); 497 fsl_ifc_run_command(mtd);
@@ -493,12 +499,12 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
493 } 499 }
494 500
495 case NAND_CMD_STATUS: 501 case NAND_CMD_STATUS:
496 out_be32(&ifc->ifc_nand.nand_fir0, 502 iowrite32be((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
497 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 503 (IFC_FIR_OP_RB << IFC_NAND_FIR0_OP1_SHIFT),
498 (IFC_FIR_OP_RB << IFC_NAND_FIR0_OP1_SHIFT)); 504 &ifc->ifc_nand.nand_fir0);
499 out_be32(&ifc->ifc_nand.nand_fcr0, 505 iowrite32be(NAND_CMD_STATUS << IFC_NAND_FCR0_CMD0_SHIFT,
500 NAND_CMD_STATUS << IFC_NAND_FCR0_CMD0_SHIFT); 506 &ifc->ifc_nand.nand_fcr0);
501 out_be32(&ifc->ifc_nand.nand_fbcr, 1); 507 iowrite32be(1, &ifc->ifc_nand.nand_fbcr);
502 set_addr(mtd, 0, 0, 0); 508 set_addr(mtd, 0, 0, 0);
503 ifc_nand_ctrl->read_bytes = 1; 509 ifc_nand_ctrl->read_bytes = 1;
504 510
@@ -512,10 +518,10 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
512 return; 518 return;
513 519
514 case NAND_CMD_RESET: 520 case NAND_CMD_RESET:
515 out_be32(&ifc->ifc_nand.nand_fir0, 521 iowrite32be(IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT,
516 IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT); 522 &ifc->ifc_nand.nand_fir0);
517 out_be32(&ifc->ifc_nand.nand_fcr0, 523 iowrite32be(NAND_CMD_RESET << IFC_NAND_FCR0_CMD0_SHIFT,
518 NAND_CMD_RESET << IFC_NAND_FCR0_CMD0_SHIFT); 524 &ifc->ifc_nand.nand_fcr0);
519 fsl_ifc_run_command(mtd); 525 fsl_ifc_run_command(mtd);
520 return; 526 return;
521 527
@@ -639,18 +645,18 @@ static int fsl_ifc_wait(struct mtd_info *mtd, struct nand_chip *chip)
639 u32 nand_fsr; 645 u32 nand_fsr;
640 646
641 /* Use READ_STATUS command, but wait for the device to be ready */ 647 /* Use READ_STATUS command, but wait for the device to be ready */
642 out_be32(&ifc->ifc_nand.nand_fir0, 648 iowrite32be((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
643 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 649 (IFC_FIR_OP_RDSTAT << IFC_NAND_FIR0_OP1_SHIFT),
644 (IFC_FIR_OP_RDSTAT << IFC_NAND_FIR0_OP1_SHIFT)); 650 &ifc->ifc_nand.nand_fir0);
645 out_be32(&ifc->ifc_nand.nand_fcr0, NAND_CMD_STATUS << 651 iowrite32be(NAND_CMD_STATUS << IFC_NAND_FCR0_CMD0_SHIFT,
646 IFC_NAND_FCR0_CMD0_SHIFT); 652 &ifc->ifc_nand.nand_fcr0);
647 out_be32(&ifc->ifc_nand.nand_fbcr, 1); 653 iowrite32be(1, &ifc->ifc_nand.nand_fbcr);
648 set_addr(mtd, 0, 0, 0); 654 set_addr(mtd, 0, 0, 0);
649 ifc_nand_ctrl->read_bytes = 1; 655 ifc_nand_ctrl->read_bytes = 1;
650 656
651 fsl_ifc_run_command(mtd); 657 fsl_ifc_run_command(mtd);
652 658
653 nand_fsr = in_be32(&ifc->ifc_nand.nand_fsr); 659 nand_fsr = ioread32be(&ifc->ifc_nand.nand_fsr);
654 660
655 /* 661 /*
656 * The chip always seems to report that it is 662 * The chip always seems to report that it is
@@ -744,34 +750,34 @@ static void fsl_ifc_sram_init(struct fsl_ifc_mtd *priv)
744 uint32_t cs = priv->bank; 750 uint32_t cs = priv->bank;
745 751
746 /* Save CSOR and CSOR_ext */ 752 /* Save CSOR and CSOR_ext */
747 csor = in_be32(&ifc->csor_cs[cs].csor); 753 csor = ioread32be(&ifc->csor_cs[cs].csor);
748 csor_ext = in_be32(&ifc->csor_cs[cs].csor_ext); 754 csor_ext = ioread32be(&ifc->csor_cs[cs].csor_ext);
749 755
750 /* chage PageSize 8K and SpareSize 1K*/ 756 /* chage PageSize 8K and SpareSize 1K*/
751 csor_8k = (csor & ~(CSOR_NAND_PGS_MASK)) | 0x0018C000; 757 csor_8k = (csor & ~(CSOR_NAND_PGS_MASK)) | 0x0018C000;
752 out_be32(&ifc->csor_cs[cs].csor, csor_8k); 758 iowrite32be(csor_8k, &ifc->csor_cs[cs].csor);
753 out_be32(&ifc->csor_cs[cs].csor_ext, 0x0000400); 759 iowrite32be(0x0000400, &ifc->csor_cs[cs].csor_ext);
754 760
755 /* READID */ 761 /* READID */
756 out_be32(&ifc->ifc_nand.nand_fir0, 762 iowrite32be((IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
757 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 763 (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) |
758 (IFC_FIR_OP_UA << IFC_NAND_FIR0_OP1_SHIFT) | 764 (IFC_FIR_OP_RB << IFC_NAND_FIR0_OP2_SHIFT),
759 (IFC_FIR_OP_RB << IFC_NAND_FIR0_OP2_SHIFT)); 765 &ifc->ifc_nand.nand_fir0);
760 out_be32(&ifc->ifc_nand.nand_fcr0, 766 iowrite32be(NAND_CMD_READID << IFC_NAND_FCR0_CMD0_SHIFT,
761 NAND_CMD_READID << IFC_NAND_FCR0_CMD0_SHIFT); 767 &ifc->ifc_nand.nand_fcr0);
762 out_be32(&ifc->ifc_nand.row3, 0x0); 768 iowrite32be(0x0, &ifc->ifc_nand.row3);
763 769
764 out_be32(&ifc->ifc_nand.nand_fbcr, 0x0); 770 iowrite32be(0x0, &ifc->ifc_nand.nand_fbcr);
765 771
766 /* Program ROW0/COL0 */ 772 /* Program ROW0/COL0 */
767 out_be32(&ifc->ifc_nand.row0, 0x0); 773 iowrite32be(0x0, &ifc->ifc_nand.row0);
768 out_be32(&ifc->ifc_nand.col0, 0x0); 774 iowrite32be(0x0, &ifc->ifc_nand.col0);
769 775
770 /* set the chip select for NAND Transaction */ 776 /* set the chip select for NAND Transaction */
771 out_be32(&ifc->ifc_nand.nand_csel, cs << IFC_NAND_CSEL_SHIFT); 777 iowrite32be(cs << IFC_NAND_CSEL_SHIFT, &ifc->ifc_nand.nand_csel);
772 778
773 /* start read seq */ 779 /* start read seq */
774 out_be32(&ifc->ifc_nand.nandseq_strt, IFC_NAND_SEQ_STRT_FIR_STRT); 780 iowrite32be(IFC_NAND_SEQ_STRT_FIR_STRT, &ifc->ifc_nand.nandseq_strt);
775 781
776 /* wait for command complete flag or timeout */ 782 /* wait for command complete flag or timeout */
777 wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat, 783 wait_event_timeout(ctrl->nand_wait, ctrl->nand_stat,
@@ -781,8 +787,8 @@ static void fsl_ifc_sram_init(struct fsl_ifc_mtd *priv)
781 printk(KERN_ERR "fsl-ifc: Failed to Initialise SRAM\n"); 787 printk(KERN_ERR "fsl-ifc: Failed to Initialise SRAM\n");
782 788
783 /* Restore CSOR and CSOR_ext */ 789 /* Restore CSOR and CSOR_ext */
784 out_be32(&ifc->csor_cs[cs].csor, csor); 790 iowrite32be(csor, &ifc->csor_cs[cs].csor);
785 out_be32(&ifc->csor_cs[cs].csor_ext, csor_ext); 791 iowrite32be(csor_ext, &ifc->csor_cs[cs].csor_ext);
786} 792}
787 793
788static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv) 794static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
@@ -799,7 +805,7 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
799 805
800 /* fill in nand_chip structure */ 806 /* fill in nand_chip structure */
801 /* set up function call table */ 807 /* set up function call table */
802 if ((in_be32(&ifc->cspr_cs[priv->bank].cspr)) & CSPR_PORT_SIZE_16) 808 if ((ioread32be(&ifc->cspr_cs[priv->bank].cspr)) & CSPR_PORT_SIZE_16)
803 chip->read_byte = fsl_ifc_read_byte16; 809 chip->read_byte = fsl_ifc_read_byte16;
804 else 810 else
805 chip->read_byte = fsl_ifc_read_byte; 811 chip->read_byte = fsl_ifc_read_byte;
@@ -813,13 +819,13 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
813 chip->bbt_td = &bbt_main_descr; 819 chip->bbt_td = &bbt_main_descr;
814 chip->bbt_md = &bbt_mirror_descr; 820 chip->bbt_md = &bbt_mirror_descr;
815 821
816 out_be32(&ifc->ifc_nand.ncfgr, 0x0); 822 iowrite32be(0x0, &ifc->ifc_nand.ncfgr);
817 823
818 /* set up nand options */ 824 /* set up nand options */
819 chip->bbt_options = NAND_BBT_USE_FLASH; 825 chip->bbt_options = NAND_BBT_USE_FLASH;
820 826
821 827
822 if (in_be32(&ifc->cspr_cs[priv->bank].cspr) & CSPR_PORT_SIZE_16) { 828 if (ioread32be(&ifc->cspr_cs[priv->bank].cspr) & CSPR_PORT_SIZE_16) {
823 chip->read_byte = fsl_ifc_read_byte16; 829 chip->read_byte = fsl_ifc_read_byte16;
824 chip->options |= NAND_BUSWIDTH_16; 830 chip->options |= NAND_BUSWIDTH_16;
825 } else { 831 } else {
@@ -832,7 +838,7 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
832 chip->ecc.read_page = fsl_ifc_read_page; 838 chip->ecc.read_page = fsl_ifc_read_page;
833 chip->ecc.write_page = fsl_ifc_write_page; 839 chip->ecc.write_page = fsl_ifc_write_page;
834 840
835 csor = in_be32(&ifc->csor_cs[priv->bank].csor); 841 csor = ioread32be(&ifc->csor_cs[priv->bank].csor);
836 842
837 /* Hardware generates ECC per 512 Bytes */ 843 /* Hardware generates ECC per 512 Bytes */
838 chip->ecc.size = 512; 844 chip->ecc.size = 512;
@@ -884,7 +890,7 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
884 chip->ecc.mode = NAND_ECC_SOFT; 890 chip->ecc.mode = NAND_ECC_SOFT;
885 } 891 }
886 892
887 ver = in_be32(&ifc->ifc_rev); 893 ver = ioread32be(&ifc->ifc_rev);
888 if (ver == FSL_IFC_V1_1_0) 894 if (ver == FSL_IFC_V1_1_0)
889 fsl_ifc_sram_init(priv); 895 fsl_ifc_sram_init(priv);
890 896
@@ -910,7 +916,7 @@ static int fsl_ifc_chip_remove(struct fsl_ifc_mtd *priv)
910static int match_bank(struct fsl_ifc_regs __iomem *ifc, int bank, 916static int match_bank(struct fsl_ifc_regs __iomem *ifc, int bank,
911 phys_addr_t addr) 917 phys_addr_t addr)
912{ 918{
913 u32 cspr = in_be32(&ifc->cspr_cs[bank].cspr); 919 u32 cspr = ioread32be(&ifc->cspr_cs[bank].cspr);
914 920
915 if (!(cspr & CSPR_V)) 921 if (!(cspr & CSPR_V))
916 return 0; 922 return 0;
@@ -997,17 +1003,16 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
997 1003
998 dev_set_drvdata(priv->dev, priv); 1004 dev_set_drvdata(priv->dev, priv);
999 1005
1000 out_be32(&ifc->ifc_nand.nand_evter_en, 1006 iowrite32be(IFC_NAND_EVTER_EN_OPC_EN |
1001 IFC_NAND_EVTER_EN_OPC_EN | 1007 IFC_NAND_EVTER_EN_FTOER_EN |
1002 IFC_NAND_EVTER_EN_FTOER_EN | 1008 IFC_NAND_EVTER_EN_WPER_EN,
1003 IFC_NAND_EVTER_EN_WPER_EN); 1009 &ifc->ifc_nand.nand_evter_en);
1004 1010
1005 /* enable NAND Machine Interrupts */ 1011 /* enable NAND Machine Interrupts */
1006 out_be32(&ifc->ifc_nand.nand_evter_intr_en, 1012 iowrite32be(IFC_NAND_EVTER_INTR_OPCIR_EN |
1007 IFC_NAND_EVTER_INTR_OPCIR_EN | 1013 IFC_NAND_EVTER_INTR_FTOERIR_EN |
1008 IFC_NAND_EVTER_INTR_FTOERIR_EN | 1014 IFC_NAND_EVTER_INTR_WPERIR_EN,
1009 IFC_NAND_EVTER_INTR_WPERIR_EN); 1015 &ifc->ifc_nand.nand_evter_intr_en);
1010
1011 priv->mtd.name = kasprintf(GFP_KERNEL, "%x.flash", (unsigned)res.start); 1016 priv->mtd.name = kasprintf(GFP_KERNEL, "%x.flash", (unsigned)res.start);
1012 if (!priv->mtd.name) { 1017 if (!priv->mtd.name) {
1013 ret = -ENOMEM; 1018 ret = -ENOMEM;