Commit Graph

5 Commits

Author SHA1 Message Date
wiz 3ed1aa9185 Spell "separate" correctly. From Zafer Aydogan. 2006-12-25 18:39:47 +00:00
christos 1665d5e960 fix spelling of accommodate; from Zapher. 2006-11-24 19:46:58 +00:00
gdamore e8ac1cad77 This commit provides substantial fixes and functionality for SPI flash.
Specifically, the SPI flash now operates as a nearly fully functional block
device (other than lacking disklabel support).  It does some basic translation
stuff, so that if you attempt to write a block, the underlying flash sectors
(usually 64k in size) will be read, erased and rewritten.

To minize thrashing, the spiflash strategy routine attempts to gather writes
to the same sector together, so that in the typical case you will not have to
repeatedly erase/rewrite the sector.  It also attempts to check and verify
whether an erase cycle is truly needed.  There are still access patterns that
will cause multiple erases to occur, and so I heartily discourage the use
of these flash devices for storing anything other than small configuration
data, or write-once images.  If you want to do more than that, then someone
should try to write a real flash translation layer.

The drivers attempt to provide some level of asynchronous operation, so that
while you are erasing or writing to the flash, other things can reasonably
take place.

Note that spiflash does not do bad block remapping.  It also doesn't detect
when a device is in read-only mode, or if some sectors are read-only.  It
only supports uniform sectored NOR flash.  It lacks any code to deal with
disklabels, and does not offer any disk related ioctls.

These limitations aside, it would not be terribly hard, I think, to break
out the code I've done to create a generic "norflash" driver, backed by
a "common" spiflash module.  Then other flash drivers (e.g. athflash, etc.)
could benefit from the ability to use this as a block device.  I've tried
to architect it to support that, if someone else wants to do the work.
(Hi Jared!)

The primary reason that I've not added code to deal with disklabels is that
I had a difficult time figuring out which framework (disklabels or wedges)
to use, and which bits of code were necessary to implement.  In the case of
the flash devices I'm working with, a parser to deal with redboot FIS images
(partitions) would need to be added.  I was prepared to do this, but gave
up owing to the complete and total lack of any API or design documentation
pertaining to the requirements for disk drivers and disklabel management or
wedges.   I would strongly encourage someone who knows something about
wedges or disklabels to write a simple document (or even a dummy driver)
showing which interfaces should be provided in new mass storage drivers.

This work was funded by the Champaign-Urbana Community Wireless Network
Project.
2006-10-20 06:41:46 +00:00
gdamore c36ea7cf37 Add spiflash driver, and M25P instance, used for STMicro flash devices
found on Meraki Mini (for example).
2006-10-07 07:21:13 +00:00
gdamore 5c050c465e Initial commit of SPI bus (also known as Microwire) framework, along with
a sample driver for the TI TMP121 temperature sensor.  This has been
moderately tested on Au1550, and it is not enabled in sys/conf (yet).  So
the change is harmless at worst, and useful at best.

Alchemy Au1550 bus driver forthcoming, along with a driver for SPI flash
devices, such as found on the Meraki Mini

This development was partially funded by the Champaign-Urbana Community
Wireless Network Project.

Note that there are some MD-specific SPI drivers that could probably be
made MI under this new framework.
2006-10-02 07:18:19 +00:00