mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
mtd: spi-nor: Add steps for testing locking with CMP
Extend the test coverage by giving guidelines to verify the CMP bit acts according to our expectations. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Signed-off-by: Pratyush Yadav <pratyush@kernel.org>
This commit is contained in:
committed by
Pratyush Yadav
parent
e3fb31d884
commit
f5d81415a7
@@ -336,3 +336,40 @@ section, after the ``---`` marker.
|
||||
------------------+----------+---------
|
||||
00000000-0000ffff | locked | 1
|
||||
00010000-03ffffff | unlocked | 1023
|
||||
|
||||
If the flash features a Complement (CMP) bit, we can protect with
|
||||
more granularity above half of the capacity. Let's lock all but one
|
||||
block, then unlock one more block::
|
||||
|
||||
root@1:~# all_but_one=$((($size / $bs) - ($ss / $bs)))
|
||||
|
||||
root@1:~# flash_lock -u /dev/mtd0
|
||||
root@1:~# flash_lock -l /dev/mtd0 $ss $all_but_one # all but the first
|
||||
root@1:~# show_sectors
|
||||
software locked sectors
|
||||
region (in hex) | status | #sectors
|
||||
------------------+----------+---------
|
||||
00000000-0000ffff | unlocked | 1
|
||||
00010000-03ffffff | locked | 1023
|
||||
root@1:~# flash_lock -u /dev/mtd0 $ss $(($ss / $bs)) # all but the two first
|
||||
root@1:~# show_sectors
|
||||
software locked sectors
|
||||
region (in hex) | status | #sectors
|
||||
------------------+----------+---------
|
||||
00000000-0001ffff | unlocked | 2
|
||||
00020000-03ffffff | locked | 1022
|
||||
root@1:~# flash_lock -u /dev/mtd0
|
||||
root@1:~# flash_lock -l /dev/mtd0 0 $all_but_one # same from the other side
|
||||
root@1:~# show_sectors
|
||||
software locked sectors
|
||||
region (in hex) | status | #sectors
|
||||
------------------+----------+---------
|
||||
00000000-03feffff | locked | 1023
|
||||
03ff0000-03ffffff | unlocked | 1
|
||||
root@1:~# flash_lock -u /dev/mtd0 $(($size - (2 * $ss))) $(($ss / $bs)) # all but two
|
||||
root@1:~# show_sectors
|
||||
software locked sectors
|
||||
region (in hex) | status | #sectors
|
||||
------------------+----------+---------
|
||||
00000000-03fdffff | locked | 1022
|
||||
03fe0000-03ffffff | unlocked | 2
|
||||
|
||||
Reference in New Issue
Block a user