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