]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/tqc/tqm8272/nand.c
Merge branch 'master' of git://www.denx.de/git/u-boot-imx
[karo-tx-uboot.git] / board / tqc / tqm8272 / nand.c
index b988ffa0ed98b48074697e48cd0448c3ea31790f..7fb2dfabc17e79f2fc1ebac2b07628bd169e4fdc 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2008
  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * 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., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -141,12 +125,12 @@ static u8 hwctl = 0;
 static void upmnand_write_byte(struct mtd_info *mtdinfo, u_char byte)
 {
        struct nand_chip *this = mtdinfo->priv;
-       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CONFIG_SYS_NAND_CS_DIST);
 
        if (hwctl & 0x1) {
-               WRITE_NAND_UPM(byte, base, CFG_NAND_UPM_WRITE_CMD_OFS);
+               WRITE_NAND_UPM(byte, base, CONFIG_SYS_NAND_UPM_WRITE_CMD_OFS);
        } else if (hwctl & 0x2) {
-               WRITE_NAND_UPM(byte, base, CFG_NAND_UPM_WRITE_ADDR_OFS);
+               WRITE_NAND_UPM(byte, base, CONFIG_SYS_NAND_UPM_WRITE_ADDR_OFS);
        } else {
                WRITE_NAND(byte, base);
        }
@@ -171,7 +155,7 @@ static void upmnand_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
 static u_char upmnand_read_byte(struct mtd_info *mtdinfo)
 {
        struct nand_chip *this = mtdinfo->priv;
-       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       ulong base = (ulong) (this->IO_ADDR_W + chipsel * CONFIG_SYS_NAND_CS_DIST);
 
        return READ_NAND(base);
 }
@@ -187,7 +171,7 @@ static int tqm8272_dev_ready(struct mtd_info *mtdinfo)
 static void tqm8272_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len)
 {
        struct nand_chip *this = mtdinfo->priv;
-       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CONFIG_SYS_NAND_CS_DIST);
        int     i;
 
        for (i = 0; i< len; i++)
@@ -197,17 +181,18 @@ static void tqm8272_read_buf(struct mtd_info *mtdinfo, uint8_t *buf, int len)
 static void tqm8272_write_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
 {
        struct nand_chip *this = mtdinfo->priv;
-       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CONFIG_SYS_NAND_CS_DIST);
        int     i;
 
        for (i = 0; i< len; i++)
                *base = buf[i];
 }
 
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
 static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int len)
 {
        struct nand_chip *this = mtdinfo->priv;
-       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CFG_NAND_CS_DIST);
+       unsigned char *base = (unsigned char *) (this->IO_ADDR_W + chipsel * CONFIG_SYS_NAND_CS_DIST);
        int     i;
 
        for (i = 0; i < len; i++)
@@ -215,6 +200,7 @@ static int tqm8272_verify_buf(struct mtd_info *mtdinfo, const uint8_t *buf, int
                        return -1;
        return 0;
 }
+#endif
 #endif /* #ifndef CONFIG_NAND_SPL */
 
 void board_nand_select_device(struct nand_chip *nand, int chip)
@@ -225,7 +211,7 @@ void board_nand_select_device(struct nand_chip *nand, int chip)
 int board_nand_init(struct nand_chip *nand)
 {
        static  int     UpmInit = 0;
-       volatile immap_t * immr = (immap_t *)CFG_IMMR;
+       volatile immap_t * immr = (immap_t *)CONFIG_SYS_IMMR;
        volatile memctl8260_t *memctl = &immr->im_memctl;
 
        if (hwinf.nand == 0) return -1;
@@ -250,8 +236,8 @@ int board_nand_init(struct nand_chip *nand)
        }
 
        /* Setup the memctrl */
-       memctl->memc_or3 = CFG_NAND_OR;
-       memctl->memc_br3 = CFG_NAND_BR;
+       memctl->memc_or3 = CONFIG_SYS_NAND_OR;
+       memctl->memc_br3 = CONFIG_SYS_NAND_BR;
        memctl->memc_mbmr = (MxMR_OP_NORM);
 
        nand->ecc.mode = NAND_ECC_SOFT;
@@ -263,7 +249,9 @@ int board_nand_init(struct nand_chip *nand)
 #ifndef CONFIG_NAND_SPL
        nand->write_buf  = tqm8272_write_buf;
        nand->read_buf   = tqm8272_read_buf;
+#if defined(CONFIG_MTD_NAND_VERIFY_WRITE)
        nand->verify_buf = tqm8272_verify_buf;
+#endif
 #endif
 
        /*