nand locking

Todd Poynor tpoynor at
Wed Apr 27 14:27:09 EDT 2005

Timofei V. Bondarenko wrote:

> It would be nice to unlock the rw partitions only.
> But it's weird a bit:
> the mtd_partition may be incomplete before add_mtd_partitions() done.
> After add_mtd_partitions() my startap code has no handle to actual 
> partition info.
> The mtd_partition.mtdp seems only choice, though it prevents partitions 
> from registering...
> So, could couple of lines in add_mtd_partitions() do that work?

If I understand correctly, it may be the same issue I ran into on Intel 
NOR flash: the chip driver (which may have the knowledge of whether the 
particular chips are locked or lockable) gets to see the "whole device" 
struct mtd_info at probe time, but doesn't see the "partition" structs 
registered later via add_mtd_partitions(), which have the per-partition 
r/w flags.

I tried adding a callback to the chip driver at each device/partition 
add (see first patch attempt in recent "Fixup Intel flash that powers up 
locked" thread).  But I believe that was part of what was (justifiably) 
deemed messy about the patch.

So far the general verdict on these flashes that power up locked seems 
to be either leave all blocks locked or unlock all blocks (either in the 
bootloader or at flash probe time), and let custom code in userspace 
lock/unlock what is needed.  I do like the idea of the kernel rectifying 
lock status with the map flags myself, though...


More information about the linux-mtd mailing list