summaryrefslogtreecommitdiff
path: root/include/soc/sprd/sci.h
blob: 7e3dbe461f29fdb664e1f2d43705128c34259403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 * Copyright (C) 2012 Spreadtrum Communications Inc.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 */
#ifndef __SPRD_SCI_H__
#define __SPRD_SCI_H__

/**
 * sci_glb_read - read value from d-die global register
 * @reg: global register address
 * @msk:
 *
 * If read all bits, set msk = -1
 *
 * Return read value and mask.
 */
u32 sci_glb_read(unsigned long reg, u32 msk);

/**
 * sci_glb_write - safely write value to d-die global register
 * @reg: global register address
 * @val:
 * @msk:
 *
 * If write all bits, set msk = -1
 *
 * Returns success (0) or negative errno.
 */
int sci_glb_write(unsigned long reg, u32 val, u32 msk);

/**
 * sci_glb_set - force set bit to d-die global register
 * @reg: global register address
 * @bit: commonly, only set one bit
 *
 *
 * tiger use stand-alone xxx_set/xxx_clr address for all global register
 *
 * Returns success (0) or negative errno.
 */
int sci_glb_set(unsigned long reg, u32 bit);

/**
 * sci_glb_clr - force clr bit to d-die gglobal register
 * @reg: global register address
 * @bit: commonly, only clear one bit
 *
 *
 * tiger use stand-alone xxx_set/xxx_clr address for all d-die global register
 *
 * Returns success (0) or negative errno.
 */
int sci_glb_clr(unsigned long reg, u32 bit);

#define sci_glb_raw_read(reg)           sci_glb_read(reg, -1UL)
#define sci_glb_raw_write(reg, val)     sci_glb_write(reg, val, -1UL)

#define sci_assert(condition)	do { WARN_ON(!(condition)); }while(0)

#endif