summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@foss.st.com>2021-05-21 10:47:32 +0300
committerTom Rini <trini@konsulko.com>2021-07-23 14:13:25 +0300
commitfea0345992fac2a2b2bd20d72b666ce948c9c99b (patch)
tree837a5e1bc9305ceef8460282dadf37cc434721f6 /test
parent4c60fd993a21a285c645c6d46762d8c2992b7dd7 (diff)
downloadu-boot-fea0345992fac2a2b2bd20d72b666ce948c9c99b.tar.xz
cmd: pinmux: support pin name in status command
Allow pin name parameter for pimux staus command, as gpio command to get status of one pin. The possible usage of the command is: > pinmux dev pinctrl > pinmux status > pinmux status -a > pinmux status <pin-name> Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test')
-rw-r--r--test/cmd/Makefile1
-rw-r--r--test/cmd/pinmux.c36
2 files changed, 37 insertions, 0 deletions
diff --git a/test/cmd/Makefile b/test/cmd/Makefile
index 2cfe43a6bd..a59adb1e6d 100644
--- a/test/cmd/Makefile
+++ b/test/cmd/Makefile
@@ -8,5 +8,6 @@ endif
obj-y += mem.o
obj-$(CONFIG_CMD_ADDRMAP) += addrmap.o
obj-$(CONFIG_CMD_MEM_SEARCH) += mem_search.o
+obj-$(CONFIG_CMD_PINMUX) += pinmux.o
obj-$(CONFIG_CMD_PWM) += pwm.o
obj-$(CONFIG_CMD_SETEXPR) += setexpr.o
diff --git a/test/cmd/pinmux.c b/test/cmd/pinmux.c
new file mode 100644
index 0000000000..8ae807b537
--- /dev/null
+++ b/test/cmd/pinmux.c
@@ -0,0 +1,36 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Executes tests for pinmux command
+ *
+ * Copyright (C) 2021, STMicroelectronics - All Rights Reserved
+ */
+
+#include <common.h>
+#include <command.h>
+#include <dm/test.h>
+#include <test/test.h>
+#include <test/ut.h>
+
+static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts)
+{
+ /* Test that 'pinmux status <pinname>' displays the selected pin. */
+ console_record_reset();
+ run_command("pinmux status a5", 0);
+ ut_assert_nextline("a5 : gpio input . ");
+ ut_assert_console_end();
+
+ console_record_reset();
+ run_command("pinmux status P7", 0);
+ ut_assert_nextline("P7 : GPIO2 bias-pull-down input-enable. ");
+ ut_assert_console_end();
+
+ console_record_reset();
+ run_command("pinmux status P9", 0);
+ ut_assert_nextline("single-pinctrl pinctrl-single-no-width: missing register width");
+ ut_assert_nextline("P9 not found");
+ ut_assert_console_end();
+
+ return 0;
+}
+
+DM_TEST(dm_test_cmd_pinmux_status_pinname, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);