Andrew Geissler | 2daf84b | 2023-03-31 09:57:23 -0500 | [diff] [blame^] | 1 | From 560ebe3eb6197322b9d00c8e3cf30fb7e679d8b2 Mon Sep 17 00:00:00 2001 |
| 2 | From: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 3 | Date: Thu, 22 Dec 2022 16:20:46 +0000 |
| 4 | Subject: [PATCH 33/43] nvmxip: provide a u-boot shell test command |
| 5 | |
| 6 | nvmxip command allows probing the NVM XIP devices manually |
| 7 | |
| 8 | The command is provided for test purposes only. |
| 9 | |
| 10 | Use: |
| 11 | |
| 12 | nvmxip probe |
| 13 | |
| 14 | Upstream-Status: Submitted |
| 15 | Signed-off-by: Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 16 | Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> |
| 17 | --- |
| 18 | cmd/Kconfig | 7 +++++ |
| 19 | cmd/Makefile | 1 + |
| 20 | cmd/nvmxip.c | 47 ++++++++++++++++++++++++++++++++++ |
| 21 | configs/corstone1000_defconfig | 1 + |
| 22 | configs/sandbox_defconfig | 1 + |
| 23 | 5 files changed, 57 insertions(+) |
| 24 | create mode 100644 cmd/nvmxip.c |
| 25 | |
| 26 | diff --git a/cmd/Kconfig b/cmd/Kconfig |
| 27 | index 5e278ecb1597..b6a3e5908534 100644 |
| 28 | --- a/cmd/Kconfig |
| 29 | +++ b/cmd/Kconfig |
| 30 | @@ -938,6 +938,13 @@ config CMD_ARMFFA |
| 31 | - Sending a data pattern to the specified partition |
| 32 | - Displaying the arm_ffa device info |
| 33 | |
| 34 | +config CMD_NVMXIP |
| 35 | + bool "NVM XIP probe command" |
| 36 | + depends on NVMXIP |
| 37 | + help |
| 38 | + Probes all NVM XIP devices. The command is for |
| 39 | + test purposes only (not to be upstreamed) |
| 40 | + |
| 41 | config CMD_ARMFLASH |
| 42 | #depends on FLASH_CFI_DRIVER |
| 43 | bool "armflash" |
| 44 | diff --git a/cmd/Makefile b/cmd/Makefile |
| 45 | index c757f1647da6..0a3d98100703 100644 |
| 46 | --- a/cmd/Makefile |
| 47 | +++ b/cmd/Makefile |
| 48 | @@ -154,6 +154,7 @@ obj-$(CONFIG_CMD_RTC) += rtc.o |
| 49 | obj-$(CONFIG_SANDBOX) += host.o |
| 50 | obj-$(CONFIG_CMD_SATA) += sata.o |
| 51 | obj-$(CONFIG_CMD_NVME) += nvme.o |
| 52 | +obj-$(CONFIG_CMD_NVMXIP) += nvmxip.o |
| 53 | obj-$(CONFIG_SANDBOX) += sb.o |
| 54 | obj-$(CONFIG_CMD_SF) += sf.o |
| 55 | obj-$(CONFIG_CMD_SCSI) += scsi.o disk.o |
| 56 | diff --git a/cmd/nvmxip.c b/cmd/nvmxip.c |
| 57 | new file mode 100644 |
| 58 | index 000000000000..3eb0d84afc04 |
| 59 | --- /dev/null |
| 60 | +++ b/cmd/nvmxip.c |
| 61 | @@ -0,0 +1,47 @@ |
| 62 | +// SPDX-License-Identifier: GPL-2.0+ |
| 63 | +/* |
| 64 | + * (C) Copyright 2022 ARM Limited |
| 65 | + * Abdellatif El Khlifi <abdellatif.elkhlifi@arm.com> |
| 66 | + */ |
| 67 | + |
| 68 | +#include <common.h> |
| 69 | +#include <command.h> |
| 70 | +#include <dm.h> |
| 71 | + |
| 72 | +int do_nvmxip_probe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
| 73 | +{ |
| 74 | + struct udevice *dev = NULL; |
| 75 | + for (uclass_first_device(UCLASS_NVMXIP, &dev); dev; uclass_next_device(&dev)); |
| 76 | + |
| 77 | + return 0; |
| 78 | +} |
| 79 | + |
| 80 | +static struct cmd_tbl nvmxip_commands[] = { |
| 81 | + U_BOOT_CMD_MKENT(probe, 1, 1, do_nvmxip_probe, "", ""), |
| 82 | +}; |
| 83 | + |
| 84 | +static int do_nvmxip(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) |
| 85 | +{ |
| 86 | + struct cmd_tbl *nvmxip_cmd; |
| 87 | + int ret; |
| 88 | + |
| 89 | + if (argc < 2) |
| 90 | + return CMD_RET_USAGE; |
| 91 | + |
| 92 | + nvmxip_cmd = find_cmd_tbl(argv[1], nvmxip_commands, ARRAY_SIZE(nvmxip_commands)); |
| 93 | + |
| 94 | + argc -= 2; |
| 95 | + argv += 2; |
| 96 | + |
| 97 | + if (!nvmxip_cmd || argc > nvmxip_cmd->maxargs) |
| 98 | + return CMD_RET_USAGE; |
| 99 | + |
| 100 | + ret = nvmxip_cmd->cmd(nvmxip_cmd, flag, argc, argv); |
| 101 | + |
| 102 | + return cmd_process_error(nvmxip_cmd, ret); |
| 103 | +} |
| 104 | + |
| 105 | +U_BOOT_CMD(nvmxip, 4, 1, do_nvmxip, |
| 106 | + "NVM XIP probe command", |
| 107 | + "probe\n" |
| 108 | + " - probes all NVM XIP devices\n"); |
| 109 | diff --git a/configs/corstone1000_defconfig b/configs/corstone1000_defconfig |
| 110 | index 2986cc95932f..e009faee0252 100644 |
| 111 | --- a/configs/corstone1000_defconfig |
| 112 | +++ b/configs/corstone1000_defconfig |
| 113 | @@ -59,6 +59,7 @@ CONFIG_USB=y |
| 114 | CONFIG_USB_ISP1760=y |
| 115 | CONFIG_ERRNO_STR=y |
| 116 | CONFIG_NVMXIP_QSPI=y |
| 117 | +CONFIG_CMD_NVMXIP=y |
| 118 | CONFIG_EFI_MM_COMM_TEE=y |
| 119 | CONFIG_ARM_FFA_TRANSPORT=y |
| 120 | CONFIG_EFI_RUNTIME_UPDATE_CAPSULE=y |
| 121 | diff --git a/configs/sandbox_defconfig b/configs/sandbox_defconfig |
| 122 | index f22230b5cce2..3b895be9e4ba 100644 |
| 123 | --- a/configs/sandbox_defconfig |
| 124 | +++ b/configs/sandbox_defconfig |
| 125 | @@ -139,6 +139,7 @@ CONFIG_IP_DEFRAG=y |
| 126 | CONFIG_BOOTP_SERVERIP=y |
| 127 | CONFIG_IPV6=y |
| 128 | CONFIG_NVMXIP_QSPI=y |
| 129 | +CONFIG_CMD_NVMXIP=y |
| 130 | CONFIG_DM_DMA=y |
| 131 | CONFIG_DEVRES=y |
| 132 | CONFIG_DEBUG_DEVRES=y |
| 133 | -- |
| 134 | 2.39.2 |
| 135 | |