aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/mxc_nand.c
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2012-04-23 05:23:39 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-05-14 00:02:55 -0400
commit69d023be00e9bb5368ced679cead9fb25474ec69 (patch)
treeb5149449d9fe7ea9d2edd4609b170dc1b4469e36 /drivers/mtd/nand/mxc_nand.c
parent5e05a2d695f920209991b7a097c2e4ad4d1cdf9e (diff)
mtd: mxc_nand: put callback for data correction into devtype struct
This gets rid of one more nfc_is_vX(). Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/mxc_nand.c')
-rw-r--r--drivers/mtd/nand/mxc_nand.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index 03664d5742d9..4a6d763ab7f7 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -154,6 +154,8 @@ struct mxc_nand_devtype_data {
154 u32 (*get_ecc_status)(struct mxc_nand_host *); 154 u32 (*get_ecc_status)(struct mxc_nand_host *);
155 struct nand_ecclayout *ecclayout_512, *ecclayout_2k, *ecclayout_4k; 155 struct nand_ecclayout *ecclayout_512, *ecclayout_2k, *ecclayout_4k;
156 void (*select_chip)(struct mtd_info *mtd, int chip); 156 void (*select_chip)(struct mtd_info *mtd, int chip);
157 int (*correct_data)(struct mtd_info *mtd, u_char *dat,
158 u_char *read_ecc, u_char *calc_ecc);
157}; 159};
158 160
159struct mxc_nand_host { 161struct mxc_nand_host {
@@ -1138,6 +1140,7 @@ static const struct mxc_nand_devtype_data imx21_nand_devtype_data = {
1138 .ecclayout_2k = &nandv1_hw_eccoob_largepage, 1140 .ecclayout_2k = &nandv1_hw_eccoob_largepage,
1139 .ecclayout_4k = &nandv1_hw_eccoob_smallpage, /* XXX: needs fix */ 1141 .ecclayout_4k = &nandv1_hw_eccoob_smallpage, /* XXX: needs fix */
1140 .select_chip = mxc_nand_select_chip_v1_v3, 1142 .select_chip = mxc_nand_select_chip_v1_v3,
1143 .correct_data = mxc_nand_correct_data_v1,
1141}; 1144};
1142 1145
1143/* v21: i.MX25, i.MX35 */ 1146/* v21: i.MX25, i.MX35 */
@@ -1155,6 +1158,7 @@ static const struct mxc_nand_devtype_data imx25_nand_devtype_data = {
1155 .ecclayout_2k = &nandv2_hw_eccoob_largepage, 1158 .ecclayout_2k = &nandv2_hw_eccoob_largepage,
1156 .ecclayout_4k = &nandv2_hw_eccoob_4k, 1159 .ecclayout_4k = &nandv2_hw_eccoob_4k,
1157 .select_chip = mxc_nand_select_chip_v2, 1160 .select_chip = mxc_nand_select_chip_v2,
1161 .correct_data = mxc_nand_correct_data_v2_v3,
1158}; 1162};
1159 1163
1160/* v3: i.MX51, i.MX53 */ 1164/* v3: i.MX51, i.MX53 */
@@ -1172,6 +1176,7 @@ static const struct mxc_nand_devtype_data imx51_nand_devtype_data = {
1172 .ecclayout_2k = &nandv2_hw_eccoob_largepage, 1176 .ecclayout_2k = &nandv2_hw_eccoob_largepage,
1173 .ecclayout_4k = &nandv2_hw_eccoob_smallpage, /* XXX: needs fix */ 1177 .ecclayout_4k = &nandv2_hw_eccoob_smallpage, /* XXX: needs fix */
1174 .select_chip = mxc_nand_select_chip_v1_v3, 1178 .select_chip = mxc_nand_select_chip_v1_v3,
1179 .correct_data = mxc_nand_correct_data_v2_v3,
1175}; 1180};
1176 1181
1177static int __init mxcnd_probe(struct platform_device *pdev) 1182static int __init mxcnd_probe(struct platform_device *pdev)
@@ -1275,10 +1280,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
1275 if (pdata->hw_ecc) { 1280 if (pdata->hw_ecc) {
1276 this->ecc.calculate = mxc_nand_calculate_ecc; 1281 this->ecc.calculate = mxc_nand_calculate_ecc;
1277 this->ecc.hwctl = mxc_nand_enable_hwecc; 1282 this->ecc.hwctl = mxc_nand_enable_hwecc;
1278 if (nfc_is_v1()) 1283 this->ecc.correct = host->devtype_data->correct_data;
1279 this->ecc.correct = mxc_nand_correct_data_v1;
1280 else
1281 this->ecc.correct = mxc_nand_correct_data_v2_v3;
1282 this->ecc.mode = NAND_ECC_HW; 1284 this->ecc.mode = NAND_ECC_HW;
1283 } else { 1285 } else {
1284 this->ecc.mode = NAND_ECC_SOFT; 1286 this->ecc.mode = NAND_ECC_SOFT;