162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * DMTIMER platform data for TI OMAP platforms
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (C) 2012 Texas Instruments
662306a36Sopenharmony_ci * Author: Jon Hunter <jon-hunter@ti.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__
1062306a36Sopenharmony_ci#define __PLATFORM_DATA_DMTIMER_OMAP_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_cistruct omap_dm_timer_ops {
1362306a36Sopenharmony_ci	struct omap_dm_timer *(*request_by_node)(struct device_node *np);
1462306a36Sopenharmony_ci	struct omap_dm_timer *(*request_specific)(int timer_id);
1562306a36Sopenharmony_ci	struct omap_dm_timer *(*request)(void);
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci	int	(*free)(struct omap_dm_timer *timer);
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ci	void	(*enable)(struct omap_dm_timer *timer);
2062306a36Sopenharmony_ci	void	(*disable)(struct omap_dm_timer *timer);
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci	int	(*get_irq)(struct omap_dm_timer *timer);
2362306a36Sopenharmony_ci	int	(*set_int_enable)(struct omap_dm_timer *timer,
2462306a36Sopenharmony_ci				  unsigned int value);
2562306a36Sopenharmony_ci	int	(*set_int_disable)(struct omap_dm_timer *timer, u32 mask);
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci	struct clk *(*get_fclk)(struct omap_dm_timer *timer);
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci	int	(*start)(struct omap_dm_timer *timer);
3062306a36Sopenharmony_ci	int	(*stop)(struct omap_dm_timer *timer);
3162306a36Sopenharmony_ci	int	(*set_source)(struct omap_dm_timer *timer, int source);
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	int	(*set_load)(struct omap_dm_timer *timer, unsigned int value);
3462306a36Sopenharmony_ci	int	(*set_match)(struct omap_dm_timer *timer, int enable,
3562306a36Sopenharmony_ci			     unsigned int match);
3662306a36Sopenharmony_ci	int	(*set_pwm)(struct omap_dm_timer *timer, int def_on,
3762306a36Sopenharmony_ci			   int toggle, int trigger, int autoreload);
3862306a36Sopenharmony_ci	int	(*get_pwm_status)(struct omap_dm_timer *timer);
3962306a36Sopenharmony_ci	int	(*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	unsigned int (*read_counter)(struct omap_dm_timer *timer);
4262306a36Sopenharmony_ci	int	(*write_counter)(struct omap_dm_timer *timer,
4362306a36Sopenharmony_ci				 unsigned int value);
4462306a36Sopenharmony_ci	unsigned int (*read_status)(struct omap_dm_timer *timer);
4562306a36Sopenharmony_ci	int	(*write_status)(struct omap_dm_timer *timer,
4662306a36Sopenharmony_ci				unsigned int value);
4762306a36Sopenharmony_ci};
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_cistruct dmtimer_platform_data {
5062306a36Sopenharmony_ci	/* set_timer_src - Only used for OMAP1 devices */
5162306a36Sopenharmony_ci	int (*set_timer_src)(struct platform_device *pdev, int source);
5262306a36Sopenharmony_ci	u32 timer_capability;
5362306a36Sopenharmony_ci	u32 timer_errata;
5462306a36Sopenharmony_ci	int (*get_context_loss_count)(struct device *);
5562306a36Sopenharmony_ci	const struct omap_dm_timer_ops *timer_ops;
5662306a36Sopenharmony_ci};
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */
59