Thomas Chou | fb798b1 | 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 | * |
| 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 | * Get the timer input clock frequency |
| 20 | * |
| 21 | * @dev: The Timer device |
| 22 | * @return: the timer input clock frequency |
| 23 | */ |
| 24 | unsigned long timer_get_rate(struct udevice *dev); |
| 25 | |
| 26 | /* |
| 27 | * struct timer_ops - Driver model Timer operations |
| 28 | * |
| 29 | * The uclass interface is implemented by all Timer devices which use |
| 30 | * driver model. |
| 31 | */ |
| 32 | struct timer_ops { |
| 33 | /* |
| 34 | * Get the current timer count |
| 35 | * |
| 36 | * @dev: The Timer device |
| 37 | * @count: pointer that returns the current timer count |
| 38 | * @return: 0 if OK, -ve on error |
| 39 | */ |
| 40 | int (*get_count)(struct udevice *dev, unsigned long *count); |
| 41 | }; |
| 42 | |
| 43 | /* |
| 44 | * struct timer_dev_priv - information about a device used by the uclass |
| 45 | * |
| 46 | * @clock_rate: the timer input clock frequency |
| 47 | */ |
| 48 | struct timer_dev_priv { |
| 49 | unsigned long clock_rate; |
| 50 | }; |
| 51 | |
| 52 | #endif /* _TIMER_H_ */ |