diff options
author | Sneha Narnakaje <nsnehaprabha@ti.com> | 2009-09-18 15:51:46 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-09-19 14:13:47 -0400 |
commit | 46a8cf2df2232c0051f29716ff8a166ebeb08daf (patch) | |
tree | ea7073f16c03f271cf7352c676a4604d31348deb /drivers/mtd | |
parent | 778dbcc1ebea6f9a560020110987449bf4607e5f (diff) |
mtd: nand: add "page" parameter to all read_page/read_page_raw APIs
This patch adds a new "page" parameter to all NAND read_page/read_page_raw
APIs. The read_page API for the new mode ECC_HW_OOB_FIRST requires the
page information to send the READOOB command and read the OOB area before
the data area.
Reviewed-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Sneha Narnakaje <nsnehaprabha@ti.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/cafe_nand.c | 2 | ||||
-rw-r--r-- | drivers/mtd/nand/fsl_elbc_nand.c | 3 | ||||
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 18 | ||||
-rw-r--r-- | drivers/mtd/nand/sh_flctl.c | 2 |
5 files changed, 15 insertions, 12 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 20c828ba9405..f8e9975c86e5 100644 --- a/drivers/mtd/nand/atmel_nand.c +++ b/drivers/mtd/nand/atmel_nand.c | |||
@@ -218,7 +218,7 @@ static int atmel_nand_calculate(struct mtd_info *mtd, | |||
218 | * buf: buffer to store read data | 218 | * buf: buffer to store read data |
219 | */ | 219 | */ |
220 | static int atmel_nand_read_page(struct mtd_info *mtd, | 220 | static int atmel_nand_read_page(struct mtd_info *mtd, |
221 | struct nand_chip *chip, uint8_t *buf) | 221 | struct nand_chip *chip, uint8_t *buf, int page) |
222 | { | 222 | { |
223 | int eccsize = chip->ecc.size; | 223 | int eccsize = chip->ecc.size; |
224 | int eccbytes = chip->ecc.bytes; | 224 | int eccbytes = chip->ecc.bytes; |
diff --git a/drivers/mtd/nand/cafe_nand.c b/drivers/mtd/nand/cafe_nand.c index 29acd06b1c39..a70f40e161d7 100644 --- a/drivers/mtd/nand/cafe_nand.c +++ b/drivers/mtd/nand/cafe_nand.c | |||
@@ -381,7 +381,7 @@ static int cafe_nand_read_oob(struct mtd_info *mtd, struct nand_chip *chip, | |||
381 | * we need a special oob layout and handling. | 381 | * we need a special oob layout and handling. |
382 | */ | 382 | */ |
383 | static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, | 383 | static int cafe_nand_read_page(struct mtd_info *mtd, struct nand_chip *chip, |
384 | uint8_t *buf) | 384 | uint8_t *buf, int page) |
385 | { | 385 | { |
386 | struct cafe_priv *cafe = mtd->priv; | 386 | struct cafe_priv *cafe = mtd->priv; |
387 | 387 | ||
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c index 1f6eb2578717..ddd37d2554ed 100644 --- a/drivers/mtd/nand/fsl_elbc_nand.c +++ b/drivers/mtd/nand/fsl_elbc_nand.c | |||
@@ -739,7 +739,8 @@ static int fsl_elbc_chip_init_tail(struct mtd_info *mtd) | |||
739 | 739 | ||
740 | static int fsl_elbc_read_page(struct mtd_info *mtd, | 740 | static int fsl_elbc_read_page(struct mtd_info *mtd, |
741 | struct nand_chip *chip, | 741 | struct nand_chip *chip, |
742 | uint8_t *buf) | 742 | uint8_t *buf, |
743 | int page) | ||
743 | { | 744 | { |
744 | fsl_elbc_read_buf(mtd, buf, mtd->writesize); | 745 | fsl_elbc_read_buf(mtd, buf, mtd->writesize); |
745 | fsl_elbc_read_buf(mtd, chip->oob_poi, mtd->oobsize); | 746 | fsl_elbc_read_buf(mtd, chip->oob_poi, mtd->oobsize); |
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 4c5e8a74e1b2..17bbd5062027 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -765,7 +765,7 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip) | |||
765 | * Not for syndrome calculating ecc controllers, which use a special oob layout | 765 | * Not for syndrome calculating ecc controllers, which use a special oob layout |
766 | */ | 766 | */ |
767 | static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | 767 | static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, |
768 | uint8_t *buf) | 768 | uint8_t *buf, int page) |
769 | { | 769 | { |
770 | chip->read_buf(mtd, buf, mtd->writesize); | 770 | chip->read_buf(mtd, buf, mtd->writesize); |
771 | chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); | 771 | chip->read_buf(mtd, chip->oob_poi, mtd->oobsize); |
@@ -781,7 +781,7 @@ static int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip, | |||
781 | * We need a special oob layout and handling even when OOB isn't used. | 781 | * We need a special oob layout and handling even when OOB isn't used. |
782 | */ | 782 | */ |
783 | static int nand_read_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip, | 783 | static int nand_read_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *chip, |
784 | uint8_t *buf) | 784 | uint8_t *buf, int page) |
785 | { | 785 | { |
786 | int eccsize = chip->ecc.size; | 786 | int eccsize = chip->ecc.size; |
787 | int eccbytes = chip->ecc.bytes; | 787 | int eccbytes = chip->ecc.bytes; |
@@ -820,7 +820,7 @@ static int nand_read_page_raw_syndrome(struct mtd_info *mtd, struct nand_chip *c | |||
820 | * @buf: buffer to store read data | 820 | * @buf: buffer to store read data |
821 | */ | 821 | */ |
822 | static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, | 822 | static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, |
823 | uint8_t *buf) | 823 | uint8_t *buf, int page) |
824 | { | 824 | { |
825 | int i, eccsize = chip->ecc.size; | 825 | int i, eccsize = chip->ecc.size; |
826 | int eccbytes = chip->ecc.bytes; | 826 | int eccbytes = chip->ecc.bytes; |
@@ -830,7 +830,7 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip, | |||
830 | uint8_t *ecc_code = chip->buffers->ecccode; | 830 | uint8_t *ecc_code = chip->buffers->ecccode; |
831 | uint32_t *eccpos = chip->ecc.layout->eccpos; | 831 | uint32_t *eccpos = chip->ecc.layout->eccpos; |
832 | 832 | ||
833 | chip->ecc.read_page_raw(mtd, chip, buf); | 833 | chip->ecc.read_page_raw(mtd, chip, buf, page); |
834 | 834 | ||
835 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) | 835 | for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) |
836 | chip->ecc.calculate(mtd, p, &ecc_calc[i]); | 836 | chip->ecc.calculate(mtd, p, &ecc_calc[i]); |
@@ -943,7 +943,7 @@ static int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip, uint3 | |||
943 | * Not for syndrome calculating ecc controllers which need a special oob layout | 943 | * Not for syndrome calculating ecc controllers which need a special oob layout |
944 | */ | 944 | */ |
945 | static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, | 945 | static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, |
946 | uint8_t *buf) | 946 | uint8_t *buf, int page) |
947 | { | 947 | { |
948 | int i, eccsize = chip->ecc.size; | 948 | int i, eccsize = chip->ecc.size; |
949 | int eccbytes = chip->ecc.bytes; | 949 | int eccbytes = chip->ecc.bytes; |
@@ -988,7 +988,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, | |||
988 | * we need a special oob layout and handling. | 988 | * we need a special oob layout and handling. |
989 | */ | 989 | */ |
990 | static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip, | 990 | static int nand_read_page_syndrome(struct mtd_info *mtd, struct nand_chip *chip, |
991 | uint8_t *buf) | 991 | uint8_t *buf, int page) |
992 | { | 992 | { |
993 | int i, eccsize = chip->ecc.size; | 993 | int i, eccsize = chip->ecc.size; |
994 | int eccbytes = chip->ecc.bytes; | 994 | int eccbytes = chip->ecc.bytes; |
@@ -1130,11 +1130,13 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from, | |||
1130 | 1130 | ||
1131 | /* Now read the page into the buffer */ | 1131 | /* Now read the page into the buffer */ |
1132 | if (unlikely(ops->mode == MTD_OOB_RAW)) | 1132 | if (unlikely(ops->mode == MTD_OOB_RAW)) |
1133 | ret = chip->ecc.read_page_raw(mtd, chip, bufpoi); | 1133 | ret = chip->ecc.read_page_raw(mtd, chip, |
1134 | bufpoi, page); | ||
1134 | else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob) | 1135 | else if (!aligned && NAND_SUBPAGE_READ(chip) && !oob) |
1135 | ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi); | 1136 | ret = chip->ecc.read_subpage(mtd, chip, col, bytes, bufpoi); |
1136 | else | 1137 | else |
1137 | ret = chip->ecc.read_page(mtd, chip, bufpoi); | 1138 | ret = chip->ecc.read_page(mtd, chip, bufpoi, |
1139 | page); | ||
1138 | if (ret < 0) | 1140 | if (ret < 0) |
1139 | break; | 1141 | break; |
1140 | 1142 | ||
diff --git a/drivers/mtd/nand/sh_flctl.c b/drivers/mtd/nand/sh_flctl.c index 2bc896623e2d..c5df28596a4a 100644 --- a/drivers/mtd/nand/sh_flctl.c +++ b/drivers/mtd/nand/sh_flctl.c | |||
@@ -329,7 +329,7 @@ static void set_cmd_regs(struct mtd_info *mtd, uint32_t cmd, uint32_t flcmcdr_va | |||
329 | } | 329 | } |
330 | 330 | ||
331 | static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, | 331 | static int flctl_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip, |
332 | uint8_t *buf) | 332 | uint8_t *buf, int page) |
333 | { | 333 | { |
334 | int i, eccsize = chip->ecc.size; | 334 | int i, eccsize = chip->ecc.size; |
335 | int eccbytes = chip->ecc.bytes; | 335 | int eccbytes = chip->ecc.bytes; |