]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/mxc_nand.c
config: rename CONFIG_MX* to CONFIG_SOC_MX*
[karo-tx-uboot.git] / drivers / mtd / nand / mxc_nand.c
index f4528f20bd377d1c053611e7e75cdc617e5c950c..a232e71ed944b6bc3ada0f8fee170334d069a35e 100644 (file)
@@ -3,21 +3,7 @@
  * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
  * Copyright 2009 Ilya Yanok, <yanok@emcraft.com>
  *
- * Copyright 2012 Lothar Waßmann <LW@KARO-electronics.de>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
 #include <nand.h>
 #include <linux/err.h>
 #include <asm/io.h>
-#if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35) || \
-       defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#if defined(CONFIG_SOC_MX25) || defined(CONFIG_SOC_MX27) || defined(CONFIG_SOC_MX35) || \
+       defined(CONFIG_SOC_MX51) || defined(CONFIG_SOC_MX53)
 #include <asm/arch/imx-regs.h>
 #endif
 
 static struct mxc_nand_host mxc_host;
 static struct mxc_nand_host *host = &mxc_host;
 
-#ifdef CONFIG_MX27
+#ifdef CONFIG_SOC_MX27
 static int is_16bit_nand(void)
 {
        struct system_control_regs *sc_regs =
@@ -44,7 +30,7 @@ static int is_16bit_nand(void)
        else
                return 0;
 }
-#elif defined(CONFIG_MX31)
+#elif defined(CONFIG_SOC_MX31)
 static int is_16bit_nand(void)
 {
        struct clock_control_regs *sc_regs =
@@ -55,7 +41,7 @@ static int is_16bit_nand(void)
        else
                return 0;
 }
-#elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
+#elif defined(CONFIG_SOC_MX25) || defined(CONFIG_SOC_MX35)
 static int is_16bit_nand(void)
 {
        struct ccm_regs *ccm =
@@ -66,7 +52,7 @@ static int is_16bit_nand(void)
        else
                return 0;
 }
-#elif defined(CONFIG_MX51)
+#elif defined(CONFIG_SOC_MX51)
 static int is_16bit_nand(void)
 {
        struct src *src = (struct src *)SRC_BASE_ADDR;
@@ -76,7 +62,7 @@ static int is_16bit_nand(void)
        else
                return 0;
 }
-#elif defined(CONFIG_MX53)
+#elif defined(CONFIG_SOC_MX53)
 /* BOOT_CFG[1..3][0..7] */
 #define SRC_BOOT_CFG(m, n)             (1 << ((m) * 8 + (n)))
 static int is_16bit_nand(void)
@@ -104,19 +90,19 @@ static int is_16bit_nand(void)
 #error CONFIG_MXC_NAND_REGS_BASE not defined
 #endif
 
-#if defined(CONFIG_MX27) || defined(CONFIG_MX31)
+#if defined(CONFIG_SOC_MX27) || defined(CONFIG_SOC_MX31)
 #define nfc_is_v1()            1
 #define nfc_is_v21()           0
 #define nfc_is_v3_2()          0
 #define nfc_is_v3()            nfc_is_v3_2()
 #define NFC_VERSION            "V1"
-#elif defined(CONFIG_MX25) || defined(CONFIG_MX35)
+#elif defined(CONFIG_SOC_MX25) || defined(CONFIG_SOC_MX35)
 #define nfc_is_v1()            0
 #define nfc_is_v21()           1
 #define nfc_is_v3_2()          0
 #define nfc_is_v3()            nfc_is_v3_2()
 #define NFC_VERSION            "V2"
-#elif defined(CONFIG_MX51) || defined(CONFIG_MX53)
+#elif defined(CONFIG_SOC_MX51) || defined(CONFIG_SOC_MX53)
 #define nfc_is_v1()            0
 #define nfc_is_v21()           0
 #define nfc_is_v3_2()          1
@@ -677,6 +663,7 @@ static void mxc_nand_read_buf(struct mtd_info *mtd, u_char *buf, int len)
        host->buf_start += n;
 }
 
+#if defined(__UBOOT__) && defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 /* Used by the upper layer to verify the data in NAND Flash
  * with the data in the buf. */
 static int mxc_nand_verify_buf(struct mtd_info *mtd,
@@ -684,6 +671,7 @@ static int mxc_nand_verify_buf(struct mtd_info *mtd,
 {
        return -EFAULT;
 }
+#endif
 
 /* This function is used by upper layer for select and
  * deselect of the NAND chip */
@@ -883,7 +871,7 @@ static void preset_v3(struct mtd_info *mtd)
        }
 
        if (mtd->writesize) {
-#if defined CONFIG_MX53
+#if defined CONFIG_SOC_MX53
                config2 |= MX53_CONFIG2_PPB(ffs(mtd->erasesize / mtd->writesize) - 6);
 #else
                config2 |= NFC_V3_CONFIG2_PPB(ffs(mtd->erasesize / mtd->writesize) - 6);
@@ -1053,8 +1041,9 @@ static void mxc_nand_chip_init(int devno)
        this->read_word = mxc_nand_read_word;
        this->write_buf = mxc_nand_write_buf;
        this->read_buf = mxc_nand_read_buf;
+#if defined(__UBOOT__) && defined(CONFIG_MTD_NAND_VERIFY_WRITE)
        this->verify_buf = mxc_nand_verify_buf;
-
+#endif
        host->base = (void __iomem *)CONFIG_MXC_NAND_REGS_BASE;
        if (!host->base) {
                return;