Message ID | 1288781721-31771-4-git-send-email-roman.tereshonkov@nokia.com |
---|---|
State | Accepted |
Commit | ac80dac00f8630803dc0c7f8fbe6983a8e2a8b5f |
Headers | show |
Acked-by: Kyungmin Park <kyungmin.park@samsung.com> On Wed, Nov 3, 2010 at 7:55 PM, Roman Tereshonkov <roman.tereshonkov@nokia.com> wrote: > Implement cache program feature for 4KB page onenand. > This feature improves the write data performance. > The observed 128KB data program speed change is > from 8827KB/s to 14156 KB/s when the feature is enabled. > > Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com> > --- > drivers/mtd/onenand/onenand_base.c | 22 +++++++++++++++++++--- > 1 files changed, 19 insertions(+), 3 deletions(-) > > diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c > index 6b3a875..4d6e6c5 100644 > --- a/drivers/mtd/onenand/onenand_base.c > +++ b/drivers/mtd/onenand/onenand_base.c > @@ -1845,7 +1845,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to, > const u_char *buf = ops->datbuf; > const u_char *oob = ops->oobbuf; > u_char *oobbuf; > - int ret = 0; > + int ret = 0, cmd; > > DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n", > __func__, (unsigned int) to, (int) len); > @@ -1954,7 +1954,19 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to, > ONENAND_SET_NEXT_BUFFERRAM(this); > } > > - this->command(mtd, ONENAND_CMD_PROG, to, mtd->writesize); > + this->ongoing = 0; > + cmd = ONENAND_CMD_PROG; > + > + /* Exclude 1st OTP and OTP blocks for cache program feature */ > + if (ONENAND_IS_CACHE_PROGRAM(this) && > + likely(onenand_block(this, to) != 0) && > + ONENAND_IS_4KB_PAGE(this) && > + ((written + thislen) < len)) { > + cmd = ONENAND_CMD_2X_CACHE_PROG; > + this->ongoing = 1; > + } > + > + this->command(mtd, cmd, to, mtd->writesize); > > /* > * 2 PLANE, MLC, and Flex-OneNAND wait here > @@ -3377,8 +3389,10 @@ static void onenand_check_features(struct mtd_info *mtd) > case ONENAND_DEVICE_DENSITY_4Gb: > if (ONENAND_IS_DDP(this)) > this->options |= ONENAND_HAS_2PLANE; > - else if (numbufs == 1) > + else if (numbufs == 1) { > this->options |= ONENAND_HAS_4KB_PAGE; > + this->options |= ONENAND_HAS_CACHE_PROGRAM; > + } > > case ONENAND_DEVICE_DENSITY_2Gb: > /* 2Gb DDP does not have 2 plane */ > @@ -3415,6 +3429,8 @@ static void onenand_check_features(struct mtd_info *mtd) > printk(KERN_DEBUG "Chip has 2 plane\n"); > if (this->options & ONENAND_HAS_4KB_PAGE) > printk(KERN_DEBUG "Chip has 4KiB pagesize\n"); > + if (this->options & ONENAND_HAS_CACHE_PROGRAM) > + printk(KERN_DEBUG "Chip has cache program feature\n"); > } > > /** > -- > 1.7.0.4 > > > ______________________________________________________ > Linux MTD discussion mailing list > http://lists.infradead.org/mailman/listinfo/linux-mtd/ >
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 6b3a875..4d6e6c5 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -1845,7 +1845,7 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to, const u_char *buf = ops->datbuf; const u_char *oob = ops->oobbuf; u_char *oobbuf; - int ret = 0; + int ret = 0, cmd; DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n", __func__, (unsigned int) to, (int) len); @@ -1954,7 +1954,19 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to, ONENAND_SET_NEXT_BUFFERRAM(this); } - this->command(mtd, ONENAND_CMD_PROG, to, mtd->writesize); + this->ongoing = 0; + cmd = ONENAND_CMD_PROG; + + /* Exclude 1st OTP and OTP blocks for cache program feature */ + if (ONENAND_IS_CACHE_PROGRAM(this) && + likely(onenand_block(this, to) != 0) && + ONENAND_IS_4KB_PAGE(this) && + ((written + thislen) < len)) { + cmd = ONENAND_CMD_2X_CACHE_PROG; + this->ongoing = 1; + } + + this->command(mtd, cmd, to, mtd->writesize); /* * 2 PLANE, MLC, and Flex-OneNAND wait here @@ -3377,8 +3389,10 @@ static void onenand_check_features(struct mtd_info *mtd) case ONENAND_DEVICE_DENSITY_4Gb: if (ONENAND_IS_DDP(this)) this->options |= ONENAND_HAS_2PLANE; - else if (numbufs == 1) + else if (numbufs == 1) { this->options |= ONENAND_HAS_4KB_PAGE; + this->options |= ONENAND_HAS_CACHE_PROGRAM; + } case ONENAND_DEVICE_DENSITY_2Gb: /* 2Gb DDP does not have 2 plane */ @@ -3415,6 +3429,8 @@ static void onenand_check_features(struct mtd_info *mtd) printk(KERN_DEBUG "Chip has 2 plane\n"); if (this->options & ONENAND_HAS_4KB_PAGE) printk(KERN_DEBUG "Chip has 4KiB pagesize\n"); + if (this->options & ONENAND_HAS_CACHE_PROGRAM) + printk(KERN_DEBUG "Chip has cache program feature\n"); } /**
Implement cache program feature for 4KB page onenand. This feature improves the write data performance. The observed 128KB data program speed change is from 8827KB/s to 14156 KB/s when the feature is enabled. Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com> --- drivers/mtd/onenand/onenand_base.c | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-)