cfi_cmdset_0002 and writes

Tim Hockin thockin at sun.com
Wed Jul 18 18:29:48 EDT 2001


David Woodhouse wrote:
> 
> thockin at sun.com said:
> >  The flash can be erased by 64k blocks.  Since it is flash, you can
> > only reprogram '1' bits to '0' bits, and never vice versa.  What I
> > don't find is any hooks in cfi_cmdset_0002 to read a whole block,
> > erase it, make changes to the in-memory block and write it back to
> > flash.

> It doesn't. Doing that kind of thing is scary and dangerous, and certainly
> doesn't belong in the low-level driver. We have real filesystems and
> translation layers which work on flash instead.

Right, but this is our boot ROM we're dealing with :)  Can you suggest a
better alternative?  The device is rarely ever loaded, but when it is
loaded we want to read and re-program the whole thing as safely as
possible.

MTD seems to be geared more towards flash devices that get lots of use. 
How should I go about plugging this into MTD?
 
> However, the primitive read/erase/modify/pray_we_don't_lose_power/writeback
> behaviour you described is available in the 'mtdblock' driver, and it's sane
> enough to use it if you only write to it during setup, then run it normally
> in read-only mode.

We'll be loading the driver for our flash after potentially months of
uptime.  The new image will be flashed in, and the driver will be unloaded
until the next flash update.


-- 
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
thockin at sun.com




More information about the linux-mtd mailing list