Skip to content

Commit

Permalink
mg_disk: fix reading invalid status when use polling driver
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
unsik Kim authored and Jens Axboe committed Jul 28, 2009
1 parent 48f5690 commit eb32bae
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/block/mg_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit eb32bae

Please sign in to comment.