aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/gpmi-nand
diff options
context:
space:
mode:
authorJosh Wu <josh.wu@atmel.com>2012-06-25 06:07:45 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-07-06 13:17:07 -0400
commitfdbad98dff8007f2b8bee6698b5d25ebba0471c9 (patch)
tree823d68f687ad90108ec6a4c53d17cb3bde1b3950 /drivers/mtd/nand/gpmi-nand
parent3dfe41a4c705223c66373968327407e11c2fb1a1 (diff)
mtd: nand: teach write_page and write_page_raw return an error code
There is an implemention of hardware ECC write page function which may return an error indication. For instance, using Atmel HW PMECC to write one page into a nand flash, the hardware engine will compute the BCH ecc code for this page. so we need read a the status register to theck whether the ecc code is generated. But we cannot assume the status register always can be ready, for example, incorrect hardware configuration or hardware issue, in such case we need write_page() to return a error code. Since the definition of 'write_page' function in struct nand_ecc_ctrl is 'void'. So this patch will: 1. add return 'int' value for 'write_page' function. 2. to be consitent, add return 'int' value for 'write_page_raw' fuctions too. 3. add code to test the return value, and if negative, indicate an error happend when write page with ECC. 4. fix the compile warning in all impacted nand flash driver. Note: I couldn't compile-test all of these easily, as some had ARCH dependencies. Signed-off-by: Josh Wu <josh.wu@atmel.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/gpmi-nand')
-rw-r--r--drivers/mtd/nand/gpmi-nand/gpmi-nand.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 6574c6f51b8b..d6fa8f4779ce 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -930,7 +930,7 @@ exit_nfc:
930 return ret; 930 return ret;
931} 931}
932 932
933static void gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip, 933static int gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
934 const uint8_t *buf, int oob_required) 934 const uint8_t *buf, int oob_required)
935{ 935{
936 struct gpmi_nand_data *this = chip->priv; 936 struct gpmi_nand_data *this = chip->priv;
@@ -972,7 +972,7 @@ static void gpmi_ecc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
972 &payload_virt, &payload_phys); 972 &payload_virt, &payload_phys);
973 if (ret) { 973 if (ret) {
974 pr_err("Inadequate payload DMA buffer\n"); 974 pr_err("Inadequate payload DMA buffer\n");
975 return; 975 return 0;
976 } 976 }
977 977
978 ret = send_page_prepare(this, 978 ret = send_page_prepare(this,
@@ -1002,6 +1002,8 @@ exit_auxiliary:
1002 nfc_geo->payload_size, 1002 nfc_geo->payload_size,
1003 payload_virt, payload_phys); 1003 payload_virt, payload_phys);
1004 } 1004 }
1005
1006 return 0;
1005} 1007}
1006 1008
1007/* 1009/*