Date: Sat, 6 May 2017 05:52:01 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r317865 - head/sys/dev/cfi Message-ID: <201705060552.v465q1l7076541@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Sat May 6 05:52:01 2017 New Revision: 317865 URL: https://svnweb.freebsd.org/changeset/base/317865 Log: [cfi] fix CFI flash reset command for MX29LV320T/B. MX flash MX29LV320T/B datasheet say reset is 0xf0. Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Approved by: mizhka Differential Revision: https://reviews.freebsd.org/D10177 Modified: head/sys/dev/cfi/cfi_core.c head/sys/dev/cfi/cfi_reg.h Modified: head/sys/dev/cfi/cfi_core.c ============================================================================== --- head/sys/dev/cfi/cfi_core.c Sat May 6 05:50:07 2017 (r317864) +++ head/sys/dev/cfi/cfi_core.c Sat May 6 05:52:01 2017 (r317865) @@ -145,6 +145,17 @@ cfi_write(struct cfi_softc *sc, u_int of } } +/* + * 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 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) { Modified: head/sys/dev/cfi/cfi_reg.h ============================================================================== --- head/sys/dev/cfi/cfi_reg.h Sat May 6 05:50:07 2017 (r317864) +++ head/sys/dev/cfi/cfi_reg.h Sat May 6 05:52:01 2017 (r317865) @@ -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 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201705060552.v465q1l7076541>