xref: /rk3399_rockchip-uboot/include/timer.h (revision 435ae76edd3a90fc4dd2f582052d7362cb8bdad7)
1 /*
2  * Copyright (C) 2015 Thomas Chou <thomas@wytron.com.tw>
3  *
4  * SPDX-License-Identifier:	GPL-2.0+
5  */
6 
7 #ifndef _TIMER_H_
8 #define _TIMER_H_
9 
10 /*
11  * Get the current timer count
12  *
13  * @dev: The timer device
14  * @count: pointer that returns the current timer count
15  * @return: 0 if OK, -ve on error
16  */
17 int timer_get_count(struct udevice *dev, unsigned long *count);
18 
19 /*
20  * Get the timer input clock frequency
21  *
22  * @dev: The timer device
23  * @return: the timer input clock frequency
24  */
25 unsigned long timer_get_rate(struct udevice *dev);
26 
27 /*
28  * struct timer_ops - Driver model timer operations
29  *
30  * The uclass interface is implemented by all timer devices which use
31  * driver model.
32  */
33 struct timer_ops {
34 	/*
35 	 * Get the current timer count
36 	 *
37 	 * @dev: The timer device
38 	 * @count: pointer that returns the current timer count
39 	 * @return: 0 if OK, -ve on error
40 	 */
41 	int (*get_count)(struct udevice *dev, unsigned long *count);
42 };
43 
44 /*
45  * struct timer_dev_priv - information about a device used by the uclass
46  *
47  * @clock_rate: the timer input clock frequency
48  */
49 struct timer_dev_priv {
50 	unsigned long clock_rate;
51 };
52 
53 #endif	/* _TIMER_H_ */
54