mtd: rawnand: Use the new ECC engine type enumeration
[linux-2.6-microblaze.git] / drivers / mtd / nand / raw / mxc_nand.c
index 09dacb8..d4200eb 100644 (file)
@@ -137,8 +137,8 @@ struct mxc_nand_devtype_data {
        u32 (*get_ecc_status)(struct mxc_nand_host *);
        const struct mtd_ooblayout_ops *ooblayout;
        void (*select_chip)(struct nand_chip *chip, int cs);
-       int (*setup_data_interface)(struct nand_chip *chip, int csline,
-                                   const struct nand_data_interface *conf);
+       int (*setup_interface)(struct nand_chip *chip, int csline,
+                              const struct nand_interface_config *conf);
        void (*enable_hwecc)(struct nand_chip *chip, bool enable);
 
        /*
@@ -669,7 +669,7 @@ static void mxc_nand_enable_hwecc_v1_v2(struct nand_chip *chip, bool enable)
        struct mxc_nand_host *host = nand_get_controller_data(chip);
        uint16_t config1;
 
-       if (chip->ecc.mode != NAND_ECC_HW)
+       if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST)
                return;
 
        config1 = readw(NFC_V1_V2_CONFIG1);
@@ -687,7 +687,7 @@ static void mxc_nand_enable_hwecc_v3(struct nand_chip *chip, bool enable)
        struct mxc_nand_host *host = nand_get_controller_data(chip);
        uint32_t config2;
 
-       if (chip->ecc.mode != NAND_ECC_HW)
+       if (chip->ecc.engine_type != NAND_ECC_ENGINE_TYPE_ON_HOST)
                return;
 
        config2 = readl(NFC_V3_CONFIG2);
@@ -1117,7 +1117,8 @@ static void preset_v1(struct mtd_info *mtd)
        struct mxc_nand_host *host = nand_get_controller_data(nand_chip);
        uint16_t config1 = 0;
 
-       if (nand_chip->ecc.mode == NAND_ECC_HW && mtd->writesize)
+       if (nand_chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST &&
+           mtd->writesize)
                config1 |= NFC_V1_V2_CONFIG1_ECC_EN;
 
        if (!host->devtype_data->irqpending_quirk)
@@ -1139,8 +1140,8 @@ static void preset_v1(struct mtd_info *mtd)
        writew(0x4, NFC_V1_V2_WRPROT);
 }
 
-static int mxc_nand_v2_setup_data_interface(struct nand_chip *chip, int csline,
-                                       const struct nand_data_interface *conf)
+static int mxc_nand_v2_setup_interface(struct nand_chip *chip, int csline,
+                                      const struct nand_interface_config *conf)
 {
        struct mxc_nand_host *host = nand_get_controller_data(chip);
        int tRC_min_ns, tRC_ps, ret;
@@ -1227,7 +1228,7 @@ static void preset_v2(struct mtd_info *mtd)
        if (mtd->writesize) {
                uint16_t pages_per_block = mtd->erasesize / mtd->writesize;
 
-               if (nand_chip->ecc.mode == NAND_ECC_HW)
+               if (nand_chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST)
                        config1 |= NFC_V1_V2_CONFIG1_ECC_EN;
 
                host->eccsize = get_eccsize(mtd);
@@ -1303,7 +1304,7 @@ static void preset_v3(struct mtd_info *mtd)
        }
 
        if (mtd->writesize) {
-               if (chip->ecc.mode == NAND_ECC_HW)
+               if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST)
                        config2 |= NFC_V3_CONFIG2_ECC_EN;
 
                config2 |= NFC_V3_CONFIG2_PPB(
@@ -1432,7 +1433,7 @@ static int mxc_nand_get_features(struct nand_chip *chip, int addr,
 }
 
 /*
- * The generic flash bbt decriptors overlap with our ecc
+ * The generic flash bbt descriptors overlap with our ecc
  * hardware, so define some i.MX specific ones.
  */
 static uint8_t bbt_pattern[] = { 'B', 'b', 't', '0' };
@@ -1521,7 +1522,7 @@ static const struct mxc_nand_devtype_data imx25_nand_devtype_data = {
        .get_ecc_status = get_ecc_status_v2,
        .ooblayout = &mxc_v2_ooblayout_ops,
        .select_chip = mxc_nand_select_chip_v2,
-       .setup_data_interface = mxc_nand_v2_setup_data_interface,
+       .setup_interface = mxc_nand_v2_setup_interface,
        .enable_hwecc = mxc_nand_enable_hwecc_v1_v2,
        .irqpending_quirk = 0,
        .needs_ip = 0,
@@ -1680,8 +1681,8 @@ static int mxcnd_attach_chip(struct nand_chip *chip)
        struct mxc_nand_host *host = nand_get_controller_data(chip);
        struct device *dev = mtd->dev.parent;
 
-       switch (chip->ecc.mode) {
-       case NAND_ECC_HW:
+       switch (chip->ecc.engine_type) {
+       case NAND_ECC_ENGINE_TYPE_ON_HOST:
                chip->ecc.read_page = mxc_nand_read_page;
                chip->ecc.read_page_raw = mxc_nand_read_page_raw;
                chip->ecc.read_oob = mxc_nand_read_oob;
@@ -1690,7 +1691,7 @@ static int mxcnd_attach_chip(struct nand_chip *chip)
                chip->ecc.write_oob = mxc_nand_write_oob;
                break;
 
-       case NAND_ECC_SOFT:
+       case NAND_ECC_ENGINE_TYPE_SOFT:
                break;
 
        default:
@@ -1728,7 +1729,7 @@ static int mxcnd_attach_chip(struct nand_chip *chip)
         */
        host->used_oobsize = min(mtd->oobsize, 218U);
 
-       if (chip->ecc.mode == NAND_ECC_HW) {
+       if (chip->ecc.engine_type == NAND_ECC_ENGINE_TYPE_ON_HOST) {
                if (is_imx21_nfc(host) || is_imx27_nfc(host))
                        chip->ecc.strength = 1;
                else
@@ -1738,17 +1739,17 @@ static int mxcnd_attach_chip(struct nand_chip *chip)
        return 0;
 }
 
-static int mxcnd_setup_data_interface(struct nand_chip *chip, int chipnr,
-                                     const struct nand_data_interface *conf)
+static int mxcnd_setup_interface(struct nand_chip *chip, int chipnr,
+                                const struct nand_interface_config *conf)
 {
        struct mxc_nand_host *host = nand_get_controller_data(chip);
 
-       return host->devtype_data->setup_data_interface(chip, chipnr, conf);
+       return host->devtype_data->setup_interface(chip, chipnr, conf);
 }
 
 static const struct nand_controller_ops mxcnd_controller_ops = {
        .attach_chip = mxcnd_attach_chip,
-       .setup_data_interface = mxcnd_setup_data_interface,
+       .setup_interface = mxcnd_setup_interface,
 };
 
 static int mxcnd_probe(struct platform_device *pdev)
@@ -1809,7 +1810,7 @@ static int mxcnd_probe(struct platform_device *pdev)
        if (err < 0)
                return err;
 
-       if (!host->devtype_data->setup_data_interface)
+       if (!host->devtype_data->setup_interface)
                this->options |= NAND_KEEP_TIMINGS;
 
        if (host->devtype_data->needs_ip) {
@@ -1843,10 +1844,10 @@ static int mxcnd_probe(struct platform_device *pdev)
        mtd_set_ooblayout(mtd, host->devtype_data->ooblayout);
 
        if (host->pdata.hw_ecc) {
-               this->ecc.mode = NAND_ECC_HW;
+               this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
        } else {
-               this->ecc.mode = NAND_ECC_SOFT;
-               this->ecc.algo = NAND_ECC_HAMMING;
+               this->ecc.engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
+               this->ecc.algo = NAND_ECC_ALGO_HAMMING;
        }
 
        /* NAND bus width determines access functions used by upper layer */