On Saturday 26 July 2008 23:23:09 Holger Freyther wrote:
> Hey,
> - Handle hardware_ecc=1 in the kernel and have a default for software..
> (specially after the revert)...
this is how I would support gta02's with an old pre hw ECC bootloader.....
From ffebf2f8e5af956749d7bff4d1ba48dc24b2d406 Mon Sep 17 00:00:00 2001
From: Holger Freyther <[EMAIL PROTECTED]>
Date: Sun, 27 Jul 2008 20:31:06 +0200
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 +++++++++++++++++++
drivers/mtd/nand/s3c2410.c | 2 +-
include/asm-arm/plat-s3c/nand.h | 3 +++
3 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 7ea3c5e..d565bc7 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -880,6 +880,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 = {
@@ -1535,6 +1536,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;
@@ -1554,6 +1569,10 @@ static void __init gta02_machine_init(void)
spin_lock_init(&motion_irq_lock);
+ /* 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/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index 495381c..4413d76 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -656,7 +656,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;
diff --git a/include/asm-arm/plat-s3c/nand.h b/include/asm-arm/plat-s3c/nand.h
index cb87f9e..676a061 100644
--- a/include/asm-arm/plat-s3c/nand.h
+++ b/include/asm-arm/plat-s3c/nand.h
@@ -42,6 +42,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);
};
--
1.5.2.3