diff options
author | Kyungmin Park <kyungmin.park@samsung.com> | 2010-04-28 11:46:46 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-05-13 20:49:48 -0400 |
commit | 4a8ce0b030716b95004a4ace969953bc3ad7d2fe (patch) | |
tree | f14bd6118d84a81a71daf17b0c08e9112dec2e17 | |
parent | 6a88c47bd528cb0f82692986a3ca57b3695d9c60 (diff) |
mtd: onenand: allocate verify buffer in the core
This patch extends OneNAND core code with support for OneNAND verify
write check. This is done by allocating the buffer for verify read
directly from the core code.
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r-- | drivers/mtd/onenand/onenand_base.c | 13 | ||||
-rw-r--r-- | include/linux/mtd/onenand.h | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 1b26f50e159a..045811f21497 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c | |||
@@ -3932,6 +3932,13 @@ int onenand_scan(struct mtd_info *mtd, int maxchips) | |||
3932 | __func__); | 3932 | __func__); |
3933 | return -ENOMEM; | 3933 | return -ENOMEM; |
3934 | } | 3934 | } |
3935 | #ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE | ||
3936 | this->verify_buf = kzalloc(mtd->writesize, GFP_KERNEL); | ||
3937 | if (!this->verify_buf) { | ||
3938 | kfree(this->page_buf); | ||
3939 | return -ENOMEM; | ||
3940 | } | ||
3941 | #endif | ||
3935 | this->options |= ONENAND_PAGEBUF_ALLOC; | 3942 | this->options |= ONENAND_PAGEBUF_ALLOC; |
3936 | } | 3943 | } |
3937 | if (!this->oob_buf) { | 3944 | if (!this->oob_buf) { |
@@ -4059,8 +4066,12 @@ void onenand_release(struct mtd_info *mtd) | |||
4059 | kfree(this->bbm); | 4066 | kfree(this->bbm); |
4060 | } | 4067 | } |
4061 | /* Buffers allocated by onenand_scan */ | 4068 | /* Buffers allocated by onenand_scan */ |
4062 | if (this->options & ONENAND_PAGEBUF_ALLOC) | 4069 | if (this->options & ONENAND_PAGEBUF_ALLOC) { |
4063 | kfree(this->page_buf); | 4070 | kfree(this->page_buf); |
4071 | #ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE | ||
4072 | kfree(this->verify_buf); | ||
4073 | #endif | ||
4074 | } | ||
4064 | if (this->options & ONENAND_OOBBUF_ALLOC) | 4075 | if (this->options & ONENAND_OOBBUF_ALLOC) |
4065 | kfree(this->oob_buf); | 4076 | kfree(this->oob_buf); |
4066 | kfree(mtd->eraseregions); | 4077 | kfree(mtd->eraseregions); |
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index c9a3c3596b68..9b43268224a7 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
@@ -125,6 +125,9 @@ struct onenand_chip { | |||
125 | flstate_t state; | 125 | flstate_t state; |
126 | unsigned char *page_buf; | 126 | unsigned char *page_buf; |
127 | unsigned char *oob_buf; | 127 | unsigned char *oob_buf; |
128 | #ifdef CONFIG_MTD_ONENAND_VERIFY_WRITE | ||
129 | unsigned char *verify_buf; | ||
130 | #endif | ||
128 | 131 | ||
129 | int subpagesize; | 132 | int subpagesize; |
130 | struct nand_ecclayout *ecclayout; | 133 | struct nand_ecclayout *ecclayout; |