SHOW:
|
|
- or go back to the newest paste.
1 | - | diff -r a7c552e1ed7f head/sys/dev/flash/mx25l.c |
1 | + | |
2 | +++ b/head/sys/dev/flash/mx25l.c Wed Dec 05 14:10:50 2012 +0200 | |
3 | - | +++ b/head/sys/dev/flash/mx25l.c Wed Dec 05 13:42:00 2012 +0200 |
3 | + | @@ -231,9 +231,10 @@ |
4 | - | @@ -231,7 +231,7 @@ |
4 | + | |
5 | uint8_t status; | |
6 | struct spi_command cmd; | |
7 | - int err; | |
8 | + int err, timeout; | |
9 | ||
10 | sc = device_get_softc(dev); | |
11 | + mx25l_wait_for_device_ready(dev); | |
12 | ||
13 | - | @@ -246,9 +246,15 @@ |
13 | + | MX25LDEBUG(sc, MX25L_DBG_WRITE, "%s(dev, writable=%d)\n", __func__, |
14 | writable); | |
15 | @@ -246,9 +247,17 @@ | |
16 | cmd.tx_cmd_sz = 1; | |
17 | err = SPIBUS_TRANSFER(device_get_parent(dev), dev, &cmd); | |
18 | - | - |
18 | + | |
19 | - status = mx25l_get_status(dev); | |
20 | + mx25l_wait_for_device_ready(dev); | |
21 | ||
22 | - if (writable && !(status & STATUS_WEL)) | |
23 | + timeout = 1000; | |
24 | + while (timeout--) { | |
25 | + status = mx25l_get_status(dev); | |
26 | + if (writable && (status & STATUS_WEL)) | |
27 | + break; | |
28 | + if (!writable && !(status & STATUS_WEL)) | |
29 | + break; | |
30 | + } | |
31 | + if (timeout == 0) | |
32 | device_printf(dev, "%s - fail\n", __func__); | |
33 | } | |
34 | ||
35 | @@ -531,6 +540,7 @@ | |
36 | mx25l_attach_sysctl(dev); | |
37 | #endif | |
38 | ||
39 | + device_printf(sc->sc_dev, "status is 0x%02x\n", mx25l_get_status(dev)); | |
40 | return (0); | |
41 | } |