From: unsik Kim <donari75@gmail.com>
To: axboe@kernel.dk, tj@kernel.org
Cc: linux-kernel@vger.kernel.org, unsik Kim <donari75@gmail.com>
Subject: [PATCH 2/2] mg_disk: fix reading invalid status when use polling driver
Date: Thu, 23 Jul 2009 13:57:46 +0900 [thread overview]
Message-ID: <1248325066-4071-2-git-send-email-donari75@gmail.com> (raw)
In-Reply-To: <1248325066-4071-1-git-send-email-donari75@gmail.com>
When using polling driver, little delay is required to access
status register. Without this, host might read invalid status.
Signed-off-by: unsik Kim <donari75@gmail.com>
---
drivers/block/mg_disk.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/drivers/block/mg_disk.c b/drivers/block/mg_disk.c
index 26371d5..6d7fbaa 100644
--- a/drivers/block/mg_disk.c
+++ b/drivers/block/mg_disk.c
@@ -218,6 +218,16 @@ static unsigned int mg_wait(struct mg_host *host, u32 expect, u32 msec)
host->error = MG_ERR_NONE;
expire = jiffies + msecs_to_jiffies(msec);
+ /* These 2 times dummy status read prevents reading invalid
+ * status. A very little time (3 times of mflash operating clk)
+ * is required for busy bit is set. Use dummy read instead of
+ * busy wait, because mflash's PLL is machine dependent.
+ */
+ if (prv_data->use_polling) {
+ status = inb((unsigned long)host->dev_base + MG_REG_STATUS);
+ status = inb((unsigned long)host->dev_base + MG_REG_STATUS);
+ }
+
status = inb((unsigned long)host->dev_base + MG_REG_STATUS);
do {
--
1.6.0.6
next prev parent reply other threads:[~2009-07-23 5:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-23 4:57 [PATCH 1/2] mg_disk: remove prohibited sleep operation unsik Kim
2009-07-23 4:57 ` unsik Kim [this message]
2009-07-27 21:32 ` Andrew Morton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1248325066-4071-2-git-send-email-donari75@gmail.com \
--to=donari75@gmail.com \
--cc=axboe@kernel.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=tj@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.