summaryrefslogtreecommitdiff
path: root/cmd/sf.c
diff options
context:
space:
mode:
authorVenkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com>2023-10-03 08:47:13 +0530
committerMichal Simek <michal.simek@amd.com>2023-11-07 13:47:08 +0100
commit188c803d08c6f1744484de6663f7c5d31ef71cfe (patch)
tree1b95607befc6119490368bc4a4fdc152489f5325 /cmd/sf.c
parentbd9ff681bdd1893d11ab8d4ea79a9f74d0fffdb7 (diff)
downloadu-boot-188c803d08c6f1744484de6663f7c5d31ef71cfe.tar.gz
u-boot-188c803d08c6f1744484de6663f7c5d31ef71cfe.tar.bz2
u-boot-188c803d08c6f1744484de6663f7c5d31ef71cfe.zip
mtd: spi-nor: Add spi flash lock config option
Provide an explicit configuration option to disable default "lock" of any flash chip which supports locking. By disabling the lock config will save some amount of memory and also don't expose the lock functionality to the users i.e., via sf protect command. Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu@amd.com> Link: https://lore.kernel.org/r/20231003031715.5343-2-venkatesh.abbarapu@amd.com Signed-off-by: Michal Simek <michal.simek@amd.com>
Diffstat (limited to 'cmd/sf.c')
-rw-r--r--cmd/sf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd/sf.c b/cmd/sf.c
index 30b2bd5ef6..730996c02b 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -604,7 +604,7 @@ static int do_spi_flash(struct cmd_tbl *cmdtp, int flag, int argc,
ret = do_spi_flash_read_write(argc, argv);
else if (strcmp(cmd, "erase") == 0)
ret = do_spi_flash_erase(argc, argv);
- else if (strcmp(cmd, "protect") == 0)
+ else if (IS_ENABLED(CONFIG_SPI_FLASH_LOCK) && strcmp(cmd, "protect") == 0)
ret = do_spi_protect(argc, argv);
else if (IS_ENABLED(CONFIG_CMD_SF_TEST) && !strcmp(cmd, "test"))
ret = do_spi_flash_test(argc, argv);
@@ -629,8 +629,10 @@ U_BOOT_LONGHELP(sf,
"sf update addr offset|partition len - erase and write `len' bytes from memory\n"
" at `addr' to flash at `offset'\n"
" or to start of mtd `partition'\n"
+#ifdef CONFIG_SPI_FLASH_LOCK
"sf protect lock/unlock sector len - protect/unprotect 'len' bytes starting\n"
" at address 'sector'"
+#endif
#ifdef CONFIG_CMD_SF_TEST
"\nsf test offset len - run a very basic destructive test"
#endif