1 /* 2 * DMTIMER platform data for TI OMAP platforms 3 * 4 * Copyright (C) 2012 Texas Instruments 5 * Author: Jon Hunter <jon-hunter@ti.com> 6 * 7 * This program is free software; you can redistribute it and/or modify it 8 * under the terms of the GNU General Public License version 2 as published by 9 * the Free Software Foundation. 10 * 11 * This program is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 14 * more details. 15 * 16 * You should have received a copy of the GNU General Public License along with 17 * this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #ifndef __PLATFORM_DATA_DMTIMER_OMAP_H__ 21 #define __PLATFORM_DATA_DMTIMER_OMAP_H__ 22 23 struct omap_dm_timer_ops { 24 struct omap_dm_timer *(*request_by_node)(struct device_node *np); 25 struct omap_dm_timer *(*request_specific)(int timer_id); 26 struct omap_dm_timer *(*request)(void); 27 28 int (*free)(struct omap_dm_timer *timer); 29 30 void (*enable)(struct omap_dm_timer *timer); 31 void (*disable)(struct omap_dm_timer *timer); 32 33 int (*get_irq)(struct omap_dm_timer *timer); 34 int (*set_int_enable)(struct omap_dm_timer *timer, 35 unsigned int value); 36 int (*set_int_disable)(struct omap_dm_timer *timer, u32 mask); 37 38 struct clk *(*get_fclk)(struct omap_dm_timer *timer); 39 40 int (*start)(struct omap_dm_timer *timer); 41 int (*stop)(struct omap_dm_timer *timer); 42 int (*set_source)(struct omap_dm_timer *timer, int source); 43 44 int (*set_load)(struct omap_dm_timer *timer, int autoreload, 45 unsigned int value); 46 int (*set_match)(struct omap_dm_timer *timer, int enable, 47 unsigned int match); 48 int (*set_pwm)(struct omap_dm_timer *timer, int def_on, 49 int toggle, int trigger); 50 int (*set_prescaler)(struct omap_dm_timer *timer, int prescaler); 51 52 unsigned int (*read_counter)(struct omap_dm_timer *timer); 53 int (*write_counter)(struct omap_dm_timer *timer, 54 unsigned int value); 55 unsigned int (*read_status)(struct omap_dm_timer *timer); 56 int (*write_status)(struct omap_dm_timer *timer, 57 unsigned int value); 58 }; 59 60 struct dmtimer_platform_data { 61 /* set_timer_src - Only used for OMAP1 devices */ 62 int (*set_timer_src)(struct platform_device *pdev, int source); 63 u32 timer_capability; 64 u32 timer_errata; 65 int (*get_context_loss_count)(struct device *); 66 const struct omap_dm_timer_ops *timer_ops; 67 }; 68 69 #endif /* __PLATFORM_DATA_DMTIMER_OMAP_H__ */ 70