From owner-p4-projects@FreeBSD.ORG Fri Sep 14 16:36:33 2012 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 7B7B11065675; Fri, 14 Sep 2012 16:36:32 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AE531065672 for ; Fri, 14 Sep 2012 16:36:32 +0000 (UTC) (envelope-from brooks@freebsd.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id 146668FC15 for ; Fri, 14 Sep 2012 16:36:32 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id q8EGaVhU041843 for ; Fri, 14 Sep 2012 16:36:31 GMT (envelope-from brooks@freebsd.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id q8EGaVhm041840 for perforce@freebsd.org; Fri, 14 Sep 2012 16:36:31 GMT (envelope-from brooks@freebsd.org) Date: Fri, 14 Sep 2012 16:36:31 GMT Message-Id: <201209141636.q8EGaVhm041840@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to brooks@freebsd.org using -f From: Brooks Davis To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 217311 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 16:36:33 -0000 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 */