1 From cb3cc53a76c7f1f7c827d048db7a849e77071515 Mon Sep 17 00:00:00 2001
2 From: Holger Freyther <zecke@openmoko.org>
3 Date: Wed, 13 Aug 2008 11:28:00 +0100
4 Subject: [PATCH] From 5ee1ee9e1c8a652b0f9cde72ad5e547db87d4d67 Mon Sep 17 00:00:00 2001
5 Subject: [PATCH] [gta02] Disable hardware ECC unless we get instructed to enable it
6 This is restoring the old behavior in regard to ECC. Even if
7 hardware ECC was compiled in we didn't use it. Make this a runtime
8 option. If the bootloader passes hardware_ecc we will enable the
12 arch/arm/mach-s3c2440/mach-gta02.c | 19 +++++++++++++++++++
13 drivers/mtd/nand/s3c2410.c | 2 +-
14 include/asm-arm/plat-s3c/nand.h | 3 +++
15 3 files changed, 23 insertions(+), 1 deletions(-)
17 diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
18 index ff3c3c0..7d4cc67 100644
19 --- a/arch/arm/mach-s3c2440/mach-gta02.c
20 +++ b/arch/arm/mach-s3c2440/mach-gta02.c
21 @@ -882,6 +882,7 @@ static struct s3c2410_platform_nand gta02_nand_info = {
23 .nr_sets = ARRAY_SIZE(gta02_nand_sets),
24 .sets = gta02_nand_sets,
28 static struct s3c24xx_mci_pdata gta02_mmc_cfg = {
29 @@ -1546,6 +1547,20 @@ static irqreturn_t ar6000_wow_irq(int irq, void *param)
36 +static char hardware_ecc_str[4] __initdata = "";
38 +static int __init hardware_ecc_setup(char *str)
41 + strlcpy(hardware_ecc_str, str, sizeof(hardware_ecc_str));
45 +__setup("hardware_ecc=", hardware_ecc_setup);
47 static void __init gta02_machine_init(void)
50 @@ -1565,6 +1580,10 @@ static void __init gta02_machine_init(void)
52 spin_lock_init(&motion_irq_lock);
54 + /* do not force soft ecc if we are asked to use hardware_ecc */
55 + if (hardware_ecc_str[0] == '1')
56 + gta02_nand_info.software_ecc = 0;
58 s3c_device_usb.dev.platform_data = >a02_usb_info;
59 s3c_device_nand.dev.platform_data = >a02_nand_info;
60 s3c_device_sdi.dev.platform_data = >a02_mmc_cfg;
61 diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
62 index 495381c..4413d76 100644
63 --- a/drivers/mtd/nand/s3c2410.c
64 +++ b/drivers/mtd/nand/s3c2410.c
65 @@ -656,7 +656,7 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
66 nmtd->mtd.owner = THIS_MODULE;
70 + if (!info->platform->software_ecc && hardware_ecc) {
71 chip->ecc.calculate = s3c2410_nand_calculate_ecc;
72 chip->ecc.correct = s3c2410_nand_correct_data;
73 chip->ecc.mode = NAND_ECC_HW;
74 diff --git a/include/asm-arm/plat-s3c/nand.h b/include/asm-arm/plat-s3c/nand.h
75 index cb87f9e..676a061 100644
76 --- a/include/asm-arm/plat-s3c/nand.h
77 +++ b/include/asm-arm/plat-s3c/nand.h
78 @@ -42,6 +42,9 @@ struct s3c2410_platform_nand {
80 struct s3c2410_nand_set *sets;
82 + /* force software_ecc at runtime */
85 void (*select_chip)(struct s3c2410_nand_set *,