[PATCH] mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) locking

Holger Brunck holger.brunck at keymile.com
Fri Dec 7 21:41:58 EST 2012


Hi Stefan,

On 12/07/2012 08:22 AM, Stefan Roese wrote:
> Currently cfi_cmdset_0002.c does not support PPB locking of sectors. This
> patch adds support for this locking/unlocking mechanism. It is needed on
> some platforms, since newer U-Boot versions do support this PPB locking
> and protect for example their environment sector(s) this way.
> 
> This PPB locking/unlocking will be enabled for all devices supported by
> cfi_cmdset_0002 reporting 8 in the CFI word 0x49 (Sector Protect/Unprotect
> scheme).
> 
> Please note that PPB locking does support sector-by-sector locking. But
> the whole chip can only be unlocked together. So unlocking one sector
> will automatically unlock all sectors of this device. Because of this
> chip limitation, the PPB unlocking function saves the current locking
> status of all sectors before unlocking the whole device. After unlocking
> the saved locking status is re-configured. This way only the addressed
> sectors will be unlocked.
> 
> To selectively enable this advanced sector protection mechanism, the
> device-tree property "use-advanced-sector-protection" has been created.
> To enable support for this locking this property needs to be present in the
> flash DT node. E.g.:
> 
> nor_flash at 0,0 {
> 	compatible = "amd,s29gl256n", "cfi-flash";
> 	bank-width = <2>;
> 	use-advanced-sector-protection;
> 	...
> 
> Tested with Spanion S29GL512S10THI and Micron JS28F512M29EWx flash
> devices.
> 
> Signed-off-by: Stefan Roese <sr at denx.de>
> Cc: Holger Brunck <holger.brunck at keymile.com>
> Cc: Artem Bityutskiy <dedekind1 at gmail.com>
> ---
>  .../devicetree/bindings/mtd/mtd-physmap.txt        |   3 +
>  drivers/mtd/chips/cfi_cmdset_0002.c                | 211 +++++++++++++++++++++
>  drivers/mtd/maps/physmap_of.c                      |   1 +
>  include/linux/mtd/map.h                            |   1 +
>  4 files changed, 216 insertions(+)
> 

Tested-by: Holger Brunck <holger.brunck at keymile.com>

with an Spanion S29GL512S10THI.

Regards
Holger


More information about the devicetree-discuss mailing list