2 * Copyright (C) 2012 Spreadtrum Communications Inc.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
17 * sci_glb_read - read value from d-die global register
18 * @reg: global register address
21 * If read all bits, set msk = -1
23 * Return read value and mask.
25 u32 sci_glb_read(u32 reg, u32 msk);
28 * sci_glb_write - safely write value to d-die global register
29 * @reg: global register address
33 * If write all bits, set msk = -1
35 * Returns success (0) or negative errno.
37 int sci_glb_write(u32 reg, u32 val, u32 msk);
40 * sci_glb_set - force set bit to d-die global register
41 * @reg: global register address
42 * @bit: commonly, only set one bit
45 * tiger use stand-alone xxx_set/xxx_clr address for all global register
47 * Returns success (0) or negative errno.
49 int sci_glb_set(u32 reg, u32 bit);
52 * sci_glb_clr - force clr bit to d-die gglobal register
53 * @reg: global register address
54 * @bit: commonly, only clear one bit
57 * tiger use stand-alone xxx_set/xxx_clr address for all d-die global register
59 * Returns success (0) or negative errno.
61 int sci_glb_clr(u32 reg, u32 bit);
63 #define sci_glb_raw_read(reg) sci_glb_read(reg, -1UL)
64 #define sci_glb_raw_write(reg, val) sci_glb_write(reg, val, -1UL)
66 #define sci_assert(condition) do { WARN_ON(!(condition)); }while(0)