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/nand/nand_base.c | |
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/nand/nand_base.c')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 18 |
1 files changed, 10 insertions, 8 deletions
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 | ||