summaryrefslogtreecommitdiff
path: root/meta-arm/meta-arm-bsp/recipes-bsp/u-boot/u-boot/corstone1000/0033-nvmxip-provide-a-u-boot-shell-test-command.patch
blob: e8adbc121ad9db09bb84f8db8d13d9ec8974ff5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
From 560ebe3eb6197322b9d00c8e3cf30fb7e679d8b2 Mon Sep 17 00:00:00 2001
From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Date: Thu, 22 Dec 2022 16:20:46 +0000
Subject: [PATCH 33/43] nvmxip: provide a u-boot shell test command

nvmxip command allows probing the NVM XIP devices manually

The command is provided for test purposes only.

Use:

nvmxip probe

Upstream-Status: Submitted
Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
---
 cmd/Kconfig                    |  7 +++++
 cmd/Makefile                   |  1 +
 cmd/nvmxip.c                   | 47 ++++++++++++++++++++++++++++++++++
 configs/corstone1000_defconfig |  1 +
 configs/sandbox_defconfig      |  1 +
 5 files changed, 57 insertions(+)
 create mode 100644 cmd/nvmxip.c

diff --git a/cmd/Kconfig b/cmd/Kconfig
index 5e278ecb1597..b6a3e5908534 100644
--- a/cmd/Kconfig
+++ b/cmd/Kconfig
@@ -938,6 +938,13 @@ config CMD_ARMFFA
 		- Sending a data pattern to the specified partition
 		- Displaying the arm_ffa device info
 
+config CMD_NVMXIP
+	bool "NVM XIP probe command"
+	depends on NVMXIP
+	help
+	  Probes all NVM XIP devices. The command is for
+	  test purposes only (not to be upstreamed)
+
 config CMD_ARMFLASH
 	#depends on FLASH_CFI_DRIVER
 	bool "armflash"
diff --git a/cmd/Makefile b/cmd/Makefile
index c757f1647da6..0a3d98100703 100644
--- a/cmd/Makefile
+++ b/cmd/Makefile
@@ -154,6 +154,7 @@ obj-$(CONFIG_CMD_RTC) += rtc.o
 obj-$(CONFIG_SANDBOX) += host.o
 obj-$(CONFIG_CMD_SATA) += sata.o
 obj-$(CONFIG_CMD_NVME) += nvme.o
+obj-$(CONFIG_CMD_NVMXIP) += nvmxip.o
 obj-$(CONFIG_SANDBOX) += sb.o
 obj-$(CONFIG_CMD_SF) += sf.o
 obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o
diff --git a/cmd/nvmxip.c b/cmd/nvmxip.c
new file mode 100644
index 000000000000..3eb0d84afc04
--- /dev/null
+++ b/cmd/nvmxip.c
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * (C) Copyright 2022 ARM Limited
+ * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com>
+ */
+
+#include <common.h>
+#include <command.h>
+#include <dm.h>
+
+int do_nvmxip_probe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+	struct udevice *dev = NULL;
+	for (uclass_first_device(UCLASS_NVMXIP, &dev); dev; uclass_next_device(&dev));
+
+	return 0;
+}
+
+static struct cmd_tbl nvmxip_commands[] = {
+	U_BOOT_CMD_MKENT(probe, 1, 1, do_nvmxip_probe, "", ""),
+};
+
+static int do_nvmxip(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
+{
+	struct cmd_tbl *nvmxip_cmd;
+	int ret;
+
+	if (argc < 2)
+		return CMD_RET_USAGE;
+
+	nvmxip_cmd = find_cmd_tbl(argv[1], nvmxip_commands, ARRAY_SIZE(nvmxip_commands));
+
+	argc -= 2;
+	argv += 2;
+
+	if (!nvmxip_cmd || argc > nvmxip_cmd->maxargs)
+		return CMD_RET_USAGE;
+
+	ret = nvmxip_cmd->cmd(nvmxip_cmd, flag, argc, argv);
+
+	return cmd_process_error(nvmxip_cmd, ret);
+}
+
+U_BOOT_CMD(nvmxip, 4, 1, do_nvmxip,
+	   "NVM XIP probe command",
+	   "probe\n"
+	"	 - probes all NVM XIP devices\n");
diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig
index 2986cc95932f..e009faee0252 100644
--- a/configs/corstone1000_defconfig
+++ b/configs/corstone1000_defconfig
@@ -59,6 +59,7 @@ CONFIG_USB=y
 CONFIG_USB_ISP1760=y
 CONFIG_ERRNO_STR=y
 CONFIG_NVMXIP_QSPI=y
+CONFIG_CMD_NVMXIP=y
 CONFIG_EFI_MM_COMM_TEE=y
 CONFIG_ARM_FFA_TRANSPORT=y
 CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y
diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig
index f22230b5cce2..3b895be9e4ba 100644
--- a/configs/sandbox_defconfig
+++ b/configs/sandbox_defconfig
@@ -139,6 +139,7 @@ CONFIG_IP_DEFRAG=y
 CONFIG_BOOTP_SERVERIP=y
 CONFIG_IPV6=y
 CONFIG_NVMXIP_QSPI=y
+CONFIG_CMD_NVMXIP=y
 CONFIG_DM_DMA=y
 CONFIG_DEVRES=y
 CONFIG_DEBUG_DEVRES=y
-- 
2.39.2