xref: /rk3399_rockchip-uboot/test/dm/timer.c (revision 9961a0b6fbe199cd7b08203415a905c4c7d0a731)
1*9961a0b6SThomas Chou /*
2*9961a0b6SThomas Chou  * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
3*9961a0b6SThomas Chou  *
4*9961a0b6SThomas Chou  * SPDX-License-Identifier:	GPL-2.0+
5*9961a0b6SThomas Chou  */
6*9961a0b6SThomas Chou 
7*9961a0b6SThomas Chou #include <common.h>
8*9961a0b6SThomas Chou #include <dm.h>
9*9961a0b6SThomas Chou #include <timer.h>
10*9961a0b6SThomas Chou #include <dm/test.h>
11*9961a0b6SThomas Chou #include <test/ut.h>
12*9961a0b6SThomas Chou 
13*9961a0b6SThomas Chou DECLARE_GLOBAL_DATA_PTR;
14*9961a0b6SThomas Chou 
15*9961a0b6SThomas Chou /*
16*9961a0b6SThomas Chou  * Basic test of the timer uclass.
17*9961a0b6SThomas Chou  */
dm_test_timer_base(struct unit_test_state * uts)18*9961a0b6SThomas Chou static int dm_test_timer_base(struct unit_test_state *uts)
19*9961a0b6SThomas Chou {
20*9961a0b6SThomas Chou 	struct udevice *dev;
21*9961a0b6SThomas Chou 
22*9961a0b6SThomas Chou 	ut_assertok(uclass_get_device(UCLASS_TIMER, 0, &dev));
23*9961a0b6SThomas Chou 	ut_asserteq(1000000, timer_get_rate(dev));
24*9961a0b6SThomas Chou 
25*9961a0b6SThomas Chou 	return 0;
26*9961a0b6SThomas Chou }
27*9961a0b6SThomas Chou DM_TEST(dm_test_timer_base, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
28