2021-05-21 07:47:32 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
/*
|
|
|
|
* Executes tests for pinmux command
|
|
|
|
*
|
|
|
|
* Copyright (C) 2021, STMicroelectronics - All Rights Reserved
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2022-04-25 16:33:51 +00:00
|
|
|
#include <dm.h>
|
2021-05-21 07:47:32 +00:00
|
|
|
#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)
|
|
|
|
{
|
2022-04-25 16:33:51 +00:00
|
|
|
struct udevice *dev;
|
|
|
|
|
|
|
|
ut_assertok(uclass_get_device(UCLASS_LED, 2, &dev));
|
|
|
|
|
2021-05-21 07:47:32 +00:00
|
|
|
/* Test that 'pinmux status <pinname>' displays the selected pin. */
|
|
|
|
console_record_reset();
|
|
|
|
run_command("pinmux status a5", 0);
|
2022-04-03 23:23:27 +00:00
|
|
|
ut_assert_nextlinen("a5 : gpio output .");
|
2021-05-21 07:47:32 +00:00
|
|
|
ut_assert_console_end();
|
|
|
|
|
|
|
|
console_record_reset();
|
|
|
|
run_command("pinmux status P7", 0);
|
2022-03-07 15:48:17 +00:00
|
|
|
ut_assert_nextlinen("P7 : GPIO2 bias-pull-down input-enable.");
|
2021-05-21 07:47:32 +00:00
|
|
|
ut_assert_console_end();
|
|
|
|
|
|
|
|
console_record_reset();
|
|
|
|
run_command("pinmux status P9", 0);
|
2022-03-07 15:48:17 +00:00
|
|
|
ut_assert_nextlinen("single-pinctrl pinctrl-single-no-width: missing register width");
|
|
|
|
ut_assert_nextlinen("P9 not found");
|
2021-05-21 07:47:32 +00:00
|
|
|
ut_assert_console_end();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
DM_TEST(dm_test_cmd_pinmux_status_pinname, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT);
|