tizen 2.4 release
[kernel/u-boot-tm1.git] / arch / arm / include / asm / arch-sc9630 / adi.h
1 /* * Copyright (C) 2012 Spreadtrum Communications Inc.
2  *
3  * This software is licensed under the terms of the GNU General Public
4  * License version 2, as published by the Free Software Foundation, and
5  * may be copied, distributed, and modified under those terms.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  * GNU General Public License for more details.
11  *
12  */
13
14 #ifndef __ADI_H__
15 #define __ADI_H__
16
17 void sci_adi_init(void);
18
19 /*
20  * sci_get_adie_chip_id - read a-die chip id
21  */
22 u32 sci_get_adie_chip_id(void);
23
24 int sci_adi_read(u32 reg);
25
26 /*
27  * WARN: the arguments (reg, value) is different from
28  * the general __raw_writel(value, reg)
29  * For sci_adi_write_fast: if set sync 1, then this function will
30  * return until the val have reached hardware.otherwise, just
31  * async write(is maybe in software buffer)
32  */
33 int sci_adi_write_fast(u32 reg, u16 val, u32 sync);
34 int sci_adi_write(u32 reg, u16 or_val, u16 clear_msk);
35
36 static inline int sci_adi_raw_write(u32 reg, u16 val)
37 {
38 #if defined(CONFIG_FPGA)
39         return 0;
40 #else
41         return sci_adi_write_fast(reg, val, 1);
42 #endif  /* CONFIG_FPGA */
43 }
44
45 static inline int sci_adi_set(u32 reg, u16 bits)
46 {
47 #if defined(CONFIG_FPGA)
48         return 0;
49 #else
50         return sci_adi_write(reg, bits, 0);
51 #endif  /* CONFIG_FPGA */
52 }
53
54 static inline int sci_adi_clr(u32 reg, u16 bits)
55 {
56 #if defined(CONFIG_FPGA)
57         return 0;
58 #else
59         return sci_adi_write(reg, 0, bits);
60 #endif  /* CONFIG_FPGA */
61 }
62
63 #endif