mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-30 06:53:09 +00:00
e180c2b129
The test flags used by driver model are currently not available to other tests. Rather than creating two sets of flags, make these flags generic by changing the DM_ prefix to UT_ and moving them to the test.h header. This will allow adding other test flags without confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
45 lines
1.4 KiB
C
45 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
/*
|
|
* Copyright (C) 2020 Sean Anderson <seanga2@gmail.com>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <dm.h>
|
|
#include <dm/test.h>
|
|
#include <dm/device-internal.h>
|
|
#include <test/ut.h>
|
|
#include <asm/clk.h>
|
|
#include <asm/power-domain.h>
|
|
|
|
/* These must match the ids in the device tree */
|
|
#define TEST_CLOCK_ID 4
|
|
#define TEST_POWER_ID 1
|
|
|
|
static int dm_test_simple_pm_bus(struct unit_test_state *uts)
|
|
{
|
|
struct udevice *power;
|
|
struct udevice *clock;
|
|
struct udevice *bus;
|
|
|
|
ut_assertok(uclass_get_device_by_name(UCLASS_POWER_DOMAIN,
|
|
"power-domain", &power));
|
|
ut_assertok(uclass_get_device_by_name(UCLASS_CLK, "clk-sbox",
|
|
&clock));
|
|
ut_asserteq(0, sandbox_power_domain_query(power, TEST_POWER_ID));
|
|
ut_asserteq(0, sandbox_clk_query_enable(clock, TEST_CLOCK_ID));
|
|
|
|
ut_assertok(uclass_get_device_by_name(UCLASS_SIMPLE_BUS, "pm-bus-test",
|
|
&bus));
|
|
ut_asserteq(1, sandbox_power_domain_query(power, TEST_POWER_ID));
|
|
ut_asserteq(1, sandbox_clk_query_enable(clock, TEST_CLOCK_ID));
|
|
|
|
ut_assertok(device_remove(bus, DM_REMOVE_NORMAL));
|
|
/* must re-probe since device_remove also removes the power domain */
|
|
ut_assertok(uclass_get_device_by_name(UCLASS_POWER_DOMAIN,
|
|
"power-domain", &power));
|
|
ut_asserteq(0, sandbox_power_domain_query(power, TEST_POWER_ID));
|
|
ut_asserteq(0, sandbox_clk_query_enable(clock, TEST_CLOCK_ID));
|
|
|
|
return 0;
|
|
}
|
|
DM_TEST(dm_test_simple_pm_bus, UT_TESTF_SCAN_FDT);
|