]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/tegra_nand.c
Update from 2013.01 to 2013.07
[karo-tx-uboot.git] / drivers / mtd / nand / tegra_nand.c
index 4d94cc6f562819c98b0ca3801f31d5a39cdd6cb1..163cf29a3986058cfc3472241ac2865cd5f99516 100644 (file)
@@ -4,23 +4,7 @@
  * (C) Copyright 2006 Detlev Zundel, dzu@denx.de
  * (C) Copyright 2006 DENX Software Engineering
  *
- * 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>
@@ -707,7 +691,7 @@ static int nand_rw_page(struct mtd_info *mtd, struct nand_chip *chip,
  *             -EIO when command timeout
  */
 static int nand_read_page_hwecc(struct mtd_info *mtd,
-       struct nand_chip *chip, uint8_t *buf, int page)
+       struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
 {
        return nand_rw_page(mtd, chip, buf, page, 1, 0);
 }
@@ -719,8 +703,8 @@ static int nand_read_page_hwecc(struct mtd_info *mtd,
  * @param chip nand chip info structure
  * @param buf  data buffer
  */
-static void nand_write_page_hwecc(struct mtd_info *mtd,
-       struct nand_chip *chip, const uint8_t *buf)
+static int nand_write_page_hwecc(struct mtd_info *mtd,
+       struct nand_chip *chip, const uint8_t *buf, int oob_required)
 {
        int page;
        struct nand_drv *info;
@@ -731,6 +715,7 @@ static void nand_write_page_hwecc(struct mtd_info *mtd,
                (readl(&info->reg->addr_reg2) << 16);
 
        nand_rw_page(mtd, chip, (uint8_t *)buf, page, 1, 1);
+       return 0;
 }
 
 
@@ -746,7 +731,7 @@ static void nand_write_page_hwecc(struct mtd_info *mtd,
  *             -EIO when command timeout
  */
 static int nand_read_page_raw(struct mtd_info *mtd,
-       struct nand_chip *chip, uint8_t *buf, int page)
+       struct nand_chip *chip, uint8_t *buf, int oob_required, int page)
 {
        return nand_rw_page(mtd, chip, buf, page, 0, 0);
 }
@@ -758,8 +743,8 @@ static int nand_read_page_raw(struct mtd_info *mtd,
  * @param chip nand chip info structure
  * @param buf  data buffer
  */
-static void nand_write_page_raw(struct mtd_info *mtd,
-               struct nand_chip *chip, const uint8_t *buf)
+static int nand_write_page_raw(struct mtd_info *mtd,
+               struct nand_chip *chip, const uint8_t *buf, int oob_required)
 {
        int page;
        struct nand_drv *info;
@@ -769,6 +754,7 @@ static void nand_write_page_raw(struct mtd_info *mtd,
                (readl(&info->reg->addr_reg2) << 16);
 
        nand_rw_page(mtd, chip, (uint8_t *)buf, page, 0, 1);
+       return 0;
 }
 
 /**
@@ -873,19 +859,13 @@ static int nand_rw_oob(struct mtd_info *mtd, struct nand_chip *chip,
  * @param mtd          mtd info structure
  * @param chip         nand chip info structure
  * @param page         page number to read
- * @param sndcmd       flag whether to issue read command or not
- * @return     1 - issue read command next time
- *             0 - not to issue
  */
 static int nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
-       int page, int sndcmd)
+       int page)
 {
-       if (sndcmd) {
-               chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
-               sndcmd = 0;
-       }
+       chip->cmdfunc(mtd, NAND_CMD_READOOB, 0, page);
        nand_rw_oob(mtd, chip, page, 0, 0);
-       return sndcmd;
+       return 0;
 }
 
 /**
@@ -1018,6 +998,7 @@ int tegra_nand_init(struct nand_chip *nand, int devnum)
        nand->ecc.write_page_raw = nand_write_page_raw;
        nand->ecc.read_oob = nand_read_oob;
        nand->ecc.write_oob = nand_write_oob;
+       nand->ecc.strength = 1;
        nand->select_chip = nand_select_chip;
        nand->dev_ready  = nand_dev_ready;
        nand->priv = &nand_ctrl;