aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r--drivers/mtd/nand/mxc_nand.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 06c531485df9..2aae5a7ddbd1 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -129,19 +129,13 @@ struct mxc_nand_host {
129#define SPARE_SINGLEBIT_ERROR 0x1 129#define SPARE_SINGLEBIT_ERROR 0x1
130 130
131/* OOB placement block for use with hardware ecc generation */ 131/* OOB placement block for use with hardware ecc generation */
132static struct nand_ecclayout nand_hw_eccoob_8 = { 132static struct nand_ecclayout nand_hw_eccoob_smallpage = {
133 .eccbytes = 5, 133 .eccbytes = 5,
134 .eccpos = {6, 7, 8, 9, 10}, 134 .eccpos = {6, 7, 8, 9, 10},
135 .oobfree = {{0, 5}, {11, 5}, } 135 .oobfree = {{0, 5}, {12, 4}, }
136}; 136};
137 137
138static struct nand_ecclayout nand_hw_eccoob_16 = { 138static struct nand_ecclayout nand_hw_eccoob_largepage = {
139 .eccbytes = 5,
140 .eccpos = {6, 7, 8, 9, 10},
141 .oobfree = {{0, 5}, {11, 5}, }
142};
143
144static struct nand_ecclayout nand_hw_eccoob_64 = {
145 .eccbytes = 20, 139 .eccbytes = 20,
146 .eccpos = {6, 7, 8, 9, 10, 22, 23, 24, 25, 26, 140 .eccpos = {6, 7, 8, 9, 10, 22, 23, 24, 25, 26,
147 38, 39, 40, 41, 42, 54, 55, 56, 57, 58}, 141 38, 39, 40, 41, 42, 54, 55, 56, 57, 58},
@@ -940,7 +934,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
940 } else { 934 } else {
941 this->ecc.size = 512; 935 this->ecc.size = 512;
942 this->ecc.bytes = 3; 936 this->ecc.bytes = 3;
943 this->ecc.layout = &nand_hw_eccoob_8; 937 this->ecc.layout = &nand_hw_eccoob_smallpage;
944 this->ecc.mode = NAND_ECC_SOFT; 938 this->ecc.mode = NAND_ECC_SOFT;
945 tmp = readw(host->regs + NFC_CONFIG1); 939 tmp = readw(host->regs + NFC_CONFIG1);
946 tmp &= ~NFC_ECC_EN; 940 tmp &= ~NFC_ECC_EN;
@@ -964,7 +958,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
964 /* NAND bus width determines access funtions used by upper layer */ 958 /* NAND bus width determines access funtions used by upper layer */
965 if (pdata->width == 2) { 959 if (pdata->width == 2) {
966 this->options |= NAND_BUSWIDTH_16; 960 this->options |= NAND_BUSWIDTH_16;
967 this->ecc.layout = &nand_hw_eccoob_16; 961 this->ecc.layout = &nand_hw_eccoob_smallpage;
968 } 962 }
969 963
970 /* first scan to find the device and get the page size */ 964 /* first scan to find the device and get the page size */
@@ -978,20 +972,20 @@ static int __init mxcnd_probe(struct platform_device *pdev)
978 if (this->ecc.mode == NAND_ECC_HW) { 972 if (this->ecc.mode == NAND_ECC_HW) {
979 switch (mtd->oobsize) { 973 switch (mtd->oobsize) {
980 case 8: 974 case 8:
981 this->ecc.layout = &nand_hw_eccoob_8; 975 this->ecc.layout = &nand_hw_eccoob_smallpage;
982 break; 976 break;
983 case 16: 977 case 16:
984 this->ecc.layout = &nand_hw_eccoob_16; 978 this->ecc.layout = &nand_hw_eccoob_smallpage;
985 break; 979 break;
986 case 64: 980 case 64:
987 this->ecc.layout = &nand_hw_eccoob_64; 981 this->ecc.layout = &nand_hw_eccoob_largepage;
988 break; 982 break;
989 default: 983 default:
990 /* page size not handled by HW ECC */ 984 /* page size not handled by HW ECC */
991 /* switching back to soft ECC */ 985 /* switching back to soft ECC */
992 this->ecc.size = 512; 986 this->ecc.size = 512;
993 this->ecc.bytes = 3; 987 this->ecc.bytes = 3;
994 this->ecc.layout = &nand_hw_eccoob_8; 988 this->ecc.layout = &nand_hw_eccoob_smallpage;
995 this->ecc.mode = NAND_ECC_SOFT; 989 this->ecc.mode = NAND_ECC_SOFT;
996 this->ecc.calculate = NULL; 990 this->ecc.calculate = NULL;
997 this->ecc.correct = NULL; 991 this->ecc.correct = NULL;