]> git.ipfire.org Git - people/ms/u-boot.git/blame - include/timer.h
move erratum a008336 and a008514 to soc specific file
[people/ms/u-boot.git] / include / timer.h
CommitLineData
c8a7ba9e
TC
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
9ca07ebb
BM
10/*
11 * timer_conv_64 - convert 32-bit counter value to 64-bit
12 *
13 * @count: 32-bit counter value
14 * @return: 64-bit counter value
15 */
16u64 timer_conv_64(u32 count);
17
c8a7ba9e
TC
18/*
19 * Get the current timer count
20 *
435ae76e 21 * @dev: The timer device
c8a7ba9e
TC
22 * @count: pointer that returns the current timer count
23 * @return: 0 if OK, -ve on error
24 */
9ca07ebb 25int timer_get_count(struct udevice *dev, u64 *count);
435ae76e 26
c8a7ba9e
TC
27/*
28 * Get the timer input clock frequency
29 *
435ae76e 30 * @dev: The timer device
c8a7ba9e
TC
31 * @return: the timer input clock frequency
32 */
33unsigned long timer_get_rate(struct udevice *dev);
34
35/*
435ae76e 36 * struct timer_ops - Driver model timer operations
c8a7ba9e 37 *
435ae76e 38 * The uclass interface is implemented by all timer devices which use
c8a7ba9e
TC
39 * driver model.
40 */
41struct timer_ops {
42 /*
43 * Get the current timer count
44 *
435ae76e 45 * @dev: The timer device
9ca07ebb 46 * @count: pointer that returns the current 64-bit timer count
c8a7ba9e
TC
47 * @return: 0 if OK, -ve on error
48 */
9ca07ebb 49 int (*get_count)(struct udevice *dev, u64 *count);
c8a7ba9e
TC
50};
51
52/*
53 * struct timer_dev_priv - information about a device used by the uclass
54 *
55 * @clock_rate: the timer input clock frequency
56 */
57struct timer_dev_priv {
58 unsigned long clock_rate;
59};
60
61#endif /* _TIMER_H_ */