aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand/onenand_base.c
diff options
context:
space:
mode:
authorRoman Tereshonkov <roman.tereshonkov@nokia.com>2010-11-03 06:55:21 -0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2010-12-03 11:28:41 -0500
commitac80dac00f8630803dc0c7f8fbe6983a8e2a8b5f (patch)
treeb4504a58422ec740ba7943ae4a5573f8cfd3a2ba /drivers/mtd/onenand/onenand_base.c
parentd19d7b46d2b4936be14cfeef779ffeb76cf7b757 (diff)
mtd: onenand: implement cache program feature for 4KiB page onenand
Implement cache program feature for 4KiB page onenand. This feature improves the write data performance. The observed 128KiB data program speed change is from 8827KiB/s to 14156 KiB/s when the feature is enabled. Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/onenand/onenand_base.c')
-rw-r--r--drivers/mtd/onenand/onenand_base.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 6b3a875647c9..4d6e6c54cc2c 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,
1845 const u_char *buf = ops->datbuf; 1845 const u_char *buf = ops->datbuf;
1846 const u_char *oob = ops->oobbuf; 1846 const u_char *oob = ops->oobbuf;
1847 u_char *oobbuf; 1847 u_char *oobbuf;
1848 int ret = 0; 1848 int ret = 0, cmd;
1849 1849
1850 DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n", 1850 DEBUG(MTD_DEBUG_LEVEL3, "%s: to = 0x%08x, len = %i\n",
1851 __func__, (unsigned int) to, (int) len); 1851 __func__, (unsigned int) to, (int) len);
@@ -1954,7 +1954,19 @@ static int onenand_write_ops_nolock(struct mtd_info *mtd, loff_t to,
1954 ONENAND_SET_NEXT_BUFFERRAM(this); 1954 ONENAND_SET_NEXT_BUFFERRAM(this);
1955 } 1955 }
1956 1956
1957 this->command(mtd, ONENAND_CMD_PROG, to, mtd->writesize); 1957 this->ongoing = 0;
1958 cmd = ONENAND_CMD_PROG;
1959
1960 /* Exclude 1st OTP and OTP blocks for cache program feature */
1961 if (ONENAND_IS_CACHE_PROGRAM(this) &&
1962 likely(onenand_block(this, to) != 0) &&
1963 ONENAND_IS_4KB_PAGE(this) &&
1964 ((written + thislen) < len)) {
1965 cmd = ONENAND_CMD_2X_CACHE_PROG;
1966 this->ongoing = 1;
1967 }
1968
1969 this->command(mtd, cmd, to, mtd->writesize);
1958 1970
1959 /* 1971 /*
1960 * 2 PLANE, MLC, and Flex-OneNAND wait here 1972 * 2 PLANE, MLC, and Flex-OneNAND wait here
@@ -3377,8 +3389,10 @@ static void onenand_check_features(struct mtd_info *mtd)
3377 case ONENAND_DEVICE_DENSITY_4Gb: 3389 case ONENAND_DEVICE_DENSITY_4Gb:
3378 if (ONENAND_IS_DDP(this)) 3390 if (ONENAND_IS_DDP(this))
3379 this->options |= ONENAND_HAS_2PLANE; 3391 this->options |= ONENAND_HAS_2PLANE;
3380 else if (numbufs == 1) 3392 else if (numbufs == 1) {
3381 this->options |= ONENAND_HAS_4KB_PAGE; 3393 this->options |= ONENAND_HAS_4KB_PAGE;
3394 this->options |= ONENAND_HAS_CACHE_PROGRAM;
3395 }
3382 3396
3383 case ONENAND_DEVICE_DENSITY_2Gb: 3397 case ONENAND_DEVICE_DENSITY_2Gb:
3384 /* 2Gb DDP does not have 2 plane */ 3398 /* 2Gb DDP does not have 2 plane */
@@ -3415,6 +3429,8 @@ static void onenand_check_features(struct mtd_info *mtd)
3415 printk(KERN_DEBUG "Chip has 2 plane\n"); 3429 printk(KERN_DEBUG "Chip has 2 plane\n");
3416 if (this->options & ONENAND_HAS_4KB_PAGE) 3430 if (this->options & ONENAND_HAS_4KB_PAGE)
3417 printk(KERN_DEBUG "Chip has 4KiB pagesize\n"); 3431 printk(KERN_DEBUG "Chip has 4KiB pagesize\n");
3432 if (this->options & ONENAND_HAS_CACHE_PROGRAM)
3433 printk(KERN_DEBUG "Chip has cache program feature\n");
3418} 3434}
3419 3435
3420/** 3436/**