summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-07-18 07:13:26 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2021-07-18 07:13:26 +0200
commitca922d6044e49b1ed9782aa8eb28d1ed70931978 (patch)
tree6cac7b356b9fc9f4c152eafca0e38d14c311577b /commands
parent889612fab092ec20463c886513b5cfde14cc8cb0 (diff)
parent5bf59d3f2baa0f98ab93ddb4ea8a3b37986db608 (diff)
downloadbarebox-ca922d6044e49b1ed9782aa8eb28d1ed70931978.tar.gz
barebox-ca922d6044e49b1ed9782aa8eb28d1ed70931978.tar.xz
Merge branch 'for-next/nvmem'
Diffstat (limited to 'commands')
-rw-r--r--commands/Kconfig7
-rw-r--r--commands/Makefile1
-rw-r--r--commands/nvmem.c24
3 files changed, 32 insertions, 0 deletions
diff --git a/commands/Kconfig b/commands/Kconfig
index 5ae3cb3dd1..7bb36d6e41 100644
--- a/commands/Kconfig
+++ b/commands/Kconfig
@@ -206,6 +206,13 @@ config CMD_REGULATOR
the regulator command lists the currently registered regulators and
their current state.
+config CMD_NVMEM
+ bool
+ depends on NVMEM
+ prompt "nvmem command"
+ help
+ the nvmem command lists the currently registered nvmem devices.
+
config CMD_LSPCI
bool
depends on PCI
diff --git a/commands/Makefile b/commands/Makefile
index 4b45d266fd..ba5ea19eb2 100644
--- a/commands/Makefile
+++ b/commands/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_CMD_SAVEENV) += saveenv.o
obj-$(CONFIG_CMD_LOADENV) += loadenv.o
obj-$(CONFIG_CMD_NAND) += nand.o
obj-$(CONFIG_CMD_NANDTEST) += nandtest.o
+obj-$(CONFIG_CMD_NVMEM) += nvmem.o
obj-$(CONFIG_CMD_MEMTEST) += memtest.o
obj-$(CONFIG_CMD_MEMTESTER) += memtester/
obj-$(CONFIG_CMD_TRUE) += true.o
diff --git a/commands/nvmem.c b/commands/nvmem.c
new file mode 100644
index 0000000000..a0e3d092e3
--- /dev/null
+++ b/commands/nvmem.c
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+// SPDX-FileCopyrightText: © 2021 Ahmad Fatoum, Pengutronix
+
+#include <common.h>
+#include <command.h>
+#include <linux/nvmem-consumer.h>
+
+static int do_nvmem(int argc, char *argv[])
+{
+ nvmem_devices_print();
+
+ return 0;
+}
+
+BAREBOX_CMD_HELP_START(nvmem)
+BAREBOX_CMD_HELP_TEXT("Usage: nvmem")
+BAREBOX_CMD_HELP_END
+
+BAREBOX_CMD_START(nvmem)
+ .cmd = do_nvmem,
+ BAREBOX_CMD_DESC("list nvmem devices")
+ BAREBOX_CMD_GROUP(CMD_GRP_HWMANIP)
+ BAREBOX_CMD_HELP(cmd_nvmem_help)
+BAREBOX_CMD_END