]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - drivers/mtd/nand/atmel_nand.c
Prepare v2013.07-rc2
[karo-tx-uboot.git] / drivers / mtd / nand / atmel_nand.c
index c6aa5db33c43666cd970cd1b214fbdf04b42a4a4..3bfbaf8ac9fc192297b3653f6254ef74143023ee 100644 (file)
@@ -489,7 +489,7 @@ normal_check:
 }
 
 static int atmel_nand_pmecc_read_page(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)
 {
        struct atmel_nand_host *host = chip->priv;
        int eccsize = chip->ecc.size;
@@ -529,8 +529,9 @@ static int atmel_nand_pmecc_read_page(struct mtd_info *mtd,
        return 0;
 }
 
-static void atmel_nand_pmecc_write_page(struct mtd_info *mtd,
-               struct nand_chip *chip, const uint8_t *buf)
+static int atmel_nand_pmecc_write_page(struct mtd_info *mtd,
+               struct nand_chip *chip, const uint8_t *buf,
+               int oob_required)
 {
        struct atmel_nand_host *host = chip->priv;
        uint32_t *eccpos = chip->ecc.layout->eccpos;
@@ -557,7 +558,7 @@ static void atmel_nand_pmecc_write_page(struct mtd_info *mtd,
 
        if (!timeout) {
                printk(KERN_ERR "atmel_nand : Timeout to read PMECC status, fail to write PMECC in oob\n");
-               return;
+               goto out;
        }
 
        for (i = 0; i < host->pmecc_sector_number; i++) {
@@ -570,6 +571,8 @@ static void atmel_nand_pmecc_write_page(struct mtd_info *mtd,
                }
        }
        chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
+out:
+       return 0;
 }
 
 static void atmel_pmecc_core_init(struct mtd_info *mtd)
@@ -652,8 +655,9 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
        sector_size = host->pmecc_sector_size = CONFIG_PMECC_SECTOR_SIZE;
        host->pmecc_index_table_offset = CONFIG_PMECC_INDEX_TABLE_OFFSET;
 
-       printk(KERN_INFO "Initialize PMECC params, cap: %d, sector: %d\n",
-                cap, sector_size);
+       MTDDEBUG(MTD_DEBUG_LEVEL1,
+               "Initialize PMECC params, cap: %d, sector: %d\n",
+               cap, sector_size);
 
        host->pmecc = (struct pmecc_regs __iomem *) ATMEL_BASE_PMECC;
        host->pmerrloc = (struct pmecc_errloc_regs __iomem *)
@@ -705,6 +709,7 @@ static int atmel_pmecc_nand_init_params(struct nand_chip *nand,
 
        nand->ecc.read_page = atmel_nand_pmecc_read_page;
        nand->ecc.write_page = atmel_nand_pmecc_write_page;
+       nand->ecc.strength = cap;
 
        atmel_pmecc_core_init(mtd);
 
@@ -774,9 +779,10 @@ static int atmel_nand_calculate(struct mtd_info *mtd,
  * mtd:        mtd info structure
  * chip:       nand chip info structure
  * buf:        buffer to store read data
+ * oob_required:    caller expects OOB data read to chip->oob_poi
  */
-static int atmel_nand_read_page(struct mtd_info *mtd,
-               struct nand_chip *chip, uint8_t *buf, int page)
+static int atmel_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip,
+                               uint8_t *buf, int oob_required, int page)
 {
        int eccsize = chip->ecc.size;
        int eccbytes = chip->ecc.bytes;