aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorSukumar Ghorai <s-ghorai@ti.com>2011-01-28 05:12:08 -0500
committerTony Lindgren <tony@atomide.com>2011-02-17 18:32:54 -0500
commitf3d73f362d689a1d044e77964864f0a8ea0217f3 (patch)
tree78952365f2a575234fe8cfa0bdf04e268080cd1a /drivers/mtd
parent317379a975c07fe63bc4f86dabd668df96ff3df2 (diff)
omap3: nand: ecc layout select from board file
This patch makes it possible to select sw or hw (different layout options) ecc scheme supported by omap nand driver. Signed-off-by: Vimal Singh <vimalsingh@ti.com> Signed-off-by: Sukumar Ghorai <s-ghorai@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/omap2.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index f1648fd5924a..6d4a42e39380 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -626,8 +626,6 @@ static int omap_verify_buf(struct mtd_info *mtd, const u_char * buf, int len)
626 return 0; 626 return 0;
627} 627}
628 628
629#ifdef CONFIG_MTD_NAND_OMAP_HWECC
630
631/** 629/**
632 * gen_true_ecc - This function will generate true ECC value 630 * gen_true_ecc - This function will generate true ECC value
633 * @ecc_buf: buffer to store ecc code 631 * @ecc_buf: buffer to store ecc code
@@ -847,8 +845,6 @@ static void omap_enable_hwecc(struct mtd_info *mtd, int mode)
847 gpmc_enable_hwecc(info->gpmc_cs, mode, dev_width, info->nand.ecc.size); 845 gpmc_enable_hwecc(info->gpmc_cs, mode, dev_width, info->nand.ecc.size);
848} 846}
849 847
850#endif
851
852/** 848/**
853 * omap_wait - wait until the command is done 849 * omap_wait - wait until the command is done
854 * @mtd: MTD device structure 850 * @mtd: MTD device structure
@@ -1038,17 +1034,17 @@ static int __devinit omap_nand_probe(struct platform_device *pdev)
1038 1034
1039 info->nand.verify_buf = omap_verify_buf; 1035 info->nand.verify_buf = omap_verify_buf;
1040 1036
1041#ifdef CONFIG_MTD_NAND_OMAP_HWECC 1037 /* selsect the ecc type */
1042 info->nand.ecc.bytes = 3; 1038 if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_DEFAULT)
1043 info->nand.ecc.size = 512; 1039 info->nand.ecc.mode = NAND_ECC_SOFT;
1044 info->nand.ecc.calculate = omap_calculate_ecc; 1040 else if (pdata->ecc_opt == OMAP_ECC_HAMMING_CODE_HW) {
1045 info->nand.ecc.hwctl = omap_enable_hwecc; 1041 info->nand.ecc.bytes = 3;
1046 info->nand.ecc.correct = omap_correct_data; 1042 info->nand.ecc.size = 512;
1047 info->nand.ecc.mode = NAND_ECC_HW; 1043 info->nand.ecc.calculate = omap_calculate_ecc;
1048 1044 info->nand.ecc.hwctl = omap_enable_hwecc;
1049#else 1045 info->nand.ecc.correct = omap_correct_data;
1050 info->nand.ecc.mode = NAND_ECC_SOFT; 1046 info->nand.ecc.mode = NAND_ECC_HW;
1051#endif 1047 }
1052 1048
1053 /* DIP switches on some boards change between 8 and 16 bit 1049 /* DIP switches on some boards change between 8 and 16 bit
1054 * bus widths for flash. Try the other width if the first try fails. 1050 * bus widths for flash. Try the other width if the first try fails.