From 314c6033037e4f3e57638caab98fe2711b79b416 Mon Sep 17 00:00:00 2001 From: Terry Lv Date: Fri, 20 May 2011 13:28:13 +0800 Subject: ENGR00143704: U_BOOT: Nand oobsize is wrong in some nand chips Nand oobsize is wrong in some nand chips. Signed-off-by: Terry Lv --- drivers/mtd/nand/gpmi_nfc_gpmi.h | 6 ++++-- drivers/mtd/nand/gpmi_nfc_mil.c | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) (limited to 'drivers') diff --git a/drivers/mtd/nand/gpmi_nfc_gpmi.h b/drivers/mtd/nand/gpmi_nfc_gpmi.h index bd56e4c..9f7780d 100644 --- a/drivers/mtd/nand/gpmi_nfc_gpmi.h +++ b/drivers/mtd/nand/gpmi_nfc_gpmi.h @@ -1,7 +1,7 @@ /* * Freescale GPMI Register Definitions * - * Copyright 2008-2010 Freescale Semiconductor, Inc. All Rights Reserved. + * Copyright 2008-2011 Freescale Semiconductor, Inc. All Rights Reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -802,7 +802,9 @@ static inline u32 gpmi_nfc_get_ecc_strength(u32 page_data_size, return 16; else return 0; - } else + } else if (8192 == page_data_size) + return 24; + else return 0; } diff --git a/drivers/mtd/nand/gpmi_nfc_mil.c b/drivers/mtd/nand/gpmi_nfc_mil.c index 889144c..f41a02e 100644 --- a/drivers/mtd/nand/gpmi_nfc_mil.c +++ b/drivers/mtd/nand/gpmi_nfc_mil.c @@ -904,20 +904,22 @@ static int gpmi_nfc_scan_bbt(struct mtd_info *mtd) /* Correct mtd setting */ mtd->size = dev_info->chip_size_in_bytes * nand->numchips; - /* + mtd->writesize = 1 << (fls(dev_info->page_total_size_in_bytes) - 1); mtd->oobsize = dev_info->page_total_size_in_bytes - mtd->writesize; mtd->erasesize = dev_info->block_size_in_pages * mtd->writesize; - */ + mtd->ecclayout = layout; mtd->oobavail = mtd->oobsize; - mtd->oobsize = mtd->oobavail + layout->eccbytes; mtd->subpage_sft = 0; /* We don't support sub-page writing. */ /* Configure the struct nand_ecclayout. */ - layout->oobavail = mtd->oobavail; + layout->eccbytes = 0; + layout->oobavail = mtd->oobsize; layout->oobfree[0].offset = 0; - layout->oobfree[0].length = layout->oobavail; + layout->oobfree[0].length = mtd->oobsize; + + nand->ecc.layout = layout; /* Configure the struct nand_chip. */ /* -- cgit v1.1