mtd-utils: Add flash_otp_erase
PATCH 1/1 mtd-utils: Add flash_otp_erase
On some SPI NOR flashes you can actually erase the OTP region until its fully locked. Add a small utility for that.
Signed-off-by Michael Walle <[email protected]>
---
The ioctl was merged in linux commit e3c1f1c92d6e ("mtd: add OTP (one-time-programmable) erase ioctl").
.gitignore | 1 + include/mtd/mtd-abi.h | 2 ++ misc-utils/Makemodule.am | 4 ++- misc-utils/flash_otp_erase.c | 64 ++++++++++++++++++++++++++++++++++++ 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 misc-utils/flash_otp_erase.c
.gitignore +1 -0
@@ -24,6 +24,7 @@ fectest flash_erase flash_lock flash_otp_dump +flash_otp_erase flash_otp_info flash_otp_lock flash_otp_write
include/mtd/mtd-abi.h +2 -0
@@ -201,6 +201,8 @@ struct otp_info {* modes (see "struct mtd_write_req") */ #define MEMWRITE _IOWR('M', 24, struct mtd_write_req) +/* Erase a given range of user data (must be in mode %MTD_FILE_MODE_OTP_USER) */ +#define OTPERASE _IOW('M', 25, struct otp_info)/* * Obsolete legacy interface. Keep it in order not to break userspace
misc-utils/Makemodule.am +3 -1
@@ -32,6 +32,8 @@ flash_otp_dump_SOURCES = misc-utils/flash_otp_dump.c flash_otp_lock_SOURCES = misc-utils/flash_otp_lock.c +flash_otp_erase_SOURCES = misc-utils/flash_otp_erase.c + flash_otp_write_SOURCES = misc-utils/flash_otp_write.c flashcp_SOURCES = misc-utils/flashcp.c
@@ -43,7 +45,7 @@ sbin_PROGRAMS += \ ftl_format doc_loadbios ftl_check mtd_debug docfdisk \ serve_image recv_image fectest flash_erase flash_lock \ flash_unlock flash_otp_info flash_otp_dump flash_otp_lock \ - flash_otp_write flashcp mtdpart + flash_otp_erase flash_otp_write flashcp mtdpart MISC_SH = \ misc-utils/flash_eraseall
misc-utils/flash_otp_erase.c new file +64 -0
64 lines not on this page · raw message
Signature · 6 lines
2.20.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/
David Oberhollenzer
AppliedSorry for the long delay, got a bit swamped on my end and forgot about the patch. But I see there was no opposition to it either in the mean time.
Applied to mtd-utils.git master.
Thanks,
David
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/