Commit 69d023be authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by David Woodhouse

mtd: mxc_nand: put callback for data correction into devtype struct

This gets rid of one more nfc_is_vX().
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 5e05a2d6
...@@ -154,6 +154,8 @@ struct mxc_nand_devtype_data { ...@@ -154,6 +154,8 @@ struct mxc_nand_devtype_data {
u32 (*get_ecc_status)(struct mxc_nand_host *); u32 (*get_ecc_status)(struct mxc_nand_host *);
struct nand_ecclayout *ecclayout_512, *ecclayout_2k, *ecclayout_4k; struct nand_ecclayout *ecclayout_512, *ecclayout_2k, *ecclayout_4k;
void (*select_chip)(struct mtd_info *mtd, int chip); void (*select_chip)(struct mtd_info *mtd, int chip);
int (*correct_data)(struct mtd_info *mtd, u_char *dat,
u_char *read_ecc, u_char *calc_ecc);
}; };
struct mxc_nand_host { struct mxc_nand_host {
...@@ -1138,6 +1140,7 @@ static const struct mxc_nand_devtype_data imx21_nand_devtype_data = { ...@@ -1138,6 +1140,7 @@ static const struct mxc_nand_devtype_data imx21_nand_devtype_data = {
.ecclayout_2k = &nandv1_hw_eccoob_largepage, .ecclayout_2k = &nandv1_hw_eccoob_largepage,
.ecclayout_4k = &nandv1_hw_eccoob_smallpage, /* XXX: needs fix */ .ecclayout_4k = &nandv1_hw_eccoob_smallpage, /* XXX: needs fix */
.select_chip = mxc_nand_select_chip_v1_v3, .select_chip = mxc_nand_select_chip_v1_v3,
.correct_data = mxc_nand_correct_data_v1,
}; };
/* v21: i.MX25, i.MX35 */ /* v21: i.MX25, i.MX35 */
...@@ -1155,6 +1158,7 @@ static const struct mxc_nand_devtype_data imx25_nand_devtype_data = { ...@@ -1155,6 +1158,7 @@ static const struct mxc_nand_devtype_data imx25_nand_devtype_data = {
.ecclayout_2k = &nandv2_hw_eccoob_largepage, .ecclayout_2k = &nandv2_hw_eccoob_largepage,
.ecclayout_4k = &nandv2_hw_eccoob_4k, .ecclayout_4k = &nandv2_hw_eccoob_4k,
.select_chip = mxc_nand_select_chip_v2, .select_chip = mxc_nand_select_chip_v2,
.correct_data = mxc_nand_correct_data_v2_v3,
}; };
/* v3: i.MX51, i.MX53 */ /* v3: i.MX51, i.MX53 */
...@@ -1172,6 +1176,7 @@ static const struct mxc_nand_devtype_data imx51_nand_devtype_data = { ...@@ -1172,6 +1176,7 @@ static const struct mxc_nand_devtype_data imx51_nand_devtype_data = {
.ecclayout_2k = &nandv2_hw_eccoob_largepage, .ecclayout_2k = &nandv2_hw_eccoob_largepage,
.ecclayout_4k = &nandv2_hw_eccoob_smallpage, /* XXX: needs fix */ .ecclayout_4k = &nandv2_hw_eccoob_smallpage, /* XXX: needs fix */
.select_chip = mxc_nand_select_chip_v1_v3, .select_chip = mxc_nand_select_chip_v1_v3,
.correct_data = mxc_nand_correct_data_v2_v3,
}; };
static int __init mxcnd_probe(struct platform_device *pdev) static int __init mxcnd_probe(struct platform_device *pdev)
...@@ -1275,10 +1280,7 @@ static int __init mxcnd_probe(struct platform_device *pdev) ...@@ -1275,10 +1280,7 @@ static int __init mxcnd_probe(struct platform_device *pdev)
if (pdata->hw_ecc) { if (pdata->hw_ecc) {
this->ecc.calculate = mxc_nand_calculate_ecc; this->ecc.calculate = mxc_nand_calculate_ecc;
this->ecc.hwctl = mxc_nand_enable_hwecc; this->ecc.hwctl = mxc_nand_enable_hwecc;
if (nfc_is_v1()) this->ecc.correct = host->devtype_data->correct_data;
this->ecc.correct = mxc_nand_correct_data_v1;
else
this->ecc.correct = mxc_nand_correct_data_v2_v3;
this->ecc.mode = NAND_ECC_HW; this->ecc.mode = NAND_ECC_HW;
} else { } else {
this->ecc.mode = NAND_ECC_SOFT; this->ecc.mode = NAND_ECC_SOFT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment