2022-08-07 10:06:56 +00:00
|
|
|
From e60939acbebd07161f3978d1c6f13123fdd2ebf2 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Weijie Gao <weijie.gao@mediatek.com>
|
|
|
|
Date: Mon, 25 Jul 2022 11:27:02 +0800
|
|
|
|
Subject: [PATCH 50/71] cmd: sf: add support to read flash unique ID
|
|
|
|
|
|
|
|
This patch adds support to display unique ID from spi-nor flashes
|
|
|
|
|
|
|
|
Signed-off-by: Weijie Gao <weijie.gao@mediatek.com>
|
|
|
|
---
|
|
|
|
cmd/sf.c | 13 ++++++++++++-
|
|
|
|
1 file changed, 12 insertions(+), 1 deletion(-)
|
|
|
|
|
|
|
|
--- a/cmd/sf.c
|
|
|
|
+++ b/cmd/sf.c
|
2024-07-05 05:52:06 +00:00
|
|
|
@@ -413,6 +413,14 @@ static int do_spi_protect(int argc, char
|
2022-08-07 10:06:56 +00:00
|
|
|
return ret == 0 ? 0 : 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
+static int do_spi_flash_read_uuid(void)
|
|
|
|
+{
|
|
|
|
+ int ret = 0;
|
|
|
|
+ ret = flash->read_uuid(flash);
|
|
|
|
+
|
|
|
|
+ return ret == 0 ? 0 : 1;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
enum {
|
|
|
|
STAGE_ERASE,
|
|
|
|
STAGE_CHECK,
|
2024-07-05 05:52:06 +00:00
|
|
|
@@ -607,6 +615,8 @@ static int do_spi_flash(struct cmd_tbl *
|
2022-08-07 10:06:56 +00:00
|
|
|
ret = do_spi_flash_erase(argc, argv);
|
2023-12-13 05:37:20 +00:00
|
|
|
else if (IS_ENABLED(CONFIG_SPI_FLASH_LOCK) && strcmp(cmd, "protect") == 0)
|
2022-08-07 10:06:56 +00:00
|
|
|
ret = do_spi_protect(argc, argv);
|
|
|
|
+ else if (strcmp(cmd, "uuid") == 0)
|
|
|
|
+ ret = do_spi_flash_read_uuid();
|
|
|
|
else if (IS_ENABLED(CONFIG_CMD_SF_TEST) && !strcmp(cmd, "test"))
|
|
|
|
ret = do_spi_flash_test(argc, argv);
|
|
|
|
else
|
2024-07-05 05:52:06 +00:00
|
|
|
@@ -637,6 +647,7 @@ U_BOOT_LONGHELP(sf,
|
2022-08-07 10:06:56 +00:00
|
|
|
#ifdef CONFIG_CMD_SF_TEST
|
|
|
|
"\nsf test offset len - run a very basic destructive test"
|
|
|
|
#endif
|
2023-12-13 05:37:20 +00:00
|
|
|
+ "sf uuid - read uuid from flash"
|
|
|
|
);
|
|
|
|
|
|
|
|
U_BOOT_CMD(
|