Bugfix: wait for writes/erases to complete after starting them, instead of

before starting them.

Using the wait-before logic would make sense if there was useful time-
consuming work that could be done between the end of one write and the
beginning of the next, but it also requires doing the wait-for-ready before
reading, because a prior write or erase could still be in progress.  Reading
is the far more common case, so adding a whole extra bus transaction to
check for ready before each read would soak up any small gains that might be
had from doing async writes.
This commit is contained in:
Ian Lepore 2018-03-18 16:52:31 +00:00
parent c6a70eaea8
commit 89a895b63c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=331132

View file

@ -247,7 +247,6 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ecmd)
sc = device_get_softc(dev);
mx25l_wait_for_device_ready(dev);
mx25l_set_writable(dev, 1);
memset(&cmd, 0, sizeof(cmd));
@ -272,6 +271,7 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ecmd)
txBuf[3] = (sector & 0xff);
}
err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd);
mx25l_wait_for_device_ready(dev);
}
static int
@ -339,6 +339,7 @@ mx25l_write(device_t dev, off_t offset, caddr_t data, off_t count)
mx25l_set_writable(dev, 1);
err = SPIBUS_TRANSFER(pdev, dev, &cmd);
mx25l_wait_for_device_ready(dev);
if (err)
break;