From owner-svn-src-all@FreeBSD.ORG Mon Jul 19 21:38:15 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 94D9110656AA; Mon, 19 Jul 2010 21:38:15 +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 6D3498FC20; Mon, 19 Jul 2010 21:38:15 +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 o6JLcFbb090062; Mon, 19 Jul 2010 21:38:15 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6JLcFhu090060; Mon, 19 Jul 2010 21:38:15 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201007192138.o6JLcFhu090060@svn.freebsd.org> From: Adrian Chadd Date: Mon, 19 Jul 2010 21:38:15 +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: r210262 - 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:38:15 -0000 Author: adrian Date: Mon Jul 19 21:38:15 2010 New Revision: 210262 URL: http://svn.freebsd.org/changeset/base/210262 Log: Extend the mx25l flash device support to include a set of per-device flags. Some of these parts will support 4K/32K block erases rather than a sector erase. This includes (at least) the MX25L128. Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Mon Jul 19 21:38:07 2010 (r210261) +++ head/sys/dev/flash/mx25l.c Mon Jul 19 21:38:15 2010 (r210262) @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include +#define FL_NONE 0x00 +#define FL_ERASE_4K 0x01 +#define FL_ERASE_32K 0x02 + struct mx25l_flash_ident { const char *name; @@ -52,6 +56,7 @@ struct mx25l_flash_ident uint16_t device_id; unsigned int sectorsize; unsigned int sectorcount; + unsigned int flags; }; struct mx25l_softc @@ -64,6 +69,7 @@ struct mx25l_softc struct disk *sc_disk; struct proc *sc_p; struct bio_queue_head sc_bio_queue; + unsigned int flags; }; #define M25PXX_LOCK(_sc) mtx_lock(&(_sc)->sc_mtx) @@ -83,10 +89,10 @@ static void mx25l_strategy(struct bio *b static void mx25l_task(void *arg); struct mx25l_flash_ident flash_devices[] = { - { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64 }, - { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128 }, - { "mx25ll128", 0xc2, 0x2018, 64 * 1024, 256 }, - { "s25fl128", 0x01, 0x2018, 64 * 1024, 256 }, + { "mx25ll32", 0xc2, 0x2016, 64 * 1024, 64, FL_NONE }, + { "mx25ll64", 0xc2, 0x2017, 64 * 1024, 128, FL_NONE }, + { "mx25ll128", 0xc2, 0x2018, 64 * 1024, 256, FL_ERASE_4K | FL_ERASE_32K }, + { "s25fl128", 0x01, 0x2018, 64 * 1024, 256, FL_NONE }, }; static uint8_t @@ -369,6 +375,7 @@ mx25l_attach(device_t dev) sc->sc_disk->d_dump = NULL; /* NB: no dumps */ /* Sectorsize for erase operations */ sc->sc_sectorsize = ident->sectorsize; + sc->flags = ident->flags; /* NB: use stripesize to hold the erase/region size for RedBoot */ sc->sc_disk->d_stripesize = ident->sectorsize;