Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/head/sys/dev/flash/mx25l.c Wed Dec 05 12:37:28 2012 +0200
- +++ b/head/sys/dev/flash/mx25l.c Wed Dec 05 14:10:50 2012 +0200
- @@ -231,9 +231,10 @@
- uint8_t txBuf[4];//, rxBuf[4];
- uint8_t status;
- struct spi_command cmd;
- - int err;
- + int err, timeout;
- sc = device_get_softc(dev);
- + mx25l_wait_for_device_ready(dev);
- MX25LDEBUG(sc, MX25L_DBG_WRITE, "%s(dev, writable=%d)\n", __func__,
- writable);
- @@ -246,9 +247,17 @@
- cmd.tx_cmd_sz = 1;
- err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd);
- - status = mx25l_get_status(dev);
- + mx25l_wait_for_device_ready(dev);
- - if (writable && !(status & STATUS_WEL))
- + timeout = 1000;
- + while (timeout--) {
- + status = mx25l_get_status(dev);
- + if (writable && (status & STATUS_WEL))
- + break;
- + if (!writable && !(status & STATUS_WEL))
- + break;
- + }
- + if (timeout == 0)
- device_printf(dev, "%s - fail\n", __func__);
- }
- @@ -531,6 +540,7 @@
- mx25l_attach_sysctl(dev);
- #endif
- + device_printf(sc->sc_dev, "status is 0x%02x\n", mx25l_get_status(dev));
- return (0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement