Handling bus locking of CFI Flash devices

Norbert van Bolhuis nvbolhuis at aimvalley.nl
Fri Nov 30 09:12:58 EST 2012

On 11/29/12 16:39, Thomas De Schampheleire wrote:
> On Fri, Nov 23, 2012 at 7:34 PM, Thomas De Schampheleire
> <patrickdepinguin at gmail.com>  wrote:
>> Hi,
>> I have an embedded PowerPC system with a CFI Flash located on the local bus.
>> Additionally, there is a control device with a 'flash-write-protect'
>> feature. By default, no writes can happen to the flash device on the
>> local bus, unless the flash-write-protect bit is cleared.
>> This also means that detection of the flash chip using CFI commands
>> will fail by default, as this incurs write operations to the bus.
>> Note that this flash-write-protect is different from the standard
>> flash 'lock/unlock' feature. The former is implemented on a specific
>> control logic chip of the board, while the latter is part of the flash
>> chip/controller itself.
>> My question is: what is the best way to handle this flash-write-protect bit?
>> Right now, I am simply clearing the bit before booting the kernel,
>> which means that all write access to the flash is allowed. While this
>> works, it completely bypasses the protection feature.
>> Is there already a place in the MTD subsystem to handle such a
>> flash-write-protect bit, for example a hook that can be implemented
>> for a particular board?
>> If not, how do you suggest I proceed?
> Any feedback on this issue?

I do not think there is a hook for this.

You'd have to make such a hook yourself (in the mtd map_info struct ?)

or you can make your own mtd map driver that handles flash-write-protect
bit as desired.

N. van Bolhuis.

More information about the linux-mtd mailing list