aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorRoger Quadros <rogerq@ti.com>2014-08-25 19:15:32 -0400
committerTony Lindgren <tony@atomide.com>2014-08-25 19:15:32 -0400
commit7d5929c1f34304ca5a970cfde8044053e56aa8c9 (patch)
tree411c3fa537815dd726d4123a59f208402260483f /drivers/mtd
parent52addcf9d6669fa439387610bc65c92fa0980cef (diff)
mtd: nand: omap: Revert to using software ECC by default
For v3.12 and prior, 1-bit Hamming code ECC via software was the default choice. Commit c66d039197e4 in v3.13 changed the behaviour to use 1-bit Hamming code via Hardware using a different ECC layout i.e. (ROM code layout) than what is used by software ECC. This ECC layout change causes NAND filesystems created in v3.12 and prior to be unusable in v3.13 and later. So revert back to using software ECC by default if an ECC scheme is not explicitely specified. This defect can be observed on the following boards during legacy boot -omap3beagle -omap3touchbook -overo -am3517crane -devkit8000 -ldp -3430sdp Signed-off-by: Roger Quadros <rogerq@ti.com> Tested-by: Grazvydas Ignotas <notasas@gmail.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/omap2.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/mtd/nand/omap2.c b/drivers/mtd/nand/omap2.c
index f0ed92e210a1..4dd617897eee 100644
--- a/drivers/mtd/nand/omap2.c
+++ b/drivers/mtd/nand/omap2.c
@@ -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
2032scan_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;