blob: 7ab7004b6843b57e9612bd7ed0f516a6c213ff12 [file] [log] [blame]
Patrick Delaunayb40399c2021-05-21 09:47:32 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Executes tests for pinmux command
4 *
5 * Copyright (C) 2021, STMicroelectronics - All Rights Reserved
6 */
7
Patrick Delaunayb40399c2021-05-21 09:47:32 +02008#include <command.h>
Marek Vasuta15900c2022-04-25 18:33:51 +02009#include <dm.h>
Patrick Delaunayb40399c2021-05-21 09:47:32 +020010#include <dm/test.h>
11#include <test/test.h>
12#include <test/ut.h>
13
14static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts)
15{
Marek Vasuta15900c2022-04-25 18:33:51 +020016 struct udevice *dev;
17
18 ut_assertok(uclass_get_device(UCLASS_LED, 2, &dev));
19
Patrick Delaunayb40399c2021-05-21 09:47:32 +020020 /* Test that 'pinmux status <pinname>' displays the selected pin. */
21 console_record_reset();
22 run_command("pinmux status a5", 0);
Marek Vasut03cadb62022-04-04 01:23:27 +020023 ut_assert_nextlinen("a5 : gpio output .");
Patrick Delaunayb40399c2021-05-21 09:47:32 +020024 ut_assert_console_end();
25
26 console_record_reset();
27 run_command("pinmux status P7", 0);
Michal Simek516376f2022-03-07 16:48:17 +010028 ut_assert_nextlinen("P7 : GPIO2 bias-pull-down input-enable.");
Patrick Delaunayb40399c2021-05-21 09:47:32 +020029 ut_assert_console_end();
30
31 console_record_reset();
32 run_command("pinmux status P9", 0);
Simon Glassfa55f422024-08-22 07:54:56 -060033 if (IS_ENABLED(CONFIG_LOGF_FUNC)) {
34 ut_assert_nextlinen(
35 " single_of_to_plat() single-pinctrl pinctrl-single-no-width: missing register width");
36 } else {
37 ut_assert_nextlinen(
38 "single-pinctrl pinctrl-single-no-width: missing register width");
39 }
Michal Simek516376f2022-03-07 16:48:17 +010040 ut_assert_nextlinen("P9 not found");
Patrick Delaunayb40399c2021-05-21 09:47:32 +020041 ut_assert_console_end();
42
43 return 0;
44}
45
46DM_TEST(dm_test_cmd_pinmux_status_pinname, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);