diff options
| author | Adrian Chadd <adrian@FreeBSD.org> | 2017-05-06 05:52:01 +0000 |
|---|---|---|
| committer | Adrian Chadd <adrian@FreeBSD.org> | 2017-05-06 05:52:01 +0000 |
| commit | 6bf13692f9810b1385fae8aa49a3c98fb9b0ced4 (patch) | |
| tree | adf2afe4ccbaa4ff66038b488faa5c4fac15ace1 /sys/dev/cfi | |
| parent | 4aa177430ccf2732e8811c7ab884a427bf0304ac (diff) | |
Notes
Diffstat (limited to 'sys/dev/cfi')
| -rw-r--r-- | sys/dev/cfi/cfi_core.c | 15 | ||||
| -rw-r--r-- | sys/dev/cfi/cfi_reg.h | 1 |
2 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/cfi/cfi_core.c b/sys/dev/cfi/cfi_core.c index d292e1a4188b..1bf687e3ceea 100644 --- a/sys/dev/cfi/cfi_core.c +++ b/sys/dev/cfi/cfi_core.c @@ -145,6 +145,17 @@ cfi_write(struct cfi_softc *sc, u_int ofs, u_int val) } } +/* + * This is same workaound as NetBSD sys/dev/nor/cfi.c cfi_reset_default() + */ +static void +cfi_reset_default(struct cfi_softc *sc) +{ + + cfi_write(sc, 0, CFI_BCS_READ_ARRAY2); + cfi_write(sc, 0, CFI_BCS_READ_ARRAY); +} + uint8_t cfi_read_qry(struct cfi_softc *sc, u_int ofs) { @@ -152,7 +163,7 @@ cfi_read_qry(struct cfi_softc *sc, u_int ofs) cfi_write(sc, CFI_QRY_CMD_ADDR * sc->sc_width, CFI_QRY_CMD_DATA); val = cfi_read(sc, ofs * sc->sc_width); - cfi_write(sc, 0, CFI_BCS_READ_ARRAY); + cfi_reset_default(sc); return (val); } @@ -745,7 +756,7 @@ cfi_write_block(struct cfi_softc *sc) /* error is 0. */ out: - cfi_write(sc, 0, CFI_BCS_READ_ARRAY); + cfi_reset_default(sc); /* Relock Intel flash */ switch (sc->sc_cmdset) { diff --git a/sys/dev/cfi/cfi_reg.h b/sys/dev/cfi/cfi_reg.h index c810e3f7448d..8f4f3de66c38 100644 --- a/sys/dev/cfi/cfi_reg.h +++ b/sys/dev/cfi/cfi_reg.h @@ -113,6 +113,7 @@ struct cfi_qry { #define CFI_BCS_CONFIRM 0xd0 #define CFI_BCS_BUF_PROG_SETUP 0xe8 #define CFI_BCS_READ_ARRAY 0xff +#define CFI_BCS_READ_ARRAY2 0xf0 /* Intel commands. */ #define CFI_INTEL_LB 0x01 /* Lock Block */ |
