diff options
Diffstat (limited to 'drivers/mtd/nand/omap2.c')
-rw-r--r-- | drivers/mtd/nand/omap2.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c index f0ed92e210a1..5967b385141b 100644 --- a/drivers/mtd/nand/omap2.c +++ b/drivers/mtd/nand/omap2.c | |||
@@ -931,7 +931,7 @@ static int omap_calculate_ecc(struct mtd_info *mtd, const u_char *dat, | |||
931 | u32 val; | 931 | u32 val; |
932 | 932 | ||
933 | val = readl(info->reg.gpmc_ecc_config); | 933 | val = readl(info->reg.gpmc_ecc_config); |
934 | if (((val >> ECC_CONFIG_CS_SHIFT) & ~CS_MASK) != info->gpmc_cs) | 934 | if (((val >> ECC_CONFIG_CS_SHIFT) & CS_MASK) != info->gpmc_cs) |
935 | return -EINVAL; | 935 | return -EINVAL; |
936 | 936 | ||
937 | /* read ecc result */ | 937 | /* read ecc result */ |
@@ -1794,9 +1794,12 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1794 | } | 1794 | } |
1795 | 1795 | ||
1796 | /* populate MTD interface based on ECC scheme */ | 1796 | /* populate MTD interface based on ECC scheme */ |
1797 | nand_chip->ecc.layout = &omap_oobinfo; | ||
1798 | ecclayout = &omap_oobinfo; | 1797 | ecclayout = &omap_oobinfo; |
1799 | switch (info->ecc_opt) { | 1798 | switch (info->ecc_opt) { |
1799 | case OMAP_ECC_HAM1_CODE_SW: | ||
1800 | nand_chip->ecc.mode = NAND_ECC_SOFT; | ||
1801 | break; | ||
1802 | |||
1800 | case OMAP_ECC_HAM1_CODE_HW: | 1803 | case OMAP_ECC_HAM1_CODE_HW: |
1801 | pr_info("nand: using OMAP_ECC_HAM1_CODE_HW\n"); | 1804 | pr_info("nand: using OMAP_ECC_HAM1_CODE_HW\n"); |
1802 | nand_chip->ecc.mode = NAND_ECC_HW; | 1805 | nand_chip->ecc.mode = NAND_ECC_HW; |
@@ -1848,7 +1851,7 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1848 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1851 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1849 | nand_chip->ecc.size, | 1852 | nand_chip->ecc.size, |
1850 | nand_chip->ecc.bytes, | 1853 | nand_chip->ecc.bytes, |
1851 | &nand_chip->ecc.layout); | 1854 | &ecclayout); |
1852 | if (!nand_chip->ecc.priv) { | 1855 | if (!nand_chip->ecc.priv) { |
1853 | pr_err("nand: error: unable to use s/w BCH library\n"); | 1856 | pr_err("nand: error: unable to use s/w BCH library\n"); |
1854 | err = -EINVAL; | 1857 | err = -EINVAL; |
@@ -1923,7 +1926,7 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
1923 | nand_chip->ecc.priv = nand_bch_init(mtd, | 1926 | nand_chip->ecc.priv = nand_bch_init(mtd, |
1924 | nand_chip->ecc.size, | 1927 | nand_chip->ecc.size, |
1925 | nand_chip->ecc.bytes, | 1928 | nand_chip->ecc.bytes, |
1926 | &nand_chip->ecc.layout); | 1929 | &ecclayout); |
1927 | if (!nand_chip->ecc.priv) { | 1930 | if (!nand_chip->ecc.priv) { |
1928 | pr_err("nand: error: unable to use s/w BCH library\n"); | 1931 | pr_err("nand: error: unable to use s/w BCH library\n"); |
1929 | err = -EINVAL; | 1932 | err = -EINVAL; |
@@ -2012,6 +2015,9 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
2012 | goto return_error; | 2015 | goto return_error; |
2013 | } | 2016 | } |
2014 | 2017 | ||
2018 | if (info->ecc_opt == OMAP_ECC_HAM1_CODE_SW) | ||
2019 | goto scan_tail; | ||
2020 | |||
2015 | /* all OOB bytes from oobfree->offset till end off OOB are free */ | 2021 | /* all OOB bytes from oobfree->offset till end off OOB are free */ |
2016 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; | 2022 | ecclayout->oobfree->length = mtd->oobsize - ecclayout->oobfree->offset; |
2017 | /* check if NAND device's OOB is enough to store ECC signatures */ | 2023 | /* check if NAND device's OOB is enough to store ECC signatures */ |
@@ -2021,7 +2027,9 @@ static int omap_nand_probe(struct platform_device *pdev) | |||
2021 | err = -EINVAL; | 2027 | err = -EINVAL; |
2022 | goto return_error; | 2028 | goto return_error; |
2023 | } | 2029 | } |
2030 | nand_chip->ecc.layout = ecclayout; | ||
2024 | 2031 | ||
2032 | scan_tail: | ||
2025 | /* second phase scan */ | 2033 | /* second phase scan */ |
2026 | if (nand_scan_tail(mtd)) { | 2034 | if (nand_scan_tail(mtd)) { |
2027 | err = -ENXIO; | 2035 | err = -ENXIO; |