aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorAndy Green <andy@warmcat.com>2009-05-10 16:41:25 -0400
committerBen Dooks <ben-linux@fluff.org>2009-05-30 12:54:40 -0400
commit8c3e843d56f74889f3ff32202e82e3bc16d0d552 (patch)
treee5ed7eaf768ebbf962154c5a3c1e324b973fba84 /drivers/mtd
parent3db72151aa4c246f8bdb8b3501972e1f1b32fe0d (diff)
[MTD] [NAND] S3C2410: NAND ECC by chip rather than global
This makes us take note about the chosen ECC mode per-chip and not the one set globally. Signed-off-by: Andy Green <andy@warmcat.com> Signed-off-by: Nelson Castillo <arhuaco@freaks-unidos.net> [ben-linux@fluff.org: andy@openmoko.com => andy@warmcat.com, rewrite subject] Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/s3c2410.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index a2d1c70c5227..daa4af918205 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -819,6 +819,21 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
819 819
820 if (set->disable_ecc) 820 if (set->disable_ecc)
821 chip->ecc.mode = NAND_ECC_NONE; 821 chip->ecc.mode = NAND_ECC_NONE;
822
823 switch (chip->ecc.mode) {
824 case NAND_ECC_NONE:
825 dev_info(info->device, "NAND ECC disabled\n");
826 break;
827 case NAND_ECC_SOFT:
828 dev_info(info->device, "NAND soft ECC\n");
829 break;
830 case NAND_ECC_HW:
831 dev_info(info->device, "NAND hardware ECC\n");
832 break;
833 default:
834 dev_info(info->device, "NAND ECC UNKNOWN\n");
835 break;
836 }
822} 837}
823 838
824/** 839/**
@@ -840,18 +855,19 @@ static void s3c2410_nand_update_chip(struct s3c2410_nand_info *info,
840 dev_dbg(info->device, "chip %p => page shift %d\n", 855 dev_dbg(info->device, "chip %p => page shift %d\n",
841 chip, chip->page_shift); 856 chip, chip->page_shift);
842 857
843 if (hardware_ecc) { 858 if (chip->ecc.mode != NAND_ECC_HW)
859 return;
860
844 /* change the behaviour depending on wether we are using 861 /* change the behaviour depending on wether we are using
845 * the large or small page nand device */ 862 * the large or small page nand device */
846 863
847 if (chip->page_shift > 10) { 864 if (chip->page_shift > 10) {
848 chip->ecc.size = 256; 865 chip->ecc.size = 256;
849 chip->ecc.bytes = 3; 866 chip->ecc.bytes = 3;
850 } else { 867 } else {
851 chip->ecc.size = 512; 868 chip->ecc.size = 512;
852 chip->ecc.bytes = 3; 869 chip->ecc.bytes = 3;
853 chip->ecc.layout = &nand_hw_eccoob; 870 chip->ecc.layout = &nand_hw_eccoob;
854 }
855 } 871 }
856} 872}
857 873