mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) locking
Subsystems (2)
PATCH v3 1/1 mtd: cfi_cmdset_0002: Support Persistent Protection Bits (PPB) locking
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@0,0 {
compatible = "amd,s29gl256n", "cfi-flash";
bank-width = <2>;
use-advanced-sector-protection;
...Tested with Spanion S29GL512S10THI and Micron JS28F512M29EWx flash devices.
---
v3:
- Added #ifdef CONFIG_OF to of_property_read_bool() probing code
- Rebased upon l2-mtd master branch
v2:
- Use msecs_to_jiffies
- Use UDELAY macro
.../devicetree/bindings/mtd/mtd-physmap.txt | 3 + drivers/mtd/chips/cfi_cmdset_0002.c | 212 +++++++++++++++++++++ drivers/mtd/maps/physmap_of.c | 1 + include/linux/mtd/map.h | 1 + 4 files changed, 217 insertions(+)
Documentation/devicetree/bindings/mtd/mtd-physmap.txt +3 -0
@@ -26,6 +26,9 @@ file systems on embedded devices. - linux,mtd-name: allow to specify the mtd name for retro capability with physmap-flash drivers as boot loader pass the mtd partition via the old device name physmap-flash. + - use-advanced-sector-protection: boolean to enable support for the + advanced sector protection (Spansion: PPB - Persistent Protection + Bits) locking. For JEDEC compatible devices, the following additional properties are defined:
drivers/mtd/chips/cfi_cmdset_0002.c +212 -0
242 lines not on this page · raw message
drivers/mtd/maps/physmap_of.c +1 -0
@@ -241,6 +241,7 @@ static int of_flash_probe(struct platform_device *dev) info->list[i].map.phys = res.start; info->list[i].map.size = res_size; info->list[i].map.bankwidth =be32_to_cpup (width); + info->list[i].map.device_node = dp; err = -ENOMEM ; info->list[i].map.virt = ioremap(info->list[i].map.phys,
include/linux/mtd/map.h +1 -0
@@ -245,6 +245,7 @@ struct map_info {unsigned long pfow_base;unsigned long map_priv_1;unsigned long map_priv_2; +struct device_node *device_node;void *fldrv_priv;struct mtd_chip_driver *fldrv; };
Signature · 6 lines
1.8.1.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
On 1/18/2013 5:40 PM, Stefan Roese wrote:
<snip>
Quoted 8 lines
nor_flash@0,0 { compatible = "amd,s29gl256n", "cfi-flash"; bank-width = <2>; use-advanced-sector-protection; ...Tested with Spanion S29GL512S10THI and Micron JS28F512M29EWx flash devices.
Minor nitpick.
Isn't it Spansion?
~Vikram
Quoted 8 lines · Vikram Narayanan
On 1/18/2013 5:40 PM, Stefan Roese wrote:
<snip>Quoted 6 lines
nor_flash@0,0 { compatible = "amd,s29gl256n", "cfi-flash"; bank-width = <2>; use-advanced-sector-protection; ...
Quoted 5 lines
Quoted 2 lines
Tested with Spanion S29GL512S10THI and Micron JS28F512M29EWx flash devices.
Minor nitpick.
Isn't it Spansion?
Yes, of course. Artem, should I send a new patch version for this spelling error?
Thanks,
Stefan
Quoted 8 lines · Stefan Roese
Quoted 5 lines
Quoted 2 lines
Tested with Spanion S29GL512S10THI and Micron JS28F512M29EWx flash devices.
Minor nitpick.
Isn't it Spansion?Yes, of course. Artem, should I send a new patch version for this spelling error?
Fixed the typo and pushed to l2-mtd.git, thanks!
Signature · 2 lines
Best Regards, Artem Bityutskiy