diff options
author | adrian <adrian@FreeBSD.org> | 2010-07-19 21:38:15 +0000 |
---|---|---|
committer | adrian <adrian@FreeBSD.org> | 2010-07-19 21:38:15 +0000 |
commit | 18aed410d7a454b9083404c6c8604bcebc98fdeb (patch) | |
tree | 701ac443304d479424ff9e233ac2bc7464d6da74 | |
parent | 0e81d4d08522fb054cad9e4a3f63e196f0c38e54 (diff) | |
download | FreeBSD-src-18aed410d7a454b9083404c6c8604bcebc98fdeb.zip FreeBSD-src-18aed410d7a454b9083404c6c8604bcebc98fdeb.tar.gz |
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.
-rw-r--r-- | sys/dev/flash/mx25l.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/flash/mx25l.c b/sys/dev/flash/mx25l.c index ef0488a..0ff7186 100644 --- a/sys/dev/flash/mx25l.c +++ b/sys/dev/flash/mx25l.c @@ -45,6 +45,10 @@ __FBSDID("$FreeBSD$"); #include <dev/flash/mx25lreg.h> +#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 *bp); 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; |