91 lines
3.0 KiB
Diff
91 lines
3.0 KiB
Diff
|
From cb3cc53a76c7f1f7c827d048db7a849e77071515 Mon Sep 17 00:00:00 2001
|
||
|
From: Holger Freyther <zecke@openmoko.org>
|
||
|
Date: Wed, 13 Aug 2008 11:28:00 +0100
|
||
|
Subject: [PATCH] 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 +++++++++++++++++++
|
||
|
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 ff3c3c0..7d4cc67 100644
|
||
|
--- a/arch/arm/mach-s3c2440/mach-gta02.c
|
||
|
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
|
||
|
@@ -882,6 +882,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 = {
|
||
|
@@ -1546,6 +1547,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;
|
||
|
@@ -1565,6 +1580,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.6.5
|
||
|
|