Commit 61a7e198 authored by Artem Bityutskiy's avatar Artem Bityutskiy Committed by Artem Bityutskiy

[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: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
parent 60d84f97
...@@ -310,7 +310,6 @@ static int onenand_wait(struct mtd_info *mtd, int state) ...@@ -310,7 +310,6 @@ static int onenand_wait(struct mtd_info *mtd, int state)
if (state != FL_READING) if (state != FL_READING)
cond_resched(); cond_resched();
touch_softlockup_watchdog();
} }
/* To get correct interrupt status in timeout case */ /* To get correct interrupt status in timeout case */
interrupt = this->read_word(this->base + ONENAND_REG_INTERRUPT); 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,9 +366,6 @@ static int onenand_interrupt_wait(struct mtd_info *mtd, int state)
{ {
struct onenand_chip *this = mtd->priv; struct onenand_chip *this = mtd->priv;
/* To prevent soft lockup */
touch_softlockup_watchdog();
wait_for_completion(&this->complete); wait_for_completion(&this->complete);
return onenand_wait(mtd, state); return onenand_wait(mtd, state);
...@@ -390,9 +386,6 @@ static int onenand_try_interrupt_wait(struct mtd_info *mtd, int state) ...@@ -390,9 +386,6 @@ static int onenand_try_interrupt_wait(struct mtd_info *mtd, int state)
/* We use interrupt wait first */ /* We use interrupt wait first */
this->wait = onenand_interrupt_wait; this->wait = onenand_interrupt_wait;
/* To prevent soft lockup */
touch_softlockup_watchdog();
timeout = msecs_to_jiffies(100); timeout = msecs_to_jiffies(100);
remain = wait_for_completion_timeout(&this->complete, timeout); remain = wait_for_completion_timeout(&this->complete, timeout);
if (!remain) { if (!remain) {
...@@ -734,6 +727,8 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len, ...@@ -734,6 +727,8 @@ static int onenand_read(struct mtd_info *mtd, loff_t from, size_t len,
stats = mtd->ecc_stats; stats = mtd->ecc_stats;
while (read < len) { while (read < len) {
cond_resched();
thislen = min_t(int, mtd->writesize, len - read); thislen = min_t(int, mtd->writesize, len - read);
column = from & (mtd->writesize - 1); 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,6 +810,8 @@ int onenand_do_read_oob(struct mtd_info *mtd, loff_t from, size_t len,
column = from & (mtd->oobsize - 1); column = from & (mtd->oobsize - 1);
while (read < len) { while (read < len) {
cond_resched();
thislen = mtd->oobsize - column; thislen = mtd->oobsize - column;
thislen = min_t(int, thislen, len); thislen = min_t(int, thislen, len);
...@@ -989,6 +986,8 @@ static int onenand_write(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -989,6 +986,8 @@ static int onenand_write(struct mtd_info *mtd, loff_t to, size_t len,
int thislen = min_t(int, bytes, len - written); int thislen = min_t(int, bytes, len - written);
u_char *wbuf = (u_char *) buf; u_char *wbuf = (u_char *) buf;
cond_resched();
this->command(mtd, ONENAND_CMD_BUFFERRAM, to, bytes); this->command(mtd, ONENAND_CMD_BUFFERRAM, to, bytes);
/* Partial page write */ /* Partial page write */
...@@ -1075,6 +1074,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len, ...@@ -1075,6 +1074,8 @@ static int onenand_do_write_oob(struct mtd_info *mtd, loff_t to, size_t len,
while (written < len) { while (written < len) {
int thislen = min_t(int, mtd->oobsize, len - written); int thislen = min_t(int, mtd->oobsize, len - written);
cond_resched();
column = to & (mtd->oobsize - 1); column = to & (mtd->oobsize - 1);
this->command(mtd, ONENAND_CMD_BUFFERRAM, to, mtd->oobsize); 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,6 +1203,7 @@ static int onenand_erase(struct mtd_info *mtd, struct erase_info *instr)
instr->state = MTD_ERASING; instr->state = MTD_ERASING;
while (len) { while (len) {
cond_resched();
/* Check if we have a bad block, we do not erase bad blocks */ /* Check if we have a bad block, we do not erase bad blocks */
if (onenand_block_checkbad(mtd, addr, 0, 0)) { if (onenand_block_checkbad(mtd, addr, 0, 0)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment