Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Sep 2012 16:36:31 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 217311 for review
Message-ID:  <201209141636.q8EGaVhm041840@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@217311?ac=10

Change 217311 by brooks@brooks_zenith on 2012/09/14 16:36:25

	Intel and Sharp flash power on with their blocks in a "locked"
	state.  Unlocked them before attempting to perform an erase or
	write action.

Affected files ...

.. //depot/projects/ctsrd/beribsd/src/sys/dev/cfi/cfi_core.c#3 edit
.. //depot/projects/ctsrd/beribsd/src/sys/dev/cfi/cfi_reg.h#2 edit

Differences ...

==== //depot/projects/ctsrd/beribsd/src/sys/dev/cfi/cfi_core.c#3 (text+ko) ====

@@ -390,6 +390,15 @@
 	register_t intr;
 	int error, i;
 
+	switch (sc->sc_cmdset) {
+	case CFI_VEND_INTEL_ECS:
+	case CFI_VEND_INTEL_SCS:
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_LBS);
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_UB);
+		cfi_write(sc, sc->sc_wrofs, CFI_BCS_READ_ARRAY);
+		break;
+	}
+
 	/* Erase the block. */
 	switch (sc->sc_cmdset) {
 	case CFI_VEND_INTEL_ECS:
@@ -457,6 +466,14 @@
 	/* error is 0. */
 
  out:
+	switch (sc->sc_cmdset) {
+	case CFI_VEND_INTEL_ECS:
+	case CFI_VEND_INTEL_SCS:
+		cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_LBS);
+		cfi_write(sc, sc->sc_wrofs, CFI_INTEL_LB);
+		break;
+	}
 	cfi_write(sc, 0, CFI_BCS_READ_ARRAY);
 	return (error);
 }

==== //depot/projects/ctsrd/beribsd/src/sys/dev/cfi/cfi_reg.h#2 (text+ko) ====

@@ -105,8 +105,11 @@
 #define	CFI_BCS_READ_ARRAY	0xff
 
 /* Intel commands. */
+#define	CFI_INTEL_LB		0x01	/* Lock Block */
+#define	CFI_INTEL_LBS		0x60	/* Lock Block Setup */
 #define	CFI_INTEL_READ_ID	0x90	/* Read Identifier */
 #define	CFI_INTEL_PP_SETUP	0xc0	/* Protection Program Setup */
+#define	CFI_INTEL_UB		0xd0	/* Unlock Block */
 
 /* NB: these are addresses for 16-bit accesses */
 #define	CFI_INTEL_PLR		0x80	/* Protection Lock Register */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209141636.q8EGaVhm041840>