// SPDX-License-Identifier: GPL-2.0+
/*
 * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
 */

#include <dm.h>
#include <timer.h>
#include <dm/test.h>
#include <dm/device-internal.h>
#include <test/test.h>
#include <test/ut.h>
#include <asm/cpu.h>

/*
 * Basic test of the timer uclass.
 */
static int dm_test_timer_base(struct unit_test_state *uts)
{
	struct udevice *dev;

	ut_assertok(uclass_get_device_by_name(UCLASS_TIMER, "timer@0", &dev));
	ut_asserteq(1000000, timer_get_rate(dev));

	return 0;
}
DM_TEST(dm_test_timer_base, UTF_SCAN_PDATA | UTF_SCAN_FDT);

/*
 * Test of timebase fallback
 */
static int dm_test_timer_timebase_fallback(struct unit_test_state *uts)
{
	struct udevice *dev;

	cpu_sandbox_set_current("cpu@1");
	ut_assertok(uclass_get_device_by_name(UCLASS_TIMER, "timer@1", &dev));
	ut_asserteq(3000000, timer_get_rate(dev));
	ut_assertok(device_remove(dev, DM_REMOVE_NORMAL));

	cpu_sandbox_set_current("cpu@2");
	ut_assertok(uclass_get_device_by_name(UCLASS_TIMER, "timer@1", &dev));
	ut_asserteq(2000000, timer_get_rate(dev));

	cpu_sandbox_set_current("cpu@1");

	return 0;
}
DM_TEST(dm_test_timer_timebase_fallback,
	UTF_SCAN_PDATA | UTF_SCAN_FDT);
