Commit b9ae609fdbb7f8149a13bb9c67006b7237cbf83e

Authored by Brian Norris
Committed by Tom Rini
1 parent 3f990dc83b

mtd: nand: don't use read_buf for 8-bit ONFI transfers

Porting below commit from linux-tree, preserving original authorship & commit log
commit bd9c6e99b58255b9de1982711ac9487c9a2f18be
Author:     Brian Norris <computersforpeace@gmail.com>
mtd: nand: don't use read_buf for 8-bit ONFI transfers

  Use a repeated read_byte() instead of read_buf(), since for x16 buswidth
  devices, we need to avoid the upper I/O[16:9] bits. See the following
  commit for reference:

  commit 05f7835975dad6b3b517f9e23415985e648fb875 (from linux-tree)
  Author: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
  Date:   Thu Dec 5 22:22:04 2013 +0100

      mtd: nand: don't use {read,write}_buf for 8-bit transfers

  Now, I think that all barriers to probing ONFI on x16 devices are
  removed, so remove the check from nand_flash_detect_onfi().

Signed-off-by: Pekon Gupta <pekon@ti.com>

Showing 1 changed file with 3 additions and 2 deletions Side-by-side Diff

drivers/mtd/nand/nand_base.c
... ... @@ -2582,7 +2582,7 @@
2582 2582 int *busw)
2583 2583 {
2584 2584 struct nand_onfi_params *p = &chip->onfi_params;
2585   - int i;
  2585 + int i, j;
2586 2586 int val;
2587 2587  
2588 2588 /* Try ONFI for unknown chip or LP */
... ... @@ -2593,7 +2593,8 @@
2593 2593  
2594 2594 chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1);
2595 2595 for (i = 0; i < 3; i++) {
2596   - chip->read_buf(mtd, (uint8_t *)p, sizeof(*p));
  2596 + for (j = 0; j < sizeof(*p); j++)
  2597 + ((uint8_t *)p)[j] = chip->read_byte(mtd);
2597 2598 if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) ==
2598 2599 le16_to_cpu(p->crc)) {
2599 2600 pr_info("ONFI param page %d valid\n", i);