Date: Mon, 19 Jul 2010 21:46:40 +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: r210264 - head/sys/dev/flash Message-ID: <201007192146.o6JLken5092049@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007192146.o6JLken5092049>