diff options
author | unsik Kim <donari75@gmail.com> | 2009-07-28 08:52:07 +0200 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2009-07-28 08:52:07 +0200 |
commit | eb32baec15c38ae6f06cb898a9f791578c5f8c79 (patch) | |
tree | ecc439936edd9cb629a24e473a67241a4d2a586c /drivers/block/mg_disk.c | |
parent | 48f5690d45b79ffeedc5ab24243b576056f1d2ff (diff) | |
download | op-kernel-dev-eb32baec15c38ae6f06cb898a9f791578c5f8c79.zip op-kernel-dev-eb32baec15c38ae6f06cb898a9f791578c5f8c79.tar.gz |
mg_disk: fix reading invalid status when use polling driver
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>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers/block/mg_disk.c')
-rw-r--r-- | 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 5b120ea..6440d59 100644 --- a/drivers/block/mg_disk.c +++ b/drivers/block/mg_disk.c @@ -219,6 +219,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 { |