diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2009-10-21 04:22:01 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2009-11-12 02:31:28 -0500 |
commit | 8c1fd89a85f898384df02217c09c98c2f39b4832 (patch) | |
tree | 4fe389ea8ddf2bbefcd2d25545638e787d4c5fac | |
parent | 8ce110ac19bc88b82e3feacfbb3a2ee08a07fe22 (diff) |
mxc_nand: cleanup eccoob descriptions
The original Freescale driver used to have eccoob descriptions like
this:
static struct nand_ecclayout nand_hw_eccoob_8 = {
.eccbytes = 5,
.eccpos = {6, 7, 8, 9, 10},
.oobfree = {{0, 5}, {11, 5}}
};
static struct nand_ecclayout nand_hw_eccoob_16 = {
.eccbytes = 5,
.eccpos = {6, 7, 8, 9, 10},
.oobfree = {{0, 6}, {12, 4}}
};
The former was used for 8bit flashes and the latter for 16bit flashes.
They honored the fact that the bad block marker on 8bit flashes is on byte 5
while on 16bit flashes it is on byte 11.
In the Kernel driver this was copied wrong and we ended up with two identical
descriptions.
Change it so that we have only one description which leaves byte 5 and byte
11 unspecified so that it won't be used by others.
Also, rename the descriptions to nand_hw_eccoob_smallpage and
nand_hw_eccoob_largepage so that it can't be confused with Nand chip bus
widths (what actually happened in this driver)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/mtd/nand/mxc_nand.c | 24 |
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 */ |
132 | static struct nand_ecclayout nand_hw_eccoob_8 = { | 132 | static 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 | ||
138 | static struct nand_ecclayout nand_hw_eccoob_16 = { | 138 | static 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 | |||
144 | static 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; |