Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 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 | * |
Bin Meng | 435ae76 | 2015-11-13 00:11:14 -0800 | [diff] [blame^] | 13 | * @dev: The timer device |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 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); |
Bin Meng | 435ae76 | 2015-11-13 00:11:14 -0800 | [diff] [blame^] | 18 | |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 19 | /* |
| 20 | * Get the timer input clock frequency |
| 21 | * |
Bin Meng | 435ae76 | 2015-11-13 00:11:14 -0800 | [diff] [blame^] | 22 | * @dev: The timer device |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 23 | * @return: the timer input clock frequency |
| 24 | */ |
| 25 | unsigned long timer_get_rate(struct udevice *dev); |
| 26 | |
| 27 | /* |
Bin Meng | 435ae76 | 2015-11-13 00:11:14 -0800 | [diff] [blame^] | 28 | * struct timer_ops - Driver model timer operations |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 29 | * |
Bin Meng | 435ae76 | 2015-11-13 00:11:14 -0800 | [diff] [blame^] | 30 | * The uclass interface is implemented by all timer devices which use |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 31 | * driver model. |
| 32 | */ |
| 33 | struct timer_ops { |
| 34 | /* |
| 35 | * Get the current timer count |
| 36 | * |
Bin Meng | 435ae76 | 2015-11-13 00:11:14 -0800 | [diff] [blame^] | 37 | * @dev: The timer device |
Thomas Chou | c8a7ba9 | 2015-10-09 13:46:34 +0800 | [diff] [blame] | 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_ */ |