From 685b99ad165ddb7eaa64962e66342f6bb1d48b30 Mon Sep 17 00:00:00 2001 From: Holger Freyther Date: Wed, 19 Nov 2008 17:10:51 +0000 Subject: From 5ee1ee9e1c8a652b0f9cde72ad5e547db87d4d67 Mon Sep 17 00:00:00 2001 Subject: [PATCH] [gta02] Disable hardware ECC unless we get instructed to enable it This is restoring the old behavior in regard to ECC. Even if hardware ECC was compiled in we didn't use it. Make this a runtime option. If the bootloader passes hardware_ecc we will enable the hardware ECC for real. --- arch/arm/mach-s3c2440/mach-gta02.c | 19 +++++++++++++++++++ arch/arm/plat-s3c/include/plat/nand.h | 3 +++ drivers/mtd/nand/s3c2410.c | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c index b73205ebd98..ad500f31d3b 100644 --- a/arch/arm/mach-s3c2440/mach-gta02.c +++ b/arch/arm/mach-s3c2440/mach-gta02.c @@ -883,6 +883,7 @@ static struct s3c2410_platform_nand gta02_nand_info = { .twrph1 = 20, .nr_sets = ARRAY_SIZE(gta02_nand_sets), .sets = gta02_nand_sets, + .software_ecc = 1, }; static struct s3c24xx_mci_pdata gta02_mmc_cfg = { @@ -1547,6 +1548,20 @@ static irqreturn_t ar6000_wow_irq(int irq, void *param) return IRQ_HANDLED; } +/* + * hardware_ecc=1|0 + */ +static char hardware_ecc_str[4] __initdata = ""; + +static int __init hardware_ecc_setup(char *str) +{ + if (str) + strlcpy(hardware_ecc_str, str, sizeof(hardware_ecc_str)); + return 1; +} + +__setup("hardware_ecc=", hardware_ecc_setup); + static void __init gta02_machine_init(void) { int rc; @@ -1569,6 +1584,10 @@ static void __init gta02_machine_init(void) /* Glamo chip select optimization */ /* *((u32 *)(S3C2410_MEMREG(((1 + 1) << 2)))) = 0x1280; */ + /* do not force soft ecc if we are asked to use hardware_ecc */ + if (hardware_ecc_str[0] == '1') + gta02_nand_info.software_ecc = 0; + s3c_device_usb.dev.platform_data = >a02_usb_info; s3c_device_nand.dev.platform_data = >a02_nand_info; s3c_device_sdi.dev.platform_data = >a02_mmc_cfg; diff --git a/arch/arm/plat-s3c/include/plat/nand.h b/arch/arm/plat-s3c/include/plat/nand.h index 048b0f03adf..e34eeb9c327 100644 --- a/arch/arm/plat-s3c/include/plat/nand.h +++ b/arch/arm/plat-s3c/include/plat/nand.h @@ -47,6 +47,9 @@ struct s3c2410_platform_nand { int nr_sets; struct s3c2410_nand_set *sets; + /* force software_ecc at runtime */ + int software_ecc; + void (*select_chip)(struct s3c2410_nand_set *, int chip); }; diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c index a268575b381..7f68d8c59bb 100644 --- a/drivers/mtd/nand/s3c2410.c +++ b/drivers/mtd/nand/s3c2410.c @@ -744,7 +744,7 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info, nmtd->mtd.owner = THIS_MODULE; nmtd->set = set; - if (hardware_ecc) { + if (!info->platform->software_ecc && hardware_ecc) { chip->ecc.calculate = s3c2410_nand_calculate_ecc; chip->ecc.correct = s3c2410_nand_correct_data; chip->ecc.mode = NAND_ECC_HW; -- cgit v1.2.3