ASoC: da7219: Correct IRQ level in DT binding example
[linux-2.6-microblaze.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_common / host / gp_timer.c
1 /*
2  * Support for Intel Camera Imaging ISP subsystem.
3  * Copyright (c) 2010-2015, Intel Corporation.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms and conditions of the GNU General Public License,
7  * version 2, as published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  */
14
15 #include <type_support.h> /*uint32_t */
16 #include "gp_timer.h"   /*system_local.h,
17                           gp_timer_public.h*/
18
19 #ifndef __INLINE_GP_TIMER__
20 #include "gp_timer_private.h"  /*device_access.h*/
21 #endif /* __INLINE_GP_TIMER__ */
22 #include "system_local.h"
23
24 /** FIXME: not sure if reg_load(), reg_store() should be API.
25  */
26 static uint32_t
27 gp_timer_reg_load(uint32_t reg);
28
29 static void
30 gp_timer_reg_store(uint32_t reg, uint32_t value);
31
32 uint32_t
33 gp_timer_reg_load(uint32_t reg)
34 {
35         return ia_css_device_load_uint32(
36                         GP_TIMER_BASE +
37                         (reg * sizeof(uint32_t)));
38 }
39
40 static void
41 gp_timer_reg_store(uint32_t reg, uint32_t value)
42 {
43         ia_css_device_store_uint32((GP_TIMER_BASE +
44                                     (reg * sizeof(uint32_t))),
45                                     value);
46 }
47
48 void gp_timer_init(gp_timer_ID_t ID)
49 {
50         /* set_overall_enable*/
51         gp_timer_reg_store(_REG_GP_TIMER_OVERALL_ENABLE, 1);
52
53         /*set enable*/
54         gp_timer_reg_store(_REG_GP_TIMER_ENABLE_ID(ID), 1);
55
56         /* set signal select */
57         gp_timer_reg_store(_REG_GP_TIMER_SIGNAL_SELECT_ID(ID), GP_TIMER_SIGNAL_SELECT);
58
59         /*set count type */
60         gp_timer_reg_store(_REG_GP_TIMER_COUNT_TYPE_ID(ID), GP_TIMER_COUNT_TYPE_LOW);
61
62         /*reset gp timer */
63         gp_timer_reg_store(_REG_GP_TIMER_RESET_REG, 0xFF);
64 }
65
66 uint32_t
67 gp_timer_read(gp_timer_ID_t ID)
68 {
69         return  gp_timer_reg_load(_REG_GP_TIMER_VALUE_ID(ID));
70 }