18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * TI DaVinci clocksource driver
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2019 Texas Instruments
68c2ecf20Sopenharmony_ci * Author: Bartosz Golaszewski <bgolaszewski@baylibre.com>
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#ifndef __TIMER_DAVINCI_H__
108c2ecf20Sopenharmony_ci#define __TIMER_DAVINCI_H__
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#include <linux/clk.h>
138c2ecf20Sopenharmony_ci#include <linux/ioport.h>
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cienum {
168c2ecf20Sopenharmony_ci	DAVINCI_TIMER_CLOCKEVENT_IRQ,
178c2ecf20Sopenharmony_ci	DAVINCI_TIMER_CLOCKSOURCE_IRQ,
188c2ecf20Sopenharmony_ci	DAVINCI_TIMER_NUM_IRQS,
198c2ecf20Sopenharmony_ci};
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/**
228c2ecf20Sopenharmony_ci * struct davinci_timer_cfg - davinci clocksource driver configuration struct
238c2ecf20Sopenharmony_ci * @reg:        register range resource
248c2ecf20Sopenharmony_ci * @irq:        clockevent and clocksource interrupt resources
258c2ecf20Sopenharmony_ci * @cmp_off:    if set - it specifies the compare register used for clockevent
268c2ecf20Sopenharmony_ci *
278c2ecf20Sopenharmony_ci * Note: if the compare register is specified, the driver will use the bottom
288c2ecf20Sopenharmony_ci * clock half for both clocksource and clockevent and the compare register
298c2ecf20Sopenharmony_ci * to generate event irqs. The user must supply the correct compare register
308c2ecf20Sopenharmony_ci * interrupt number.
318c2ecf20Sopenharmony_ci *
328c2ecf20Sopenharmony_ci * This is only used by da830 the DSP of which uses the top half. The timer
338c2ecf20Sopenharmony_ci * driver still configures the top half to run in free-run mode.
348c2ecf20Sopenharmony_ci */
358c2ecf20Sopenharmony_cistruct davinci_timer_cfg {
368c2ecf20Sopenharmony_ci	struct resource reg;
378c2ecf20Sopenharmony_ci	struct resource irq[DAVINCI_TIMER_NUM_IRQS];
388c2ecf20Sopenharmony_ci	unsigned int cmp_off;
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ciint __init davinci_timer_register(struct clk *clk,
428c2ecf20Sopenharmony_ci				  const struct davinci_timer_cfg *data);
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci#endif /* __TIMER_DAVINCI_H__ */
45