blob: ed5c6852cf232669879d8f790ab5bfc52a4abf28 [file] [log] [blame]
Thomas Chouc8a7ba92015-10-09 13:46:34 +08001/*
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 *
Bin Meng435ae762015-11-13 00:11:14 -080013 * @dev: The timer device
Thomas Chouc8a7ba92015-10-09 13:46:34 +080014 * @count: pointer that returns the current timer count
15 * @return: 0 if OK, -ve on error
16 */
17int timer_get_count(struct udevice *dev, unsigned long *count);
Bin Meng435ae762015-11-13 00:11:14 -080018
Thomas Chouc8a7ba92015-10-09 13:46:34 +080019/*
20 * Get the timer input clock frequency
21 *
Bin Meng435ae762015-11-13 00:11:14 -080022 * @dev: The timer device
Thomas Chouc8a7ba92015-10-09 13:46:34 +080023 * @return: the timer input clock frequency
24 */
25unsigned long timer_get_rate(struct udevice *dev);
26
27/*
Bin Meng435ae762015-11-13 00:11:14 -080028 * struct timer_ops - Driver model timer operations
Thomas Chouc8a7ba92015-10-09 13:46:34 +080029 *
Bin Meng435ae762015-11-13 00:11:14 -080030 * The uclass interface is implemented by all timer devices which use
Thomas Chouc8a7ba92015-10-09 13:46:34 +080031 * driver model.
32 */
33struct timer_ops {
34 /*
35 * Get the current timer count
36 *
Bin Meng435ae762015-11-13 00:11:14 -080037 * @dev: The timer device
Thomas Chouc8a7ba92015-10-09 13:46:34 +080038 * @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 */
49struct timer_dev_priv {
50 unsigned long clock_rate;
51};
52
53#endif /* _TIMER_H_ */