aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/nand/bcm_umi_bch.c6
-rw-r--r--drivers/mtd/nand/bf5xx_nand.c6
-rw-r--r--drivers/mtd/nand/cafe_nand.c11
-rw-r--r--drivers/mtd/nand/denali.c12
-rw-r--r--drivers/mtd/nand/docg4.c8
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c4
-rw-r--r--drivers/mtd/nand/fsl_ifc_nand.c4
-rw-r--r--drivers/mtd/nand/gpmi-nand/gpmi-nand.c6
-rw-r--r--drivers/mtd/nand/nand_base.c27
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c4
-rw-r--r--drivers/mtd/nand/sh_flctl.c3
-rw-r--r--include/linux/mtd/nand.h4
12 files changed, 64 insertions, 31 deletions
diff --git a/drivers/mtd/nand/bcm_umi_bch.c b/drivers/mtd/nand/bcm_umi_bch.c
index 5914bb32e001..c8799a001833 100644
--- a/drivers/mtd/nand/bcm_umi_bch.c
+++ b/drivers/mtd/nand/bcm_umi_bch.c
@@ -23,7 +23,7 @@
23/* ---- Private Function Prototypes -------------------------------------- */ 23/* ---- Private Function Prototypes -------------------------------------- */
24static int bcm_umi_bch_read_page_hwecc(struct mtd_info *mtd, 24static int bcm_umi_bch_read_page_hwecc(struct mtd_info *mtd,
25 struct nand_chip *chip, uint8_t *buf, int oob_required, int page); 25 struct nand_chip *chip, uint8_t *buf, int oob_required, int page);
26static void bcm_umi_bch_write_page_hwecc(struct mtd_info *mtd, 26static int bcm_umi_bch_write_page_hwecc(struct mtd_info *mtd,
27 struct nand_chip *chip, const uint8_t *buf, int oob_required); 27 struct nand_chip *chip, const uint8_t *buf, int oob_required);
28 28
29/* ---- Private Variables ------------------------------------------------ */ 29/* ---- Private Variables ------------------------------------------------ */
@@ -194,7 +194,7 @@ static int bcm_umi_bch_read_page_hwecc(struct mtd_info *mtd,
194* @oob_required: must write chip->oob_poi to OOB 194* @oob_required: must write chip->oob_poi to OOB
195* 195*
196***************************************************************************/ 196***************************************************************************/
197static void bcm_umi_bch_write_page_hwecc(struct mtd_info *mtd, 197static int bcm_umi_bch_write_page_hwecc(struct mtd_info *mtd,
198 struct nand_chip *chip, const uint8_t *buf, int oob_required) 198 struct nand_chip *chip, const uint8_t *buf, int oob_required)
199{ 199{
200 int sectorIdx = 0; 200 int sectorIdx = 0;
@@ -214,4 +214,6 @@ static void bcm_umi_bch_write_page_hwecc(struct mtd_info *mtd,
214 } 214 }
215 215
216 bcm_umi_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize); 216 bcm_umi_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize);
217
218 return 0;
217} 219}
diff --git a/drivers/mtd/nand/bf5xx_nand.c b/drivers/mtd/nand/bf5xx_nand.c
index 3f1c18599cbd..ab0caa74eb43 100644
--- a/drivers/mtd/nand/bf5xx_nand.c
+++ b/drivers/mtd/nand/bf5xx_nand.c
@@ -566,11 +566,13 @@ static int bf5xx_nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip
566 return 0; 566 return 0;
567} 567}
568 568
569static void bf5xx_nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, 569static int bf5xx_nand_write_page_raw(struct mtd_info *mtd,
570 const uint8_t *buf, int oob_required) 570 struct nand_chip *chip, const uint8_t *buf, int oob_required)
571{ 571{
572 bf5xx_nand_write_buf(mtd, buf, mtd->writesize); 572 bf5xx_nand_write_buf(mtd, buf, mtd->writesize);
573 bf5xx_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize); 573 bf5xx_nand_write_buf(mtd, chip->oob_poi, mtd->oobsize);
574
575 return 0;
574} 576}
575 577
576/* 578/*
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c
index ac0d967ee3fd..08248a0a167e 100644
--- a/drivers/mtd/nand/cafe_nand.c
+++ b/drivers/mtd/nand/cafe_nand.c
@@ -520,7 +520,7 @@ static struct nand_bbt_descr cafe_bbt_mirror_descr_512 = {
520}; 520};
521 521
522 522
523static void cafe_nand_write_page_lowlevel(struct mtd_info *mtd, 523static int cafe_nand_write_page_lowlevel(struct mtd_info *mtd,
524 struct nand_chip *chip, 524 struct nand_chip *chip,
525 const uint8_t *buf, int oob_required) 525 const uint8_t *buf, int oob_required)
526{ 526{
@@ -531,6 +531,8 @@ static void cafe_nand_write_page_lowlevel(struct mtd_info *mtd,
531 531
532 /* Set up ECC autogeneration */ 532 /* Set up ECC autogeneration */
533 cafe->ctl2 |= (1<<30); 533 cafe->ctl2 |= (1<<30);
534
535 return 0;
534} 536}
535 537
536static int cafe_nand_write_page(struct mtd_info *mtd, struct nand_chip *chip, 538static int cafe_nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
@@ -542,9 +544,12 @@ static int cafe_nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
542 chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page); 544 chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
543 545
544 if (unlikely(raw)) 546 if (unlikely(raw))
545 chip->ecc.write_page_raw(mtd, chip, buf, oob_required); 547 status = chip->ecc.write_page_raw(mtd, chip, buf, oob_required);
546 else 548 else
547 chip->ecc.write_page(mtd, chip, buf, oob_required); 549 status = chip->ecc.write_page(mtd, chip, buf, oob_required);
550
551 if (status < 0)
552 return status;
548 553
549 /* 554 /*
550 * Cached progamming disabled for now, Not sure if its worth the 555 * Cached progamming disabled for now, Not sure if its worth the
diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index 0650aafa0dd2..e706a237170f 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -1028,7 +1028,7 @@ static void denali_setup_dma(struct denali_nand_info *denali, int op)
1028 1028
1029/* writes a page. user specifies type, and this function handles the 1029/* writes a page. user specifies type, and this function handles the
1030 * configuration details. */ 1030 * configuration details. */
1031static void write_page(struct mtd_info *mtd, struct nand_chip *chip, 1031static int write_page(struct mtd_info *mtd, struct nand_chip *chip,
1032 const uint8_t *buf, bool raw_xfer) 1032 const uint8_t *buf, bool raw_xfer)
1033{ 1033{
1034 struct denali_nand_info *denali = mtd_to_denali(mtd); 1034 struct denali_nand_info *denali = mtd_to_denali(mtd);
@@ -1078,6 +1078,8 @@ static void write_page(struct mtd_info *mtd, struct nand_chip *chip,
1078 1078
1079 denali_enable_dma(denali, false); 1079 denali_enable_dma(denali, false);
1080 dma_sync_single_for_cpu(denali->dev, addr, size, DMA_TO_DEVICE); 1080 dma_sync_single_for_cpu(denali->dev, addr, size, DMA_TO_DEVICE);
1081
1082 return 0;
1081} 1083}
1082 1084
1083/* NAND core entry points */ 1085/* NAND core entry points */
@@ -1086,24 +1088,24 @@ static void write_page(struct mtd_info *mtd, struct nand_chip *chip,
1086 * writing a page with ECC or without is similar, all the work is done 1088 * writing a page with ECC or without is similar, all the work is done
1087 * by write_page above. 1089 * by write_page above.
1088 * */ 1090 * */
1089static void denali_write_page(struct mtd_info *mtd, struct nand_chip *chip, 1091static int denali_write_page(struct mtd_info *mtd, struct nand_chip *chip,
1090 const uint8_t *buf, int oob_required) 1092 const uint8_t *buf, int oob_required)
1091{ 1093{
1092 /* for regular page writes, we let HW handle all the ECC 1094 /* for regular page writes, we let HW handle all the ECC
1093 * data written to the device. */ 1095 * data written to the device. */
1094 write_page(mtd, chip, buf, false); 1096 return write_page(mtd, chip, buf, false);
1095} 1097}
1096 1098
1097/* This is the callback that the NAND core calls to write a page without ECC. 1099/* This is the callback that the NAND core calls to write a page without ECC.
1098 * raw access is similar to ECC page writes, so all the work is done in the 1100 * raw access is similar to ECC page writes, so all the work is done in the
1099 * write_page() function above. 1101 * write_page() function above.
1100 */ 1102 */
1101static void denali_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, 1103static int denali_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
1102 const uint8_t *buf, int oob_required) 1104 const uint8_t *buf, int oob_required)
1103{ 1105{
1104 /* for raw page writes, we want to disable ECC and simply write 1106 /* for raw page writes, we want to disable ECC and simply write
1105 whatever data is in the buffer. */ 1107 whatever data is in the buffer. */
1106 write_page(mtd, chip, buf, true); 1108 return write_page(mtd, chip, buf, true);
1107} 1109}
1108 1110
1109static int denali_write_oob(struct mtd_info *mtd, struct nand_chip *chip, 1111static int denali_write_oob(struct mtd_info *mtd, struct nand_chip *chip,
diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index a225e49a5623..0f2ffd7b6c82 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -898,7 +898,7 @@ static void docg4_erase_block(struct mtd_info *mtd, int page)
898 write_nop(docptr); 898 write_nop(docptr);
899} 899}
900 900
901static void write_page(struct mtd_info *mtd, struct nand_chip *nand, 901static int write_page(struct mtd_info *mtd, struct nand_chip *nand,
902 const uint8_t *buf, bool use_ecc) 902 const uint8_t *buf, bool use_ecc)
903{ 903{
904 struct docg4_priv *doc = nand->priv; 904 struct docg4_priv *doc = nand->priv;
@@ -950,15 +950,17 @@ static void write_page(struct mtd_info *mtd, struct nand_chip *nand,
950 write_nop(docptr); 950 write_nop(docptr);
951 writew(0, docptr + DOC_DATAEND); 951 writew(0, docptr + DOC_DATAEND);
952 write_nop(docptr); 952 write_nop(docptr);
953
954 return 0;
953} 955}
954 956
955static void docg4_write_page_raw(struct mtd_info *mtd, struct nand_chip *nand, 957static int docg4_write_page_raw(struct mtd_info *mtd, struct nand_chip *nand,
956 const uint8_t *buf, int oob_required) 958 const uint8_t *buf, int oob_required)
957{ 959{
958 return write_page(mtd, nand, buf, false); 960 return write_page(mtd, nand, buf, false);
959} 961}
960 962
961static void docg4_write_page(struct mtd_info *mtd, struct nand_chip *nand, 963static int docg4_write_page(struct mtd_info *mtd, struct nand_chip *nand,
962 const uint8_t *buf, int oob_required) 964 const uint8_t *buf, int oob_required)
963{ 965{
964 return write_page(mtd, nand, buf, true); 966 return write_page(mtd, nand, buf, true);
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index 22bb5e6ddaca..8143873d17a5 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -766,11 +766,13 @@ static int fsl_elbc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
766/* ECC will be calculated automatically, and errors will be detected in 766/* ECC will be calculated automatically, and errors will be detected in
767 * waitfunc. 767 * waitfunc.
768 */ 768 */
769static void fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip, 769static int fsl_elbc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
770 const uint8_t *buf, int oob_required) 770 const uint8_t *buf, int oob_required)
771{ 771{
772 fsl_elbc_write_buf(mtd, buf, mtd->writesize); 772 fsl_elbc_write_buf(mtd, buf, mtd->writesize);
773 fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize); 773 fsl_elbc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
774
775 return 0;
774} 776}
775 777
776static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv) 778static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index c5d7f382759d..1f71b545062a 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -721,11 +721,13 @@ static int fsl_ifc_read_page(struct mtd_info *mtd, struct nand_chip *chip,
721/* ECC will be calculated automatically, and errors will be detected in 721/* ECC will be calculated automatically, and errors will be detected in
722 * waitfunc. 722 * waitfunc.
723 */ 723 */
724static void fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip, 724static int fsl_ifc_write_page(struct mtd_info *mtd, struct nand_chip *chip,
725 const uint8_t *buf, int oob_required) 725 const uint8_t *buf, int oob_required)
726{ 726{
727 fsl_ifc_write_buf(mtd, buf, mtd->writesize); 727 fsl_ifc_write_buf(mtd, buf, mtd->writesize);
728 fsl_ifc_write_buf(mtd, chip->oob_poi, mtd->oobsize); 728 fsl_ifc_write_buf(mtd, chip->oob_poi, mtd->oobsize);
729
730 return 0;
729} 731}
730 732
731static int fsl_ifc_chip_init_tail(struct mtd_info *mtd) 733static int fsl_ifc_chip_init_tail(struct mtd_info *mtd)
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/*
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 0a8724e657d7..98ba46ecd5d8 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -1911,12 +1911,14 @@ out:
1911 * 1911 *
1912 * Not for syndrome calculating ECC controllers, which use a special oob layout. 1912 * Not for syndrome calculating ECC controllers, which use a special oob layout.
1913 */ 1913 */
1914static void nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip, 1914static int nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
1915 const uint8_t *buf, int oob_required) 1915 const uint8_t *buf, int oob_required)
1916{ 1916{
1917 chip->write_buf(mtd, buf, mtd->writesize); 1917 chip->write_buf(mtd, buf, mtd->writesize);
1918 if (oob_required) 1918 if (oob_required)
1919 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); 1919 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
1920
1921 return 0;
1920} 1922}
1921 1923
1922/** 1924/**
@@ -1928,7 +1930,7 @@ static void nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
1928 * 1930 *
1929 * We need a special oob layout and handling even when ECC isn't checked. 1931 * We need a special oob layout and handling even when ECC isn't checked.
1930 */ 1932 */
1931static void nand_write_page_raw_syndrome(struct mtd_info *mtd, 1933static int nand_write_page_raw_syndrome(struct mtd_info *mtd,
1932 struct nand_chip *chip, 1934 struct nand_chip *chip,
1933 const uint8_t *buf, int oob_required) 1935 const uint8_t *buf, int oob_required)
1934{ 1936{
@@ -1958,6 +1960,8 @@ static void nand_write_page_raw_syndrome(struct mtd_info *mtd,
1958 size = mtd->oobsize - (oob - chip->oob_poi); 1960 size = mtd->oobsize - (oob - chip->oob_poi);
1959 if (size) 1961 if (size)
1960 chip->write_buf(mtd, oob, size); 1962 chip->write_buf(mtd, oob, size);
1963
1964 return 0;
1961} 1965}
1962/** 1966/**
1963 * nand_write_page_swecc - [REPLACEABLE] software ECC based page write function 1967 * nand_write_page_swecc - [REPLACEABLE] software ECC based page write function
@@ -1966,7 +1970,7 @@ static void nand_write_page_raw_syndrome(struct mtd_info *mtd,
1966 * @buf: data buffer 1970 * @buf: data buffer
1967 * @oob_required: must write chip->oob_poi to OOB 1971 * @oob_required: must write chip->oob_poi to OOB
1968 */ 1972 */
1969static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, 1973static int nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
1970 const uint8_t *buf, int oob_required) 1974 const uint8_t *buf, int oob_required)
1971{ 1975{
1972 int i, eccsize = chip->ecc.size; 1976 int i, eccsize = chip->ecc.size;
@@ -1983,7 +1987,7 @@ static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
1983 for (i = 0; i < chip->ecc.total; i++) 1987 for (i = 0; i < chip->ecc.total; i++)
1984 chip->oob_poi[eccpos[i]] = ecc_calc[i]; 1988 chip->oob_poi[eccpos[i]] = ecc_calc[i];
1985 1989
1986 chip->ecc.write_page_raw(mtd, chip, buf, 1); 1990 return chip->ecc.write_page_raw(mtd, chip, buf, 1);
1987} 1991}
1988 1992
1989/** 1993/**
@@ -1993,7 +1997,7 @@ static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
1993 * @buf: data buffer 1997 * @buf: data buffer
1994 * @oob_required: must write chip->oob_poi to OOB 1998 * @oob_required: must write chip->oob_poi to OOB
1995 */ 1999 */
1996static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, 2000static int nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
1997 const uint8_t *buf, int oob_required) 2001 const uint8_t *buf, int oob_required)
1998{ 2002{
1999 int i, eccsize = chip->ecc.size; 2003 int i, eccsize = chip->ecc.size;
@@ -2013,6 +2017,8 @@ static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
2013 chip->oob_poi[eccpos[i]] = ecc_calc[i]; 2017 chip->oob_poi[eccpos[i]] = ecc_calc[i];
2014 2018
2015 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); 2019 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
2020
2021 return 0;
2016} 2022}
2017 2023
2018/** 2024/**
@@ -2025,7 +2031,7 @@ static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
2025 * The hw generator calculates the error syndrome automatically. Therefore we 2031 * The hw generator calculates the error syndrome automatically. Therefore we
2026 * need a special oob layout and handling. 2032 * need a special oob layout and handling.
2027 */ 2033 */
2028static void nand_write_page_syndrome(struct mtd_info *mtd, 2034static int nand_write_page_syndrome(struct mtd_info *mtd,
2029 struct nand_chip *chip, 2035 struct nand_chip *chip,
2030 const uint8_t *buf, int oob_required) 2036 const uint8_t *buf, int oob_required)
2031{ 2037{
@@ -2059,6 +2065,8 @@ static void nand_write_page_syndrome(struct mtd_info *mtd,
2059 i = mtd->oobsize - (oob - chip->oob_poi); 2065 i = mtd->oobsize - (oob - chip->oob_poi);
2060 if (i) 2066 if (i)
2061 chip->write_buf(mtd, oob, i); 2067 chip->write_buf(mtd, oob, i);
2068
2069 return 0;
2062} 2070}
2063 2071
2064/** 2072/**
@@ -2080,9 +2088,12 @@ static int nand_write_page(struct mtd_info *mtd, struct nand_chip *chip,
2080 chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page); 2088 chip->cmdfunc(mtd, NAND_CMD_SEQIN, 0x00, page);
2081 2089
2082 if (unlikely(raw)) 2090 if (unlikely(raw))
2083 chip->ecc.write_page_raw(mtd, chip, buf, oob_required); 2091 status = chip->ecc.write_page_raw(mtd, chip, buf, oob_required);
2084 else 2092 else
2085 chip->ecc.write_page(mtd, chip, buf, oob_required); 2093 status = chip->ecc.write_page(mtd, chip, buf, oob_required);
2094
2095 if (status < 0)
2096 return status;
2086 2097
2087 /* 2098 /*
2088 * Cached progamming disabled for now. Not sure if it's worth the 2099 * Cached progamming disabled for now. Not sure if it's worth the
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index afc4681f44d7..e8a1ae97a952 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -681,11 +681,13 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
681 info->state = STATE_IDLE; 681 info->state = STATE_IDLE;
682} 682}
683 683
684static void pxa3xx_nand_write_page_hwecc(struct mtd_info *mtd, 684static int pxa3xx_nand_write_page_hwecc(struct mtd_info *mtd,
685 struct nand_chip *chip, const uint8_t *buf, int oob_required) 685 struct nand_chip *chip, const uint8_t *buf, int oob_required)
686{ 686{
687 chip->write_buf(mtd, buf, mtd->writesize); 687 chip->write_buf(mtd, buf, mtd->writesize);
688 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); 688 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
689
690 return 0;
689} 691}
690 692
691static int pxa3xx_nand_read_page_hwecc(struct mtd_info *mtd, 693static int pxa3xx_nand_read_page_hwecc(struct mtd_info *mtd,
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c
index 2eb15418c227..ed03ed2355de 100644
--- a/drivers/mtd/nand/sh_flctl.c
+++ b/drivers/mtd/nand/sh_flctl.c
@@ -399,11 +399,12 @@ static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
399 return 0; 399 return 0;
400} 400}
401 401
402static void flctl_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, 402static int flctl_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
403 const uint8_t *buf, int oob_required) 403 const uint8_t *buf, int oob_required)
404{ 404{
405 chip->write_buf(mtd, buf, mtd->writesize); 405 chip->write_buf(mtd, buf, mtd->writesize);
406 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize); 406 chip->write_buf(mtd, chip->oob_poi, mtd->oobsize);
407 return 0;
407} 408}
408 409
409static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr) 410static void execmd_read_page_sector(struct mtd_info *mtd, int page_addr)
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index a81ac89a6950..6dce5a7154bb 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -355,13 +355,13 @@ struct nand_ecc_ctrl {
355 uint8_t *calc_ecc); 355 uint8_t *calc_ecc);
356 int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, 356 int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
357 uint8_t *buf, int oob_required, int page); 357 uint8_t *buf, int oob_required, int page);
358 void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, 358 int (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip,
359 const uint8_t *buf, int oob_required); 359 const uint8_t *buf, int oob_required);
360 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, 360 int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip,
361 uint8_t *buf, int oob_required, int page); 361 uint8_t *buf, int oob_required, int page);
362 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, 362 int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip,
363 uint32_t offs, uint32_t len, uint8_t *buf); 363 uint32_t offs, uint32_t len, uint8_t *buf);
364 void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, 364 int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip,
365 const uint8_t *buf, int oob_required); 365 const uint8_t *buf, int oob_required);
366 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, 366 int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip,
367 int page); 367 int page);