summaryrefslogtreecommitdiffstats
path: root/sys/dev/cfi/cfi_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/cfi/cfi_core.c')
-rw-r--r--sys/dev/cfi/cfi_core.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/dev/cfi/cfi_core.c b/sys/dev/cfi/cfi_core.c
index 4df3190..c25e446f 100644
--- a/sys/dev/cfi/cfi_core.c
+++ b/sys/dev/cfi/cfi_core.c
@@ -150,11 +150,16 @@ cfi_probe(device_t dev)
sc->sc_tag = rman_get_bustag(sc->sc_res);
sc->sc_handle = rman_get_bushandle(sc->sc_res);
- sc->sc_width = 1;
- while (sc->sc_width <= 4) {
- if (cfi_read_qry(sc, CFI_QRY_IDENT) == 'Q')
- break;
- sc->sc_width <<= 1;
+ if (sc->sc_width == 0) {
+ sc->sc_width = 1;
+ while (sc->sc_width <= 4) {
+ if (cfi_read_qry(sc, CFI_QRY_IDENT) == 'Q')
+ break;
+ sc->sc_width <<= 1;
+ }
+ } else if (cfi_read_qry(sc, CFI_QRY_IDENT) != 'Q') {
+ error = ENXIO;
+ goto out;
}
if (sc->sc_width > 4) {
error = ENXIO;
OpenPOWER on IntegriCloud