aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2006-12-26 02:41:24 -0500
committerArtem Bityutskiy <dedekind@infradead.org>2007-01-10 07:39:57 -0500
commit61a7e1983e773b93aac172dadc97f1eb484536b4 (patch)
treea0c048a22aa0bc4bf578809505f72ad72cf7e815 /drivers/mtd
parent60d84f9739a47d0ed8e19805d9056e39fba31c79 (diff)
[MTD] OneNAND: release CPU in cycles
This patch teaches OneNAND to release processor in read/write/erase cycles and let other processes proceed. Also, remove buggi touch watchdog call which only hides the problem instead of solving it. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/onenand/onenand_base.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 51fb84055ba3..0037cee5ef27 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -310,7 +310,6 @@ static int onenand_wait(struct mtd_info *mtd, int state)
310 310
311 if (state != FL_READING) 311 if (state != FL_READING)
312 cond_resched(); 312 cond_resched();
313 touch_softlockup_watchdog();
314 } 313 }
315 /* To get correct interrupt status in timeout case */ 314 /* To get correct interrupt status in timeout case */
316 interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT); 315 interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT);
@@ -367,9 +366,6 @@ static int onenand_interrupt_wait(struct mtd_info *mtd, int state)
367{ 366{
368 struct onenand_chip *this = mtd->priv; 367 struct onenand_chip *this = mtd->priv;
369 368
370 /* To prevent soft lockup */
371 touch_softlockup_watchdog();
372
373 wait_for_completion(&this->complete); 369 wait_for_completion(&this->complete);
374 370
375 return onenand_wait(mtd, state); 371 return onenand_wait(mtd, state);
@@ -390,9 +386,6 @@ static int onenand_try_interrupt_wait(struct mtd_info *mtd, int state)
390 /* We use interrupt wait first */ 386 /* We use interrupt wait first */
391 this->wait = onenand_interrupt_wait; 387 this->wait = onenand_interrupt_wait;
392 388
393 /* To prevent soft lockup */
394 touch_softlockup_watchdog();
395
396 timeout = msecs_to_jiffies(100); 389 timeout = msecs_to_jiffies(100);
397 remain = wait_for_completion_timeout(&this->complete, timeout); 390 remain = wait_for_completion_timeout(&this->complete, timeout);
398 if (!remain) { 391 if (!remain) {
@@ -734,6 +727,8 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
734 727
735 stats = mtd->ecc_stats; 728 stats = mtd->ecc_stats;
736 while (read < len) { 729 while (read < len) {
730 cond_resched();
731
737 thislen = min_t(int, mtd->writesize, len - read); 732 thislen = min_t(int, mtd->writesize, len - read);
738 733
739 column = from & (mtd->writesize - 1); 734 column = from & (mtd->writesize - 1);
@@ -815,6 +810,8 @@ int onenand_do_read_oob(struct mtd_info *mtd, loff_t from, size_t len,
815 column = from & (mtd->oobsize - 1); 810 column = from & (mtd->oobsize - 1);
816 811
817 while (read < len) { 812 while (read < len) {
813 cond_resched();
814
818 thislen = mtd->oobsize - column; 815 thislen = mtd->oobsize - column;
819 thislen = min_t(int, thislen, len); 816 thislen = min_t(int, thislen, len);
820 817
@@ -989,6 +986,8 @@ static int onenand_write(struct mtd_info *mtd, loff_t to, size_t len,
989 int thislen = min_t(int, bytes, len - written); 986 int thislen = min_t(int, bytes, len - written);
990 u_char *wbuf = (u_char *) buf; 987 u_char *wbuf = (u_char *) buf;
991 988
989 cond_resched();
990
992 this->command(mtd, ONENAND_CMD_BUFFERRAM, to, bytes); 991 this->command(mtd, ONENAND_CMD_BUFFERRAM, to, bytes);
993 992
994 /* Partial page write */ 993 /* Partial page write */
@@ -1075,6 +1074,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
1075 while (written < len) { 1074 while (written < len) {
1076 int thislen = min_t(int, mtd->oobsize, len - written); 1075 int thislen = min_t(int, mtd->oobsize, len - written);
1077 1076
1077 cond_resched();
1078
1078 column = to & (mtd->oobsize - 1); 1079 column = to & (mtd->oobsize - 1);
1079 1080
1080 this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->oobsize); 1081 this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->oobsize);
@@ -1202,6 +1203,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
1202 instr->state = MTD_ERASING; 1203 instr->state = MTD_ERASING;
1203 1204
1204 while (len) { 1205 while (len) {
1206 cond_resched();
1205 1207
1206 /* Check if we have a bad block, we do not erase bad blocks */ 1208 /* Check if we have a bad block, we do not erase bad blocks */
1207 if (onenand_block_checkbad(mtd, addr, 0, 0)) { 1209 if (onenand_block_checkbad(mtd, addr, 0, 0)) {