diff options
author | Matthieu CASTET <matthieu.castet@parrot.com> | 2012-11-06 05:51:44 -0500 |
---|---|---|
committer | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2012-12-03 09:36:52 -0500 |
commit | 64b37b2a63eb2f80b65c7185f0013f8ffc637ae3 (patch) | |
tree | ccc8cd81dbcbef0fb8d69856a00dfb795d78b80a /drivers/mtd | |
parent | 2fd71a294a0aac407ec69e04916dc28eb39c8ac0 (diff) |
mtd: nand: add NAND_BUSWIDTH_AUTO to autodetect bus width
The driver call nand_scan_ident in 8 bit mode, then
readid or onfi detection are done (and detect bus width).
The driver should update its bus width before calling nand_scan_tail.
This work because readid and onfi are read work 8 byte mode.
Note that nand_scan_ident send command (NAND_CMD_RESET, NAND_CMD_READID, NAND_CMD_PARAM), address and read data
The ONFI specificication is not very clear for x16 device if high byte of address should be driven to 0,
but according to [1] it should be ok to not drive it during autodetection.
[1]
3.3.2. Target Initialization
[...]
The Read ID and Read Parameter Page commands only use the lower 8-bits of the data bus.
The host shall not issue commands that use a word data width on x16 devices until the host
determines the device supports a 16-bit data bus width in the parameter page.
Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 6f58e1633e2f..5851c51ac2df 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -3250,11 +3250,15 @@ ident_done: | |||
3250 | break; | 3250 | break; |
3251 | } | 3251 | } |
3252 | 3252 | ||
3253 | /* | 3253 | if (chip->options & NAND_BUSWIDTH_AUTO) { |
3254 | * Check, if buswidth is correct. Hardware drivers should set | 3254 | WARN_ON(chip->options & NAND_BUSWIDTH_16); |
3255 | * chip correct! | 3255 | chip->options |= busw; |
3256 | */ | 3256 | nand_set_defaults(chip, busw); |
3257 | if (busw != (chip->options & NAND_BUSWIDTH_16)) { | 3257 | } else if (busw != (chip->options & NAND_BUSWIDTH_16)) { |
3258 | /* | ||
3259 | * Check, if buswidth is correct. Hardware drivers should set | ||
3260 | * chip correct! | ||
3261 | */ | ||
3258 | pr_info("NAND device: Manufacturer ID:" | 3262 | pr_info("NAND device: Manufacturer ID:" |
3259 | " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, | 3263 | " 0x%02x, Chip ID: 0x%02x (%s %s)\n", *maf_id, |
3260 | *dev_id, nand_manuf_ids[maf_idx].name, mtd->name); | 3264 | *dev_id, nand_manuf_ids[maf_idx].name, mtd->name); |