Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 1 | // 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 Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 8 | #include <command.h> |
Marek Vasut | a15900c | 2022-04-25 18:33:51 +0200 | [diff] [blame] | 9 | #include <dm.h> |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 10 | #include <dm/test.h> |
| 11 | #include <test/test.h> |
| 12 | #include <test/ut.h> |
| 13 | |
| 14 | static int dm_test_cmd_pinmux_status_pinname(struct unit_test_state *uts) |
| 15 | { |
Marek Vasut | a15900c | 2022-04-25 18:33:51 +0200 | [diff] [blame] | 16 | struct udevice *dev; |
| 17 | |
| 18 | ut_assertok(uclass_get_device(UCLASS_LED, 2, &dev)); |
| 19 | |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 20 | /* Test that 'pinmux status <pinname>' displays the selected pin. */ |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 21 | run_command("pinmux status a5", 0); |
Marek Vasut | 03cadb6 | 2022-04-04 01:23:27 +0200 | [diff] [blame] | 22 | ut_assert_nextlinen("a5 : gpio output ."); |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 23 | ut_assert_console_end(); |
| 24 | |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 25 | run_command("pinmux status P7", 0); |
Michal Simek | 516376f | 2022-03-07 16:48:17 +0100 | [diff] [blame] | 26 | ut_assert_nextlinen("P7 : GPIO2 bias-pull-down input-enable."); |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 27 | ut_assert_console_end(); |
| 28 | |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 29 | run_command("pinmux status P9", 0); |
Simon Glass | fa55f42 | 2024-08-22 07:54:56 -0600 | [diff] [blame] | 30 | if (IS_ENABLED(CONFIG_LOGF_FUNC)) { |
| 31 | ut_assert_nextlinen( |
| 32 | " single_of_to_plat() single-pinctrl pinctrl-single-no-width: missing register width"); |
| 33 | } else { |
| 34 | ut_assert_nextlinen( |
| 35 | "single-pinctrl pinctrl-single-no-width: missing register width"); |
| 36 | } |
Michal Simek | 516376f | 2022-03-07 16:48:17 +0100 | [diff] [blame] | 37 | ut_assert_nextlinen("P9 not found"); |
Patrick Delaunay | b40399c | 2021-05-21 09:47:32 +0200 | [diff] [blame] | 38 | ut_assert_console_end(); |
| 39 | |
| 40 | return 0; |
| 41 | } |
Simon Glass | aeee87e | 2024-08-22 07:57:57 -0600 | [diff] [blame] | 42 | DM_TEST(dm_test_cmd_pinmux_status_pinname, UTF_SCAN_PDATA | UTF_SCAN_FDT | |
| 43 | UTF_CONSOLE); |