From owner-svn-src-all@FreeBSD.ORG Mon Jul 19 21:46:40 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AF7D2106566B; Mon, 19 Jul 2010 21:46:40 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A180C8FC19; Mon, 19 Jul 2010 21:46:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6JLkeeX092051; Mon, 19 Jul 2010 21:46:40 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6JLken5092049; Mon, 19 Jul 2010 21:46:40 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201007192146.o6JLken5092049@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Jul 2010 21:46:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210264 - head/sys/dev/flash X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jul 2010 21:46:40 -0000 Author: adrian Date: Mon Jul 19 21:46:40 2010 New Revision: 210264 URL: http://svn.freebsd.org/changeset/base/210264 Log: Extend the mx25l erase function to support different erase commands. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Mon Jul 19 21:41:54 2010 (r210263) +++ head/sys/dev/flash/mx25l.c Mon Jul 19 21:46:40 2010 (r210264) @@ -184,7 +184,7 @@ mx25l_set_writable(device_t dev, int wri } static void -mx25l_erase_sector(device_t dev, off_t sector) +mx25l_erase_cmd(device_t dev, off_t sector, uint8_t ecmd) { uint8_t txBuf[4], rxBuf[4]; struct spi_command cmd; @@ -197,7 +197,7 @@ mx25l_erase_sector(device_t dev, off_t s memset(txBuf, 0, sizeof(txBuf)); memset(rxBuf, 0, sizeof(rxBuf)); - txBuf[0] = CMD_SECTOR_ERASE; + txBuf[0] = ecmd; cmd.tx_cmd = txBuf; cmd.rx_cmd = rxBuf; cmd.rx_cmd_sz = 4; @@ -258,7 +258,7 @@ mx25l_write(device_t dev, off_t offset, * If we crossed sector boundary - erase next sector */ if (((offset + bytes_writen) % sc->sc_sectorsize) == 0) - mx25l_erase_sector(dev, offset + bytes_writen); + mx25l_erase_cmd(dev, offset + bytes_writen, CMD_SECTOR_ERASE); txBuf[0] = CMD_PAGE_PROGRAM; txBuf[1] = ((write_offset >> 16) & 0xff);