162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * TI DaVinci clocksource driver 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2019 Texas Instruments 662306a36Sopenharmony_ci * Author: Bartosz Golaszewski <bgolaszewski@baylibre.com> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#ifndef __TIMER_DAVINCI_H__ 1062306a36Sopenharmony_ci#define __TIMER_DAVINCI_H__ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/clk.h> 1362306a36Sopenharmony_ci#include <linux/ioport.h> 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_cienum { 1662306a36Sopenharmony_ci DAVINCI_TIMER_CLOCKEVENT_IRQ, 1762306a36Sopenharmony_ci DAVINCI_TIMER_CLOCKSOURCE_IRQ, 1862306a36Sopenharmony_ci DAVINCI_TIMER_NUM_IRQS, 1962306a36Sopenharmony_ci}; 2062306a36Sopenharmony_ci 2162306a36Sopenharmony_ci/** 2262306a36Sopenharmony_ci * struct davinci_timer_cfg - davinci clocksource driver configuration struct 2362306a36Sopenharmony_ci * @reg: register range resource 2462306a36Sopenharmony_ci * @irq: clockevent and clocksource interrupt resources 2562306a36Sopenharmony_ci * @cmp_off: if set - it specifies the compare register used for clockevent 2662306a36Sopenharmony_ci * 2762306a36Sopenharmony_ci * Note: if the compare register is specified, the driver will use the bottom 2862306a36Sopenharmony_ci * clock half for both clocksource and clockevent and the compare register 2962306a36Sopenharmony_ci * to generate event irqs. The user must supply the correct compare register 3062306a36Sopenharmony_ci * interrupt number. 3162306a36Sopenharmony_ci * 3262306a36Sopenharmony_ci * This is only used by da830 the DSP of which uses the top half. The timer 3362306a36Sopenharmony_ci * driver still configures the top half to run in free-run mode. 3462306a36Sopenharmony_ci */ 3562306a36Sopenharmony_cistruct davinci_timer_cfg { 3662306a36Sopenharmony_ci struct resource reg; 3762306a36Sopenharmony_ci struct resource irq[DAVINCI_TIMER_NUM_IRQS]; 3862306a36Sopenharmony_ci unsigned int cmp_off; 3962306a36Sopenharmony_ci}; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ciint __init davinci_timer_register(struct clk *clk, 4262306a36Sopenharmony_ci const struct davinci_timer_cfg *data); 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#endif /* __TIMER_DAVINCI_H__ */ 45