1caab277bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
240fc3bb5SJon Hunter /*
340fc3bb5SJon Hunter  * DMTIMER platform data for TI OMAP platforms
440fc3bb5SJon Hunter  *
540fc3bb5SJon Hunter  * Copyright (C) 2012 Texas Instruments
640fc3bb5SJon Hunter  * Author: Jon Hunter <[email protected]>
740fc3bb5SJon Hunter  */
840fc3bb5SJon Hunter 
940fc3bb5SJon Hunter #ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__
1040fc3bb5SJon Hunter #define __PLATFORM_DATA_DMTIMER_OMAP_H__
1140fc3bb5SJon Hunter 
12a7f249e3SKeerthy struct omap_dm_timer_ops {
13a7f249e3SKeerthy 	struct omap_dm_timer *(*request_by_node)(struct device_node *np);
14a7f249e3SKeerthy 	struct omap_dm_timer *(*request_specific)(int timer_id);
15a7f249e3SKeerthy 	struct omap_dm_timer *(*request)(void);
16a7f249e3SKeerthy 
17a7f249e3SKeerthy 	int	(*free)(struct omap_dm_timer *timer);
18a7f249e3SKeerthy 
19a7f249e3SKeerthy 	void	(*enable)(struct omap_dm_timer *timer);
20a7f249e3SKeerthy 	void	(*disable)(struct omap_dm_timer *timer);
21a7f249e3SKeerthy 
22a7f249e3SKeerthy 	int	(*get_irq)(struct omap_dm_timer *timer);
23a7f249e3SKeerthy 	int	(*set_int_enable)(struct omap_dm_timer *timer,
24a7f249e3SKeerthy 				  unsigned int value);
25a7f249e3SKeerthy 	int	(*set_int_disable)(struct omap_dm_timer *timer, u32 mask);
26a7f249e3SKeerthy 
27a7f249e3SKeerthy 	struct clk *(*get_fclk)(struct omap_dm_timer *timer);
28a7f249e3SKeerthy 
29a7f249e3SKeerthy 	int	(*start)(struct omap_dm_timer *timer);
30a7f249e3SKeerthy 	int	(*stop)(struct omap_dm_timer *timer);
31a7f249e3SKeerthy 	int	(*set_source)(struct omap_dm_timer *timer, int source);
32a7f249e3SKeerthy 
33*02e6d546SLokesh Vutla 	int	(*set_load)(struct omap_dm_timer *timer, unsigned int value);
34a7f249e3SKeerthy 	int	(*set_match)(struct omap_dm_timer *timer, int enable,
35a7f249e3SKeerthy 			     unsigned int match);
36a7f249e3SKeerthy 	int	(*set_pwm)(struct omap_dm_timer *timer, int def_on,
37*02e6d546SLokesh Vutla 			   int toggle, int trigger, int autoreload);
3892fd8686SLokesh Vutla 	int	(*get_pwm_status)(struct omap_dm_timer *timer);
39a7f249e3SKeerthy 	int	(*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
40a7f249e3SKeerthy 
41a7f249e3SKeerthy 	unsigned int (*read_counter)(struct omap_dm_timer *timer);
42a7f249e3SKeerthy 	int	(*write_counter)(struct omap_dm_timer *timer,
43a7f249e3SKeerthy 				 unsigned int value);
44a7f249e3SKeerthy 	unsigned int (*read_status)(struct omap_dm_timer *timer);
45a7f249e3SKeerthy 	int	(*write_status)(struct omap_dm_timer *timer,
46a7f249e3SKeerthy 				unsigned int value);
47a7f249e3SKeerthy };
48a7f249e3SKeerthy 
4940fc3bb5SJon Hunter struct dmtimer_platform_data {
5040fc3bb5SJon Hunter 	/* set_timer_src - Only used for OMAP1 devices */
5140fc3bb5SJon Hunter 	int (*set_timer_src)(struct platform_device *pdev, int source);
5240fc3bb5SJon Hunter 	u32 timer_capability;
5340fc3bb5SJon Hunter 	u32 timer_errata;
5440fc3bb5SJon Hunter 	int (*get_context_loss_count)(struct device *);
55a7f249e3SKeerthy 	const struct omap_dm_timer_ops *timer_ops;
5640fc3bb5SJon Hunter };
5740fc3bb5SJon Hunter 
5840fc3bb5SJon Hunter #endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */
59