diff options
author | Brian Norris <computersforpeace@gmail.com> | 2013-11-30 01:04:28 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2014-03-11 01:42:23 -0400 |
commit | bd9c6e99b58255b9de1982711ac9487c9a2f18be (patch) | |
tree | b0c1ff4a9640b513b6a871679feb5c3ba55292c0 /drivers/mtd/nand | |
parent | 3dad2344e92c6e1aeae42df1c4824f307c51bcc7 (diff) |
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
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().
Tested on 8-bit ONFI NAND (Micron MT29F32G08CBADAWP).
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Tested-By: Pekon Gupta <pekon@ti.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 6281151e4cb7..79ed8ccf5065 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -3065,7 +3065,7 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, | |||
3065 | int *busw) | 3065 | int *busw) |
3066 | { | 3066 | { |
3067 | struct nand_onfi_params *p = &chip->onfi_params; | 3067 | struct nand_onfi_params *p = &chip->onfi_params; |
3068 | int i; | 3068 | int i, j; |
3069 | int val; | 3069 | int val; |
3070 | 3070 | ||
3071 | /* Try ONFI for unknown chip or LP */ | 3071 | /* Try ONFI for unknown chip or LP */ |
@@ -3074,18 +3074,10 @@ static int nand_flash_detect_onfi(struct mtd_info *mtd, struct nand_chip *chip, | |||
3074 | chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I') | 3074 | chip->read_byte(mtd) != 'F' || chip->read_byte(mtd) != 'I') |
3075 | return 0; | 3075 | return 0; |
3076 | 3076 | ||
3077 | /* | ||
3078 | * ONFI must be probed in 8-bit mode or with NAND_BUSWIDTH_AUTO, not | ||
3079 | * with NAND_BUSWIDTH_16 | ||
3080 | */ | ||
3081 | if (chip->options & NAND_BUSWIDTH_16) { | ||
3082 | pr_err("ONFI cannot be probed in 16-bit mode; aborting\n"); | ||
3083 | return 0; | ||
3084 | } | ||
3085 | |||
3086 | chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); | 3077 | chip->cmdfunc(mtd, NAND_CMD_PARAM, 0, -1); |
3087 | for (i = 0; i < 3; i++) { | 3078 | for (i = 0; i < 3; i++) { |
3088 | chip->read_buf(mtd, (uint8_t *)p, sizeof(*p)); | 3079 | for (j = 0; j < sizeof(*p); j++) |
3080 | ((uint8_t *)p)[j] = chip->read_byte(mtd); | ||
3089 | if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) == | 3081 | if (onfi_crc16(ONFI_CRC_BASE, (uint8_t *)p, 254) == |
3090 | le16_to_cpu(p->crc)) { | 3082 | le16_to_cpu(p->crc)) { |
3091 | break; | 3083 | break; |