[PATCH] [MTD] devices/mtd_dataflash: Add SW sector protection support

David Brownell david-b at pacbell.net
Mon Mar 23 16:35:31 EDT 2009


On Wednesday 25 February 2009, Mike Frysinger wrote:
> On Wed, Feb 25, 2009 at 07:17, Mike McTernan wrote:
> > From: Michael McTernan <mmcternan at airvana.com>
> >
> > The Atmel AT45DBxxxD serial DataFlash parts allow software protection of
> > specific device sectors.  This is detailed in section 8, "Sector
> > Protection" of the data sheets available on their site (e.g.
> > http://www.atmel.com/dyn/resources/prod_documents/doc3597.pdf).
> >
> > This patch expands the device probe tables to include sector geometry
> > information, and issues the "enable sector protection command" after a
> > compatible part is found and the build is configured with
> > CONFIG_MTD_DATAFLASH_SWPROT.  The lock() and unlock() functions are then
> > implemented to allow manipulation of the "sector protection register" in
> > the device such that program/erase operations can be selectively allowed
> > or blocked.  Note that this register is subject to a limit of 10,000
> > erase/program cycles according to the datasheet.

I took a really quick look at this.  The terminology is
confusing ... there are now two kinds of "sector" in the
driver.  Call one of them "lock sector" or somesuch, so
it makes sense to check the count of such sectors; and
stylistically, it'd be better not to #ifdef the guts of
the lock/unlock methods.  #define them as NULL when
SWPROT is not configured, and don't even set those
methods for devices that don't support those ops.






More information about the linux-mtd mailing list