[U-Boot] [PATCH-OMAP3] OMAP3: Fix broken NAND ECC HW switch
dirk.behme at googlemail.com
dirk.behme at googlemail.com
Tue Nov 11 16:00:37 CET 2008
Fix broken NAND ECC HW switch and invert logic of if(!hardware) for easier
reading.
---
drivers/mtd/nand/omap_gpmc.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
Index: u-boot-arm/drivers/mtd/nand/omap_gpmc.c
===================================================================
--- u-boot-arm.orig/drivers/mtd/nand/omap_gpmc.c
+++ u-boot-arm/drivers/mtd/nand/omap_gpmc.c
@@ -255,12 +255,17 @@ void omap_nand_switch_ecc(int32_t hardwa
nand->options = NAND_NO_PADDING | NAND_CACHEPRG | NAND_NO_AUTOINCR |
NAND_NO_AUTOINCR;
+ /* Reset ecc interface */
+ nand->ecc.read_page = NULL;
+ nand->ecc.write_page = NULL;
+ nand->ecc.read_oob = NULL;
+ nand->ecc.write_oob = NULL;
+ nand->ecc.hwctl = NULL;
+ nand->ecc.correct = NULL;
+ nand->ecc.calculate = NULL;
+
/* Setup the ecc configurations again */
- if (!hardware) {
- nand->ecc.mode = NAND_ECC_SOFT;
- /* Use mtd default settings */
- nand->ecc.layout = NULL;
- } else {
+ if (hardware) {
nand->ecc.mode = NAND_ECC_HW;
nand->ecc.layout = &hw_nand_oob;
nand->ecc.size = 512;
@@ -269,6 +274,12 @@ void omap_nand_switch_ecc(int32_t hardwa
nand->ecc.correct = omap_correct_data;
nand->ecc.calculate = omap_calculate_ecc;
omap_hwecc_init(nand);
+ printf("HW ECC selected\n");
+ } else {
+ nand->ecc.mode = NAND_ECC_SOFT;
+ /* Use mtd default settings */
+ nand->ecc.layout = NULL;
+ printf("SW ECC selected\n");
}
/* Update NAND handling after ECC mode switch */
More information about the U-Boot
mailing list