mtd: nand_omap_gpmc: fix BCH error correction
BCH error detection and correction was only looking at the first
of four syndrome polynomials, which meant it was failing to detect
and correct bitflips in the last 3/4 of the data. In effect, only
the first 512 bytes of a 2048 byte page were being protected by ECC.

The syndrome polynomials (BCH error codes) are stored in the NAND's
OOB, each of which protects 512 bytes of data. The driver used
eccsteps = 1 which effectively made it only use the first polynomial,
and therefore was only protecting the first 512 bytes of the page.

The fix is to pull over a bit of code from the kernel's
omap_correct_data() that sets eccsteps = 4 when the page size is 2048
bytes and hardware ECC is being used.

Signed-off-by: Matt Reimer <mreimer@sdgsystems.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
1 parent 340a6e8 commit dec7b4d2bf9c94a4760413a79d885842db902b65
@Matt Reimer Matt Reimer authored on 14 Apr 2017
Sascha Hauer committed on 19 Apr 2017
Showing 1 changed file
View
drivers/mtd/nand/nand_omap_gpmc.c