[U-Boot] [U-Boot, V2, 2/2] mtd: nand: omap: fix ecc ops assignment when changing ecc

Scott Wood
2013-12-17T23:49:05Z

On Tue, Dec 17, 2013 at 03:18:01PM +0200, Nikita Kiryanov wrote:
> If we change to software ecc and then back to hardware ecc, the nand ecc ops
> pointers are populated with incorrect function pointers. This is related to the
> way nand_scan_tail() handles assigning functions to ecc ops:
>
> If we are switching to software ecc/no ecc, it assigns default functions to the
> ecc ops pointers unconditionally, but if we are switching to hardware ecc,
> the default hardware ecc functions are assigned to ops pointers only if these
> pointers are NULL (so that drivers could set their own functions). In the case
> of omap_gpmc.c driver, when we switch to sw ecc, sw ecc functions are
> assigned to ecc ops by nand_scan_tail(), and when we later switch to hw ecc,
> the ecc ops pointers are not NULL, so nand_scan_tail() does not overwrite
> them with hw ecc functions.
> The result: sw ecc functions used to write hw ecc data.
>
> Clear the ecc ops pointers in omap_gpmc.c when switching ecc types, so that
> ops which were not assigned by the driver will get the correct default values
> from nand_scan_tail().
>
> Cc: Scott Wood <scottwood@freescale.com>
> Cc: Pekon Gupta <pekon@ti.com>
> Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
>
> ---
> Changes in V2:
> - Clear the ops after error checks, not before.
> - Use memset on ecc struct to clear the ops.
>
> drivers/mtd/nand/omap_gpmc.c | 3 +++
> 1 file changed, 3 insertions(+)

Applied to u-boot-nand-flash.git

-Scott