aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/s3c2410.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/drivers/mtd/nand/s3c2410.c b/drivers/mtd/nand/s3c2410.c
index e8e030171ec4..0ddfd6de75c5 100644
--- a/drivers/mtd/nand/s3c2410.c
+++ b/drivers/mtd/nand/s3c2410.c
@@ -418,6 +418,15 @@ static void s3c2410_nand_enable_hwecc(struct mtd_info *mtd, int mode)
418 writel(ctrl, info->regs + S3C2410_NFCONF); 418 writel(ctrl, info->regs + S3C2410_NFCONF);
419} 419}
420 420
421static void s3c2412_nand_enable_hwecc(struct mtd_info *mtd, int mode)
422{
423 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
424 unsigned long ctrl;
425
426 ctrl = readl(info->regs + S3C2440_NFCONT);
427 writel(ctrl | S3C2412_NFCONT_INIT_MAIN_ECC, info->regs + S3C2440_NFCONT);
428}
429
421static void s3c2440_nand_enable_hwecc(struct mtd_info *mtd, int mode) 430static void s3c2440_nand_enable_hwecc(struct mtd_info *mtd, int mode)
422{ 431{
423 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); 432 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
@@ -441,6 +450,20 @@ static int s3c2410_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u
441 return 0; 450 return 0;
442} 451}
443 452
453static int s3c2412_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
454{
455 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
456 unsigned long ecc = readl(info->regs + S3C2412_NFMECC0);
457
458 ecc_code[0] = ecc;
459 ecc_code[1] = ecc >> 8;
460 ecc_code[2] = ecc >> 16;
461
462 pr_debug("calculate_ecc: returning ecc %02x,%02x,%02x\n", ecc_code[0], ecc_code[1], ecc_code[2]);
463
464 return 0;
465}
466
444static int s3c2440_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code) 467static int s3c2440_nand_calculate_ecc(struct mtd_info *mtd, const u_char *dat, u_char *ecc_code)
445{ 468{
446 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd); 469 struct s3c2410_nand_info *info = s3c2410_nand_mtd_toinfo(mtd);
@@ -618,6 +641,10 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
618 break; 641 break;
619 642
620 case TYPE_S3C2412: 643 case TYPE_S3C2412:
644 chip->ecc.hwctl = s3c2412_nand_enable_hwecc;
645 chip->ecc.calculate = s3c2412_nand_calculate_ecc;
646 break;
647
621 case TYPE_S3C2440: 648 case TYPE_S3C2440:
622 chip->ecc.hwctl = s3c2440_nand_enable_hwecc; 649 chip->ecc.hwctl = s3c2440_nand_enable_hwecc;
623 chip->ecc.calculate = s3c2440_nand_calculate_ecc; 650 chip->ecc.calculate = s3c2440_nand_calculate_ecc;