Commit fee4380f authored by Boris Brezillon's avatar Boris Brezillon Committed by Richard Weinberger
Browse files

mtd: nand: pxa3xx: Fix READOOB implementation

In the current driver, OOB bytes are accessed in raw mode, and when a
page access is done with NDCR_SPARE_EN set and NDCR_ECC_EN cleared, the
driver must read the whole spare area (64 bytes in case of a 2k page,
16 bytes for a 512 page). The driver was only reading the free OOB
bytes, which was leaving some unread data in the FIFO and was somehow
leading to a timeout.

We could patch the driver to read ->spare_size + ->ecc_size instead of
just ->spare_size when READOOB is requested, but we'd better make
in-band and OOB accesses consistent.
Since the driver is always accessing in-band data in non-raw mode (with
the ECC engine enabled), we should also access OOB data in this mode.
That's particularly useful when using the BCH engine because in this
mode the free OOB bytes are also ECC protected.

Fixes: 43bcfd2b

 ("mtd: nand: pxa3xx: Add driver-specific ECC BCH support")
Reported-by: default avatarSean Nyekjær <>
Tested-by: default avatarWilly Tarreau <>
Signed-off-by: default avatarBoris Brezillon <>
Acked-by: default avatarEzequiel Garcia <>
Tested-by: default avatarSean Nyekjaer <>
Acked-by: default avatarRobert Jarzmik <>
Signed-off-by: default avatarRichard Weinberger <>
parent 30a7acd5
......@@ -963,6 +963,7 @@ static void prepare_start_command(struct pxa3xx_nand_info *info, int command)
switch (command) {
info->use_ecc = 1;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment