xref: /OK3568_Linux_fs/kernel/include/clocksource/timer-davinci.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * TI DaVinci clocksource driver
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2019 Texas Instruments
6*4882a593Smuzhiyun  * Author: Bartosz Golaszewski <bgolaszewski@baylibre.com>
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun #ifndef __TIMER_DAVINCI_H__
10*4882a593Smuzhiyun #define __TIMER_DAVINCI_H__
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <linux/clk.h>
13*4882a593Smuzhiyun #include <linux/ioport.h>
14*4882a593Smuzhiyun 
15*4882a593Smuzhiyun enum {
16*4882a593Smuzhiyun 	DAVINCI_TIMER_CLOCKEVENT_IRQ,
17*4882a593Smuzhiyun 	DAVINCI_TIMER_CLOCKSOURCE_IRQ,
18*4882a593Smuzhiyun 	DAVINCI_TIMER_NUM_IRQS,
19*4882a593Smuzhiyun };
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun /**
22*4882a593Smuzhiyun  * struct davinci_timer_cfg - davinci clocksource driver configuration struct
23*4882a593Smuzhiyun  * @reg:        register range resource
24*4882a593Smuzhiyun  * @irq:        clockevent and clocksource interrupt resources
25*4882a593Smuzhiyun  * @cmp_off:    if set - it specifies the compare register used for clockevent
26*4882a593Smuzhiyun  *
27*4882a593Smuzhiyun  * Note: if the compare register is specified, the driver will use the bottom
28*4882a593Smuzhiyun  * clock half for both clocksource and clockevent and the compare register
29*4882a593Smuzhiyun  * to generate event irqs. The user must supply the correct compare register
30*4882a593Smuzhiyun  * interrupt number.
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  * This is only used by da830 the DSP of which uses the top half. The timer
33*4882a593Smuzhiyun  * driver still configures the top half to run in free-run mode.
34*4882a593Smuzhiyun  */
35*4882a593Smuzhiyun struct davinci_timer_cfg {
36*4882a593Smuzhiyun 	struct resource reg;
37*4882a593Smuzhiyun 	struct resource irq[DAVINCI_TIMER_NUM_IRQS];
38*4882a593Smuzhiyun 	unsigned int cmp_off;
39*4882a593Smuzhiyun };
40*4882a593Smuzhiyun 
41*4882a593Smuzhiyun int __init davinci_timer_register(struct clk *clk,
42*4882a593Smuzhiyun 				  const struct davinci_timer_cfg *data);
43*4882a593Smuzhiyun 
44*4882a593Smuzhiyun #endif /* __TIMER_DAVINCI_H__ */
45