Author: ian Date: Sun Mar 18 16:52:31 2018 New Revision: 331132 URL: https://svnweb.freebsd.org/changeset/base/331132
Log: 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. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Sun Mar 18 16:49:30 2018 (r331131) +++ head/sys/dev/flash/mx25l.c Sun Mar 18 16:52:31 2018 (r331132) @@ -247,7 +247,6 @@ mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ec 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 ec 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, mx25l_set_writable(dev, 1); err = SPIBUS_TRANSFER(pdev, dev, &cmd); + mx25l_wait_for_device_ready(dev); if (err) break; _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"