aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorMattias Nilsson <mattias.i.nilsson@stericsson.com>2011-08-12 04:27:20 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2011-10-24 08:09:17 -0400
commitc553b3ca12046884af1a72ffb6e9d841a026adb9 (patch)
tree20463ba565e7d3f2ffa7dcafa725c6524cf46026 /drivers/mfd
parentc38d66ac924e84ea3606c408b117157415df07b3 (diff)
mfd: Refactor DB8500 PRCMU reg access
Instead of carrying around the __PRCMU_BASE in every read or write to the PRCMU registers, move it out to the register definition file and define registers along with their base offset so that the code gets easier to read. Signed-off-by: Mattias Nilsson <mattias.i.nilsson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/db8500-prcmu-regs.h266
-rw-r--r--drivers/mfd/db8500-prcmu.c159
2 files changed, 229 insertions, 196 deletions
diff --git a/drivers/mfd/db8500-prcmu-regs.h b/drivers/mfd/db8500-prcmu-regs.h
index 3bbf04d58043..ec22e9f15d32 100644
--- a/drivers/mfd/db8500-prcmu-regs.h
+++ b/drivers/mfd/db8500-prcmu-regs.h
@@ -9,99 +9,170 @@
9 * 9 *
10 * PRCM Unit registers 10 * PRCM Unit registers
11 */ 11 */
12
12#ifndef __DB8500_PRCMU_REGS_H 13#ifndef __DB8500_PRCMU_REGS_H
13#define __DB8500_PRCMU_REGS_H 14#define __DB8500_PRCMU_REGS_H
14 15
15#include <linux/bitops.h>
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17 17
18#define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end)) 18#define BITS(_start, _end) ((BIT(_end) - BIT(_start)) + BIT(_end))
19 19
20#define PRCM_ARM_PLLDIVPS 0x118 20#define PRCM_SVACLK_MGT_OFF 0x008
21#define PRCM_ARM_PLLDIVPS_ARM_BRM_RATE BITS(0, 5) 21#define PRCM_SIACLK_MGT_OFF 0x00C
22#define PRCM_ARM_PLLDIVPS_MAX_MASK 0xF 22#define PRCM_SGACLK_MGT_OFF 0x014
23 23#define PRCM_UARTCLK_MGT_OFF 0x018
24#define PRCM_PLLARM_LOCKP 0x0A8 24#define PRCM_MSP02CLK_MGT_OFF 0x01C
25#define PRCM_PLLARM_LOCKP_PRCM_PLLARM_LOCKP3 BIT(1) 25#define PRCM_I2CCLK_MGT_OFF 0x020
26 26#define PRCM_SDMMCCLK_MGT_OFF 0x024
27#define PRCM_ARM_CHGCLKREQ 0x114 27#define PRCM_SLIMCLK_MGT_OFF 0x028
28#define PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ BIT(0) 28#define PRCM_PER1CLK_MGT_OFF 0x02C
29 29#define PRCM_PER2CLK_MGT_OFF 0x030
30#define PRCM_PLLARM_ENABLE 0x98 30#define PRCM_PER3CLK_MGT_OFF 0x034
31#define PRCM_PLLARM_ENABLE_PRCM_PLLARM_ENABLE BIT(0) 31#define PRCM_PER5CLK_MGT_OFF 0x038
32#define PRCM_PLLARM_ENABLE_PRCM_PLLARM_COUNTON BIT(8) 32#define PRCM_PER6CLK_MGT_OFF 0x03C
33 33#define PRCM_PER7CLK_MGT_OFF 0x040
34#define PRCM_ARMCLKFIX_MGT 0x0 34#define PRCM_PWMCLK_MGT_OFF 0x044 /* for DB5500 */
35#define PRCM_A9_RESETN_CLR 0x1f4 35#define PRCM_IRDACLK_MGT_OFF 0x048 /* for DB5500 */
36#define PRCM_A9_RESETN_SET 0x1f0 36#define PRCM_IRRCCLK_MGT_OFF 0x04C /* for DB5500 */
37#define PRCM_ARM_LS_CLAMP 0x30C 37#define PRCM_LCDCLK_MGT_OFF 0x044
38#define PRCM_SRAM_A9 0x308 38#define PRCM_BMLCLK_MGT_OFF 0x04C
39#define PRCM_HSITXCLK_MGT_OFF 0x050
40#define PRCM_HSIRXCLK_MGT_OFF 0x054
41#define PRCM_HDMICLK_MGT_OFF 0x058
42#define PRCM_APEATCLK_MGT_OFF 0x05C
43#define PRCM_APETRACECLK_MGT_OFF 0x060
44#define PRCM_MCDECLK_MGT_OFF 0x064
45#define PRCM_IPI2CCLK_MGT_OFF 0x068
46#define PRCM_DSIALTCLK_MGT_OFF 0x06C
47#define PRCM_DMACLK_MGT_OFF 0x074
48#define PRCM_B2R2CLK_MGT_OFF 0x078
49#define PRCM_TVCLK_MGT_OFF 0x07C
50#define PRCM_UNIPROCLK_MGT_OFF 0x278
51#define PRCM_SSPCLK_MGT_OFF 0x280
52#define PRCM_RNGCLK_MGT_OFF 0x284
53#define PRCM_UICCCLK_MGT_OFF 0x27C
54#define PRCM_MSP1CLK_MGT_OFF 0x288
55
56#define PRCM_ARM_PLLDIVPS (_PRCMU_BASE + 0x118)
57#define PRCM_ARM_PLLDIVPS_ARM_BRM_RATE 0x3f
58#define PRCM_ARM_PLLDIVPS_MAX_MASK 0xf
59
60#define PRCM_PLLARM_LOCKP (_PRCMU_BASE + 0x0a8)
61#define PRCM_PLLARM_LOCKP_PRCM_PLLARM_LOCKP3 0x2
62
63#define PRCM_ARM_CHGCLKREQ (_PRCMU_BASE + 0x114)
64#define PRCM_ARM_CHGCLKREQ_PRCM_ARM_CHGCLKREQ 0x1
65
66#define PRCM_PLLARM_ENABLE (_PRCMU_BASE + 0x98)
67#define PRCM_PLLARM_ENABLE_PRCM_PLLARM_ENABLE 0x1
68#define PRCM_PLLARM_ENABLE_PRCM_PLLARM_COUNTON 0x100
69
70#define PRCM_ARMCLKFIX_MGT (_PRCMU_BASE + 0x0)
71#define PRCM_A9PL_FORCE_CLKEN (_PRCMU_BASE + 0x19C)
72#define PRCM_A9_RESETN_CLR (_PRCMU_BASE + 0x1f4)
73#define PRCM_A9_RESETN_SET (_PRCMU_BASE + 0x1f0)
74#define PRCM_ARM_LS_CLAMP (_PRCMU_BASE + 0x30c)
75#define PRCM_SRAM_A9 (_PRCMU_BASE + 0x308)
76
77#define PRCM_A9PL_FORCE_CLKEN_PRCM_A9PL_FORCE_CLKEN BIT(0)
78#define PRCM_A9PL_FORCE_CLKEN_PRCM_A9AXI_FORCE_CLKEN BIT(1)
39 79
40/* ARM WFI Standby signal register */ 80/* ARM WFI Standby signal register */
41#define PRCM_ARM_WFI_STANDBY 0x130 81#define PRCM_ARM_WFI_STANDBY (_PRCMU_BASE + 0x130)
42#define PRCM_IOCR 0x310 82#define PRCM_IOCR (_PRCMU_BASE + 0x310)
43#define PRCM_IOCR_IOFORCE BIT(0) 83#define PRCM_IOCR_IOFORCE 0x1
44 84
45/* CPU mailbox registers */ 85/* CPU mailbox registers */
46#define PRCM_MBOX_CPU_VAL 0x0FC 86#define PRCM_MBOX_CPU_VAL (_PRCMU_BASE + 0x0fc)
47#define PRCM_MBOX_CPU_SET 0x100 87#define PRCM_MBOX_CPU_SET (_PRCMU_BASE + 0x100)
88#define PRCM_MBOX_CPU_CLR (_PRCMU_BASE + 0x104)
48 89
49/* Dual A9 core interrupt management unit registers */ 90/* Dual A9 core interrupt management unit registers */
50#define PRCM_A9_MASK_REQ 0x328 91#define PRCM_A9_MASK_REQ (_PRCMU_BASE + 0x328)
51#define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ BIT(0) 92#define PRCM_A9_MASK_REQ_PRCM_A9_MASK_REQ 0x1
52 93
53#define PRCM_A9_MASK_ACK 0x32C 94#define PRCM_A9_MASK_ACK (_PRCMU_BASE + 0x32c)
54#define PRCM_ARMITMSK31TO0 0x11C 95#define PRCM_ARMITMSK31TO0 (_PRCMU_BASE + 0x11c)
55#define PRCM_ARMITMSK63TO32 0x120 96#define PRCM_ARMITMSK63TO32 (_PRCMU_BASE + 0x120)
56#define PRCM_ARMITMSK95TO64 0x124 97#define PRCM_ARMITMSK95TO64 (_PRCMU_BASE + 0x124)
57#define PRCM_ARMITMSK127TO96 0x128 98#define PRCM_ARMITMSK127TO96 (_PRCMU_BASE + 0x128)
58#define PRCM_POWER_STATE_VAL 0x25C 99#define PRCM_POWER_STATE_VAL (_PRCMU_BASE + 0x25C)
59#define PRCM_ARMITVAL31TO0 0x260 100#define PRCM_ARMITVAL31TO0 (_PRCMU_BASE + 0x260)
60#define PRCM_ARMITVAL63TO32 0x264 101#define PRCM_ARMITVAL63TO32 (_PRCMU_BASE + 0x264)
61#define PRCM_ARMITVAL95TO64 0x268 102#define PRCM_ARMITVAL95TO64 (_PRCMU_BASE + 0x268)
62#define PRCM_ARMITVAL127TO96 0x26C 103#define PRCM_ARMITVAL127TO96 (_PRCMU_BASE + 0x26C)
63 104
64#define PRCM_HOSTACCESS_REQ 0x334 105#define PRCM_HOSTACCESS_REQ (_PRCMU_BASE + 0x334)
65#define PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ BIT(0) 106#define PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ 0x1
66 107#define ARM_WAKEUP_MODEM 0x1
67#define PRCM_ARM_IT1_CLR 0x48C 108
68#define PRCM_ARM_IT1_VAL 0x494 109#define PRCM_ARM_IT1_CLR (_PRCMU_BASE + 0x48C)
69 110#define PRCM_ARM_IT1_VAL (_PRCMU_BASE + 0x494)
70#define PRCM_ITSTATUS0 0x148 111#define PRCM_HOLD_EVT (_PRCMU_BASE + 0x174)
71#define PRCM_ITSTATUS1 0x150 112
72#define PRCM_ITSTATUS2 0x158 113#define PRCM_MOD_AWAKE_STATUS (_PRCMU_BASE + 0x4A0)
73#define PRCM_ITSTATUS3 0x160 114#define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_COREPD_AWAKE BIT(0)
74#define PRCM_ITSTATUS4 0x168 115#define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_AAPD_AWAKE BIT(1)
75#define PRCM_ITSTATUS5 0x484 116#define PRCM_MOD_AWAKE_STATUS_PRCM_MOD_VMODEM_OFF_ISO BIT(2)
76#define PRCM_ITCLEAR5 0x488 117
77#define PRCM_ARMIT_MASKXP70_IT 0x1018 118#define PRCM_ITSTATUS0 (_PRCMU_BASE + 0x148)
119#define PRCM_ITSTATUS1 (_PRCMU_BASE + 0x150)
120#define PRCM_ITSTATUS2 (_PRCMU_BASE + 0x158)
121#define PRCM_ITSTATUS3 (_PRCMU_BASE + 0x160)
122#define PRCM_ITSTATUS4 (_PRCMU_BASE + 0x168)
123#define PRCM_ITSTATUS5 (_PRCMU_BASE + 0x484)
124#define PRCM_ITCLEAR5 (_PRCMU_BASE + 0x488)
125#define PRCM_ARMIT_MASKXP70_IT (_PRCMU_BASE + 0x1018)
78 126
79/* System reset register */ 127/* System reset register */
80#define PRCM_APE_SOFTRST 0x228 128#define PRCM_APE_SOFTRST (_PRCMU_BASE + 0x228)
81 129
82/* Level shifter and clamp control registers */ 130/* Level shifter and clamp control registers */
83#define PRCM_MMIP_LS_CLAMP_SET 0x420 131#define PRCM_MMIP_LS_CLAMP_SET (_PRCMU_BASE + 0x420)
84#define PRCM_MMIP_LS_CLAMP_CLR 0x424 132#define PRCM_MMIP_LS_CLAMP_CLR (_PRCMU_BASE + 0x424)
133
134/* PRCMU clock/PLL/reset registers */
135#define PRCM_PLLDSI_FREQ (_PRCMU_BASE + 0x500)
136#define PRCM_PLLDSI_ENABLE (_PRCMU_BASE + 0x504)
137#define PRCM_PLLDSI_LOCKP (_PRCMU_BASE + 0x508)
138#define PRCM_LCDCLK_MGT (_PRCMU_BASE + PRCM_LCDCLK_MGT_OFF)
139#define PRCM_MCDECLK_MGT (_PRCMU_BASE + PRCM_MCDECLK_MGT_OFF)
140#define PRCM_HDMICLK_MGT (_PRCMU_BASE + PRCM_HDMICLK_MGT_OFF)
141#define PRCM_TVCLK_MGT (_PRCMU_BASE + PRCM_TVCLK_MGT_OFF)
142#define PRCM_DSI_PLLOUT_SEL (_PRCMU_BASE + 0x530)
143#define PRCM_DSITVCLK_DIV (_PRCMU_BASE + 0x52C)
144#define PRCM_PLLDSI_LOCKP (_PRCMU_BASE + 0x508)
145#define PRCM_APE_RESETN_SET (_PRCMU_BASE + 0x1E4)
146#define PRCM_APE_RESETN_CLR (_PRCMU_BASE + 0x1E8)
147
148#define PRCM_CLKOCR (_PRCMU_BASE + 0x1CC)
149#define PRCM_CLKOCR_CLKOUT0_REF_CLK (1 << 0)
150#define PRCM_CLKOCR_CLKOUT0_MASK BITS(0, 13)
151#define PRCM_CLKOCR_CLKOUT1_REF_CLK (1 << 16)
152#define PRCM_CLKOCR_CLKOUT1_MASK BITS(16, 29)
153
154/* ePOD and memory power signal control registers */
155#define PRCM_EPOD_C_SET (_PRCMU_BASE + 0x410)
156#define PRCM_SRAM_LS_SLEEP (_PRCMU_BASE + 0x304)
157
158/* Debug power control unit registers */
159#define PRCM_POWER_STATE_SET (_PRCMU_BASE + 0x254)
160
161/* Miscellaneous unit registers */
162#define PRCM_DSI_SW_RESET (_PRCMU_BASE + 0x324)
163#define PRCM_GPIOCR (_PRCMU_BASE + 0x138)
164#define PRCM_GPIOCR_DBG_STM_MOD_CMD1 0x800
165#define PRCM_GPIOCR_DBG_UARTMOD_CMD0 0x1
85 166
86/* PRCMU HW semaphore */ 167/* PRCMU HW semaphore */
87#define PRCM_SEM 0x400 168#define PRCM_SEM (_PRCMU_BASE + 0x400)
88#define PRCM_SEM_PRCM_SEM BIT(0) 169#define PRCM_SEM_PRCM_SEM BIT(0)
89 170
90/* PRCMU clock/PLL/reset registers */ 171#define PRCM_TCR (_PRCMU_BASE + 0x1C8)
91#define PRCM_PLLDSI_FREQ 0x500 172#define PRCM_TCR_TENSEL_MASK BITS(0, 7)
92#define PRCM_PLLDSI_ENABLE 0x504 173#define PRCM_TCR_STOP_TIMERS BIT(16)
93#define PRCM_PLLDSI_LOCKP 0x508 174#define PRCM_TCR_DOZE_MODE BIT(17)
94#define PRCM_DSI_PLLOUT_SEL 0x530 175
95#define PRCM_DSITVCLK_DIV 0x52C
96#define PRCM_APE_RESETN_SET 0x1E4
97#define PRCM_APE_RESETN_CLR 0x1E8
98
99#define PRCM_TCR 0x1C8
100#define PRCM_TCR_TENSEL_MASK BITS(0, 7)
101#define PRCM_TCR_STOP_TIMERS BIT(16)
102#define PRCM_TCR_DOZE_MODE BIT(17)
103
104#define PRCM_CLKOCR 0x1CC
105#define PRCM_CLKOCR_CLKODIV0_SHIFT 0 176#define PRCM_CLKOCR_CLKODIV0_SHIFT 0
106#define PRCM_CLKOCR_CLKODIV0_MASK BITS(0, 5) 177#define PRCM_CLKOCR_CLKODIV0_MASK BITS(0, 5)
107#define PRCM_CLKOCR_CLKOSEL0_SHIFT 6 178#define PRCM_CLKOCR_CLKOSEL0_SHIFT 6
@@ -112,55 +183,22 @@
112#define PRCM_CLKOCR_CLKOSEL1_MASK BITS(22, 24) 183#define PRCM_CLKOCR_CLKOSEL1_MASK BITS(22, 24)
113#define PRCM_CLKOCR_CLK1TYPE BIT(28) 184#define PRCM_CLKOCR_CLK1TYPE BIT(28)
114 185
115#define PRCM_SGACLK_MGT 0x014
116#define PRCM_UARTCLK_MGT 0x018
117#define PRCM_MSP02CLK_MGT 0x01C
118#define PRCM_MSP1CLK_MGT 0x288
119#define PRCM_I2CCLK_MGT 0x020
120#define PRCM_SDMMCCLK_MGT 0x024
121#define PRCM_SLIMCLK_MGT 0x028
122#define PRCM_PER1CLK_MGT 0x02C
123#define PRCM_PER2CLK_MGT 0x030
124#define PRCM_PER3CLK_MGT 0x034
125#define PRCM_PER5CLK_MGT 0x038
126#define PRCM_PER6CLK_MGT 0x03C
127#define PRCM_PER7CLK_MGT 0x040
128#define PRCM_LCDCLK_MGT 0x044
129#define PRCM_BMLCLK_MGT 0x04C
130#define PRCM_HSITXCLK_MGT 0x050
131#define PRCM_HSIRXCLK_MGT 0x054
132#define PRCM_HDMICLK_MGT 0x058
133#define PRCM_APEATCLK_MGT 0x05C
134#define PRCM_APETRACECLK_MGT 0x060
135#define PRCM_MCDECLK_MGT 0x064
136#define PRCM_IPI2CCLK_MGT 0x068
137#define PRCM_DSIALTCLK_MGT 0x06C
138#define PRCM_DMACLK_MGT 0x074
139#define PRCM_B2R2CLK_MGT 0x078
140#define PRCM_TVCLK_MGT 0x07C
141#define PRCM_UNIPROCLK_MGT 0x278
142#define PRCM_SSPCLK_MGT 0x280
143#define PRCM_RNGCLK_MGT 0x284
144#define PRCM_UICCCLK_MGT 0x27C
145
146#define PRCM_CLK_MGT_CLKPLLDIV_MASK BITS(0, 4) 186#define PRCM_CLK_MGT_CLKPLLDIV_MASK BITS(0, 4)
147#define PRCM_CLK_MGT_CLKPLLSW_MASK BITS(5, 7) 187#define PRCM_CLK_MGT_CLKPLLSW_MASK BITS(5, 7)
148#define PRCM_CLK_MGT_CLKEN BIT(8) 188#define PRCM_CLK_MGT_CLKEN BIT(8)
149 189
150/* ePOD and memory power signal control registers */ 190/* GPIOCR register */
151#define PRCM_EPOD_C_SET 0x410 191#define PRCM_GPIOCR_SPI2_SELECT BIT(23)
152#define PRCM_SRAM_LS_SLEEP 0x304
153 192
154/* Debug power control unit registers */ 193#define PRCM_DDR_SUBSYS_APE_MINBW (_PRCMU_BASE + 0x438)
155#define PRCM_POWER_STATE_SET 0x254 194#define PRCM_CGATING_BYPASS (_PRCMU_BASE + 0x134)
195#define PRCM_CGATING_BYPASS_ICN2 BIT(6)
156 196
157/* Miscellaneous unit registers */ 197/* Miscellaneous unit registers */
158#define PRCM_DSI_SW_RESET 0x324 198#define PRCM_RESOUTN_SET (_PRCMU_BASE + 0x214)
159#define PRCM_GPIOCR 0x138 199#define PRCM_RESOUTN_CLR (_PRCMU_BASE + 0x218)
160
161/* GPIOCR register */
162#define PRCM_GPIOCR_SPI2_SELECT BIT(23)
163 200
164#define PRCM_DDR_SUBSYS_APE_MINBW 0x438 201/* System reset register */
202#define PRCM_APE_SOFTRST (_PRCMU_BASE + 0x228)
165 203
166#endif /* __DB8500_PRCMU_REGS_H */ 204#endif /* __DB8500_PRCMU_REGS_H */
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 02a15d7cb3b0..b5bd245ca892 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -412,7 +412,7 @@ struct clk_mgt {
412 412
413static DEFINE_SPINLOCK(clk_mgt_lock); 413static DEFINE_SPINLOCK(clk_mgt_lock);
414 414
415#define CLK_MGT_ENTRY(_name)[PRCMU_##_name] = { (PRCM_##_name##_MGT), 0 } 415#define CLK_MGT_ENTRY(_name)[PRCMU_##_name] = { (PRCM_##_name##_MGT_OFF), 0 }
416struct clk_mgt clk_mgt[PRCMU_NUM_REG_CLOCKS] = { 416struct clk_mgt clk_mgt[PRCMU_NUM_REG_CLOCKS] = {
417 CLK_MGT_ENTRY(SGACLK), 417 CLK_MGT_ENTRY(SGACLK),
418 CLK_MGT_ENTRY(UARTCLK), 418 CLK_MGT_ENTRY(UARTCLK),
@@ -499,45 +499,41 @@ int prcmu_enable_dsipll(void)
499 unsigned int plldsifreq; 499 unsigned int plldsifreq;
500 500
501 /* Clear DSIPLL_RESETN */ 501 /* Clear DSIPLL_RESETN */
502 writel(PRCMU_RESET_DSIPLL, (_PRCMU_BASE + PRCM_APE_RESETN_CLR)); 502 writel(PRCMU_RESET_DSIPLL, PRCM_APE_RESETN_CLR);
503 /* Unclamp DSIPLL in/out */ 503 /* Unclamp DSIPLL in/out */
504 writel(PRCMU_UNCLAMP_DSIPLL, (_PRCMU_BASE + PRCM_MMIP_LS_CLAMP_CLR)); 504 writel(PRCMU_UNCLAMP_DSIPLL, PRCM_MMIP_LS_CLAMP_CLR);
505 505
506 if (prcmu_is_u8400()) 506 if (prcmu_is_u8400())
507 plldsifreq = PRCMU_PLLDSI_FREQ_SETTING_U8400; 507 plldsifreq = PRCMU_PLLDSI_FREQ_SETTING_U8400;
508 else 508 else
509 plldsifreq = PRCMU_PLLDSI_FREQ_SETTING; 509 plldsifreq = PRCMU_PLLDSI_FREQ_SETTING;
510 /* Set DSI PLL FREQ */ 510 /* Set DSI PLL FREQ */
511 writel(plldsifreq, (_PRCMU_BASE + PRCM_PLLDSI_FREQ)); 511 writel(plldsifreq, PRCM_PLLDSI_FREQ);
512 writel(PRCMU_DSI_PLLOUT_SEL_SETTING, 512 writel(PRCMU_DSI_PLLOUT_SEL_SETTING, PRCM_DSI_PLLOUT_SEL);
513 (_PRCMU_BASE + PRCM_DSI_PLLOUT_SEL));
514 /* Enable Escape clocks */ 513 /* Enable Escape clocks */
515 writel(PRCMU_ENABLE_ESCAPE_CLOCK_DIV, 514 writel(PRCMU_ENABLE_ESCAPE_CLOCK_DIV, PRCM_DSITVCLK_DIV);
516 (_PRCMU_BASE + PRCM_DSITVCLK_DIV));
517 515
518 /* Start DSI PLL */ 516 /* Start DSI PLL */
519 writel(PRCMU_ENABLE_PLLDSI, (_PRCMU_BASE + PRCM_PLLDSI_ENABLE)); 517 writel(PRCMU_ENABLE_PLLDSI, PRCM_PLLDSI_ENABLE);
520 /* Reset DSI PLL */ 518 /* Reset DSI PLL */
521 writel(PRCMU_DSI_RESET_SW, (_PRCMU_BASE + PRCM_DSI_SW_RESET)); 519 writel(PRCMU_DSI_RESET_SW, PRCM_DSI_SW_RESET);
522 for (i = 0; i < 10; i++) { 520 for (i = 0; i < 10; i++) {
523 if ((readl(_PRCMU_BASE + PRCM_PLLDSI_LOCKP) & 521 if ((readl(PRCM_PLLDSI_LOCKP) & PRCMU_PLLDSI_LOCKP_LOCKED)
524 PRCMU_PLLDSI_LOCKP_LOCKED)
525 == PRCMU_PLLDSI_LOCKP_LOCKED) 522 == PRCMU_PLLDSI_LOCKP_LOCKED)
526 break; 523 break;
527 udelay(100); 524 udelay(100);
528 } 525 }
529 /* Set DSIPLL_RESETN */ 526 /* Set DSIPLL_RESETN */
530 writel(PRCMU_RESET_DSIPLL, (_PRCMU_BASE + PRCM_APE_RESETN_SET)); 527 writel(PRCMU_RESET_DSIPLL, PRCM_APE_RESETN_SET);
531 return 0; 528 return 0;
532} 529}
533 530
534int prcmu_disable_dsipll(void) 531int prcmu_disable_dsipll(void)
535{ 532{
536 /* Disable dsi pll */ 533 /* Disable dsi pll */
537 writel(PRCMU_DISABLE_PLLDSI, (_PRCMU_BASE + PRCM_PLLDSI_ENABLE)); 534 writel(PRCMU_DISABLE_PLLDSI, PRCM_PLLDSI_ENABLE);
538 /* Disable escapeclock */ 535 /* Disable escapeclock */
539 writel(PRCMU_DISABLE_ESCAPE_CLOCK_DIV, 536 writel(PRCMU_DISABLE_ESCAPE_CLOCK_DIV, PRCM_DSITVCLK_DIV);
540 (_PRCMU_BASE + PRCM_DSITVCLK_DIV));
541 return 0; 537 return 0;
542} 538}
543 539
@@ -554,15 +550,15 @@ int prcmu_set_display_clocks(void)
554 spin_lock_irqsave(&clk_mgt_lock, flags); 550 spin_lock_irqsave(&clk_mgt_lock, flags);
555 551
556 /* Grab the HW semaphore. */ 552 /* Grab the HW semaphore. */
557 while ((readl(_PRCMU_BASE + PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) 553 while ((readl(PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0)
558 cpu_relax(); 554 cpu_relax();
559 555
560 writel(dsiclk, (_PRCMU_BASE + PRCM_HDMICLK_MGT)); 556 writel(dsiclk, PRCM_HDMICLK_MGT);
561 writel(PRCMU_DSI_LP_CLOCK_SETTING, (_PRCMU_BASE + PRCM_TVCLK_MGT)); 557 writel(PRCMU_DSI_LP_CLOCK_SETTING, PRCM_TVCLK_MGT);
562 writel(PRCMU_DPI_CLOCK_SETTING, (_PRCMU_BASE + PRCM_LCDCLK_MGT)); 558 writel(PRCMU_DPI_CLOCK_SETTING, PRCM_LCDCLK_MGT);
563 559
564 /* Release the HW semaphore. */ 560 /* Release the HW semaphore. */
565 writel(0, (_PRCMU_BASE + PRCM_SEM)); 561 writel(0, PRCM_SEM);
566 562
567 spin_unlock_irqrestore(&clk_mgt_lock, flags); 563 spin_unlock_irqrestore(&clk_mgt_lock, flags);
568 564
@@ -578,8 +574,8 @@ void prcmu_enable_spi2(void)
578 unsigned long flags; 574 unsigned long flags;
579 575
580 spin_lock_irqsave(&gpiocr_lock, flags); 576 spin_lock_irqsave(&gpiocr_lock, flags);
581 reg = readl(_PRCMU_BASE + PRCM_GPIOCR); 577 reg = readl(PRCM_GPIOCR);
582 writel(reg | PRCM_GPIOCR_SPI2_SELECT, _PRCMU_BASE + PRCM_GPIOCR); 578 writel(reg | PRCM_GPIOCR_SPI2_SELECT, PRCM_GPIOCR);
583 spin_unlock_irqrestore(&gpiocr_lock, flags); 579 spin_unlock_irqrestore(&gpiocr_lock, flags);
584} 580}
585 581
@@ -592,8 +588,8 @@ void prcmu_disable_spi2(void)
592 unsigned long flags; 588 unsigned long flags;
593 589
594 spin_lock_irqsave(&gpiocr_lock, flags); 590 spin_lock_irqsave(&gpiocr_lock, flags);
595 reg = readl(_PRCMU_BASE + PRCM_GPIOCR); 591 reg = readl(PRCM_GPIOCR);
596 writel(reg & ~PRCM_GPIOCR_SPI2_SELECT, _PRCMU_BASE + PRCM_GPIOCR); 592 writel(reg & ~PRCM_GPIOCR_SPI2_SELECT, PRCM_GPIOCR);
597 spin_unlock_irqrestore(&gpiocr_lock, flags); 593 spin_unlock_irqrestore(&gpiocr_lock, flags);
598} 594}
599 595
@@ -701,7 +697,7 @@ int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
701 697
702 spin_lock_irqsave(&clkout_lock, flags); 698 spin_lock_irqsave(&clkout_lock, flags);
703 699
704 val = readl(_PRCMU_BASE + PRCM_CLKOCR); 700 val = readl(PRCM_CLKOCR);
705 if (val & div_mask) { 701 if (val & div_mask) {
706 if (div) { 702 if (div) {
707 if ((val & mask) != bits) { 703 if ((val & mask) != bits) {
@@ -715,7 +711,7 @@ int prcmu_config_clkout(u8 clkout, u8 source, u8 div)
715 } 711 }
716 } 712 }
717 } 713 }
718 writel((bits | (val & ~mask)), (_PRCMU_BASE + PRCM_CLKOCR)); 714 writel((bits | (val & ~mask)), PRCM_CLKOCR);
719 requests[clkout] += (div ? 1 : -1); 715 requests[clkout] += (div ? 1 : -1);
720 716
721unlock_and_return: 717unlock_and_return:
@@ -732,7 +728,7 @@ int prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll)
732 728
733 spin_lock_irqsave(&mb0_transfer.lock, flags); 729 spin_lock_irqsave(&mb0_transfer.lock, flags);
734 730
735 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(0)) 731 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(0))
736 cpu_relax(); 732 cpu_relax();
737 733
738 writeb(MB0H_POWER_STATE_TRANS, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0)); 734 writeb(MB0H_POWER_STATE_TRANS, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0));
@@ -741,7 +737,7 @@ int prcmu_set_power_state(u8 state, bool keep_ulp_clk, bool keep_ap_pll)
741 writeb((keep_ulp_clk ? 1 : 0), 737 writeb((keep_ulp_clk ? 1 : 0),
742 (tcdm_base + PRCM_REQ_MB0_ULP_CLOCK_STATE)); 738 (tcdm_base + PRCM_REQ_MB0_ULP_CLOCK_STATE));
743 writeb(0, (tcdm_base + PRCM_REQ_MB0_DO_NOT_WFI)); 739 writeb(0, (tcdm_base + PRCM_REQ_MB0_DO_NOT_WFI));
744 writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 740 writel(MBOX_BIT(0), PRCM_MBOX_CPU_SET);
745 741
746 spin_unlock_irqrestore(&mb0_transfer.lock, flags); 742 spin_unlock_irqrestore(&mb0_transfer.lock, flags);
747 743
@@ -770,12 +766,12 @@ static void config_wakeups(void)
770 return; 766 return;
771 767
772 for (i = 0; i < 2; i++) { 768 for (i = 0; i < 2; i++) {
773 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(0)) 769 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(0))
774 cpu_relax(); 770 cpu_relax();
775 writel(dbb_events, (tcdm_base + PRCM_REQ_MB0_WAKEUP_8500)); 771 writel(dbb_events, (tcdm_base + PRCM_REQ_MB0_WAKEUP_8500));
776 writel(abb_events, (tcdm_base + PRCM_REQ_MB0_WAKEUP_4500)); 772 writel(abb_events, (tcdm_base + PRCM_REQ_MB0_WAKEUP_4500));
777 writeb(header[i], (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0)); 773 writeb(header[i], (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0));
778 writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 774 writel(MBOX_BIT(0), PRCM_MBOX_CPU_SET);
779 } 775 }
780 last_dbb_events = dbb_events; 776 last_dbb_events = dbb_events;
781 last_abb_events = abb_events; 777 last_abb_events = abb_events;
@@ -840,14 +836,14 @@ int prcmu_set_arm_opp(u8 opp)
840 836
841 mutex_lock(&mb1_transfer.lock); 837 mutex_lock(&mb1_transfer.lock);
842 838
843 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) 839 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1))
844 cpu_relax(); 840 cpu_relax();
845 841
846 writeb(MB1H_ARM_APE_OPP, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); 842 writeb(MB1H_ARM_APE_OPP, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1));
847 writeb(opp, (tcdm_base + PRCM_REQ_MB1_ARM_OPP)); 843 writeb(opp, (tcdm_base + PRCM_REQ_MB1_ARM_OPP));
848 writeb(APE_NO_CHANGE, (tcdm_base + PRCM_REQ_MB1_APE_OPP)); 844 writeb(APE_NO_CHANGE, (tcdm_base + PRCM_REQ_MB1_APE_OPP));
849 845
850 writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 846 writel(MBOX_BIT(1), PRCM_MBOX_CPU_SET);
851 wait_for_completion(&mb1_transfer.work); 847 wait_for_completion(&mb1_transfer.work);
852 848
853 if ((mb1_transfer.ack.header != MB1H_ARM_APE_OPP) || 849 if ((mb1_transfer.ack.header != MB1H_ARM_APE_OPP) ||
@@ -876,7 +872,7 @@ int prcmu_get_arm_opp(void)
876 */ 872 */
877int prcmu_get_ddr_opp(void) 873int prcmu_get_ddr_opp(void)
878{ 874{
879 return readb(_PRCMU_BASE + PRCM_DDR_SUBSYS_APE_MINBW); 875 return readb(PRCM_DDR_SUBSYS_APE_MINBW);
880} 876}
881 877
882/** 878/**
@@ -892,7 +888,7 @@ int prcmu_set_ddr_opp(u8 opp)
892 return -EINVAL; 888 return -EINVAL;
893 /* Changing the DDR OPP can hang the hardware pre-v21 */ 889 /* Changing the DDR OPP can hang the hardware pre-v21 */
894 if (cpu_is_u8500v20_or_later() && !cpu_is_u8500v20()) 890 if (cpu_is_u8500v20_or_later() && !cpu_is_u8500v20())
895 writeb(opp, (_PRCMU_BASE + PRCM_DDR_SUBSYS_APE_MINBW)); 891 writeb(opp, PRCM_DDR_SUBSYS_APE_MINBW);
896 892
897 return 0; 893 return 0;
898} 894}
@@ -909,14 +905,14 @@ int prcmu_set_ape_opp(u8 opp)
909 905
910 mutex_lock(&mb1_transfer.lock); 906 mutex_lock(&mb1_transfer.lock);
911 907
912 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) 908 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1))
913 cpu_relax(); 909 cpu_relax();
914 910
915 writeb(MB1H_ARM_APE_OPP, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); 911 writeb(MB1H_ARM_APE_OPP, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1));
916 writeb(ARM_NO_CHANGE, (tcdm_base + PRCM_REQ_MB1_ARM_OPP)); 912 writeb(ARM_NO_CHANGE, (tcdm_base + PRCM_REQ_MB1_ARM_OPP));
917 writeb(opp, (tcdm_base + PRCM_REQ_MB1_APE_OPP)); 913 writeb(opp, (tcdm_base + PRCM_REQ_MB1_APE_OPP));
918 914
919 writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 915 writel(MBOX_BIT(1), PRCM_MBOX_CPU_SET);
920 wait_for_completion(&mb1_transfer.work); 916 wait_for_completion(&mb1_transfer.work);
921 917
922 if ((mb1_transfer.ack.header != MB1H_ARM_APE_OPP) || 918 if ((mb1_transfer.ack.header != MB1H_ARM_APE_OPP) ||
@@ -966,12 +962,12 @@ int prcmu_request_ape_opp_100_voltage(bool enable)
966 header = MB1H_RELEASE_APE_OPP_100_VOLT; 962 header = MB1H_RELEASE_APE_OPP_100_VOLT;
967 } 963 }
968 964
969 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) 965 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1))
970 cpu_relax(); 966 cpu_relax();
971 967
972 writeb(header, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); 968 writeb(header, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1));
973 969
974 writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 970 writel(MBOX_BIT(1), PRCM_MBOX_CPU_SET);
975 wait_for_completion(&mb1_transfer.work); 971 wait_for_completion(&mb1_transfer.work);
976 972
977 if ((mb1_transfer.ack.header != header) || 973 if ((mb1_transfer.ack.header != header) ||
@@ -995,13 +991,13 @@ int prcmu_release_usb_wakeup_state(void)
995 991
996 mutex_lock(&mb1_transfer.lock); 992 mutex_lock(&mb1_transfer.lock);
997 993
998 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) 994 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1))
999 cpu_relax(); 995 cpu_relax();
1000 996
1001 writeb(MB1H_RELEASE_USB_WAKEUP, 997 writeb(MB1H_RELEASE_USB_WAKEUP,
1002 (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); 998 (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1));
1003 999
1004 writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1000 writel(MBOX_BIT(1), PRCM_MBOX_CPU_SET);
1005 wait_for_completion(&mb1_transfer.work); 1001 wait_for_completion(&mb1_transfer.work);
1006 1002
1007 if ((mb1_transfer.ack.header != MB1H_RELEASE_USB_WAKEUP) || 1003 if ((mb1_transfer.ack.header != MB1H_RELEASE_USB_WAKEUP) ||
@@ -1048,7 +1044,7 @@ int prcmu_set_epod(u16 epod_id, u8 epod_state)
1048 mutex_lock(&mb2_transfer.lock); 1044 mutex_lock(&mb2_transfer.lock);
1049 1045
1050 /* wait for mailbox */ 1046 /* wait for mailbox */
1051 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(2)) 1047 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(2))
1052 cpu_relax(); 1048 cpu_relax();
1053 1049
1054 /* fill in mailbox */ 1050 /* fill in mailbox */
@@ -1058,7 +1054,7 @@ int prcmu_set_epod(u16 epod_id, u8 epod_state)
1058 1054
1059 writeb(MB2H_DPS, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB2)); 1055 writeb(MB2H_DPS, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB2));
1060 1056
1061 writel(MBOX_BIT(2), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1057 writel(MBOX_BIT(2), PRCM_MBOX_CPU_SET);
1062 1058
1063 /* 1059 /*
1064 * The current firmware version does not handle errors correctly, 1060 * The current firmware version does not handle errors correctly,
@@ -1145,13 +1141,13 @@ static int request_sysclk(bool enable)
1145 1141
1146 spin_lock_irqsave(&mb3_transfer.lock, flags); 1142 spin_lock_irqsave(&mb3_transfer.lock, flags);
1147 1143
1148 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(3)) 1144 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(3))
1149 cpu_relax(); 1145 cpu_relax();
1150 1146
1151 writeb((enable ? ON : OFF), (tcdm_base + PRCM_REQ_MB3_SYSCLK_MGT)); 1147 writeb((enable ? ON : OFF), (tcdm_base + PRCM_REQ_MB3_SYSCLK_MGT));
1152 1148
1153 writeb(MB3H_SYSCLK, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB3)); 1149 writeb(MB3H_SYSCLK, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB3));
1154 writel(MBOX_BIT(3), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1150 writel(MBOX_BIT(3), PRCM_MBOX_CPU_SET);
1155 1151
1156 spin_unlock_irqrestore(&mb3_transfer.lock, flags); 1152 spin_unlock_irqrestore(&mb3_transfer.lock, flags);
1157 1153
@@ -1177,7 +1173,7 @@ static int request_timclk(bool enable)
1177 1173
1178 if (!enable) 1174 if (!enable)
1179 val |= PRCM_TCR_STOP_TIMERS; 1175 val |= PRCM_TCR_STOP_TIMERS;
1180 writel(val, (_PRCMU_BASE + PRCM_TCR)); 1176 writel(val, PRCM_TCR);
1181 1177
1182 return 0; 1178 return 0;
1183} 1179}
@@ -1190,7 +1186,7 @@ static int request_reg_clock(u8 clock, bool enable)
1190 spin_lock_irqsave(&clk_mgt_lock, flags); 1186 spin_lock_irqsave(&clk_mgt_lock, flags);
1191 1187
1192 /* Grab the HW semaphore. */ 1188 /* Grab the HW semaphore. */
1193 while ((readl(_PRCMU_BASE + PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) 1189 while ((readl(PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0)
1194 cpu_relax(); 1190 cpu_relax();
1195 1191
1196 val = readl(_PRCMU_BASE + clk_mgt[clock].offset); 1192 val = readl(_PRCMU_BASE + clk_mgt[clock].offset);
@@ -1203,7 +1199,7 @@ static int request_reg_clock(u8 clock, bool enable)
1203 writel(val, (_PRCMU_BASE + clk_mgt[clock].offset)); 1199 writel(val, (_PRCMU_BASE + clk_mgt[clock].offset));
1204 1200
1205 /* Release the HW semaphore. */ 1201 /* Release the HW semaphore. */
1206 writel(0, (_PRCMU_BASE + PRCM_SEM)); 1202 writel(0, PRCM_SEM);
1207 1203
1208 spin_unlock_irqrestore(&clk_mgt_lock, flags); 1204 spin_unlock_irqrestore(&clk_mgt_lock, flags);
1209 1205
@@ -1238,7 +1234,7 @@ int prcmu_config_esram0_deep_sleep(u8 state)
1238 1234
1239 mutex_lock(&mb4_transfer.lock); 1235 mutex_lock(&mb4_transfer.lock);
1240 1236
1241 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) 1237 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(4))
1242 cpu_relax(); 1238 cpu_relax();
1243 1239
1244 writeb(MB4H_MEM_ST, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); 1240 writeb(MB4H_MEM_ST, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4));
@@ -1248,7 +1244,7 @@ int prcmu_config_esram0_deep_sleep(u8 state)
1248 (tcdm_base + PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE)); 1244 (tcdm_base + PRCM_REQ_MB4_DDR_ST_AP_DEEP_IDLE));
1249 writeb(state, (tcdm_base + PRCM_REQ_MB4_ESRAM0_ST)); 1245 writeb(state, (tcdm_base + PRCM_REQ_MB4_ESRAM0_ST));
1250 1246
1251 writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1247 writel(MBOX_BIT(4), PRCM_MBOX_CPU_SET);
1252 wait_for_completion(&mb4_transfer.work); 1248 wait_for_completion(&mb4_transfer.work);
1253 1249
1254 mutex_unlock(&mb4_transfer.lock); 1250 mutex_unlock(&mb4_transfer.lock);
@@ -1260,13 +1256,13 @@ int prcmu_config_hotdog(u8 threshold)
1260{ 1256{
1261 mutex_lock(&mb4_transfer.lock); 1257 mutex_lock(&mb4_transfer.lock);
1262 1258
1263 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) 1259 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(4))
1264 cpu_relax(); 1260 cpu_relax();
1265 1261
1266 writeb(threshold, (tcdm_base + PRCM_REQ_MB4_HOTDOG_THRESHOLD)); 1262 writeb(threshold, (tcdm_base + PRCM_REQ_MB4_HOTDOG_THRESHOLD));
1267 writeb(MB4H_HOTDOG, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); 1263 writeb(MB4H_HOTDOG, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4));
1268 1264
1269 writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1265 writel(MBOX_BIT(4), PRCM_MBOX_CPU_SET);
1270 wait_for_completion(&mb4_transfer.work); 1266 wait_for_completion(&mb4_transfer.work);
1271 1267
1272 mutex_unlock(&mb4_transfer.lock); 1268 mutex_unlock(&mb4_transfer.lock);
@@ -1278,7 +1274,7 @@ int prcmu_config_hotmon(u8 low, u8 high)
1278{ 1274{
1279 mutex_lock(&mb4_transfer.lock); 1275 mutex_lock(&mb4_transfer.lock);
1280 1276
1281 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) 1277 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(4))
1282 cpu_relax(); 1278 cpu_relax();
1283 1279
1284 writeb(low, (tcdm_base + PRCM_REQ_MB4_HOTMON_LOW)); 1280 writeb(low, (tcdm_base + PRCM_REQ_MB4_HOTMON_LOW));
@@ -1287,7 +1283,7 @@ int prcmu_config_hotmon(u8 low, u8 high)
1287 (tcdm_base + PRCM_REQ_MB4_HOTMON_CONFIG)); 1283 (tcdm_base + PRCM_REQ_MB4_HOTMON_CONFIG));
1288 writeb(MB4H_HOTMON, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); 1284 writeb(MB4H_HOTMON, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4));
1289 1285
1290 writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1286 writel(MBOX_BIT(4), PRCM_MBOX_CPU_SET);
1291 wait_for_completion(&mb4_transfer.work); 1287 wait_for_completion(&mb4_transfer.work);
1292 1288
1293 mutex_unlock(&mb4_transfer.lock); 1289 mutex_unlock(&mb4_transfer.lock);
@@ -1299,13 +1295,13 @@ static int config_hot_period(u16 val)
1299{ 1295{
1300 mutex_lock(&mb4_transfer.lock); 1296 mutex_lock(&mb4_transfer.lock);
1301 1297
1302 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(4)) 1298 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(4))
1303 cpu_relax(); 1299 cpu_relax();
1304 1300
1305 writew(val, (tcdm_base + PRCM_REQ_MB4_HOT_PERIOD)); 1301 writew(val, (tcdm_base + PRCM_REQ_MB4_HOT_PERIOD));
1306 writeb(MB4H_HOT_PERIOD, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4)); 1302 writeb(MB4H_HOT_PERIOD, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB4));
1307 1303
1308 writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1304 writel(MBOX_BIT(4), PRCM_MBOX_CPU_SET);
1309 wait_for_completion(&mb4_transfer.work); 1305 wait_for_completion(&mb4_transfer.work);
1310 1306
1311 mutex_unlock(&mb4_transfer.lock); 1307 mutex_unlock(&mb4_transfer.lock);
@@ -1345,7 +1341,7 @@ int prcmu_set_clock_divider(u8 clock, u8 divider)
1345 spin_lock_irqsave(&clk_mgt_lock, flags); 1341 spin_lock_irqsave(&clk_mgt_lock, flags);
1346 1342
1347 /* Grab the HW semaphore. */ 1343 /* Grab the HW semaphore. */
1348 while ((readl(_PRCMU_BASE + PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0) 1344 while ((readl(PRCM_SEM) & PRCM_SEM_PRCM_SEM) != 0)
1349 cpu_relax(); 1345 cpu_relax();
1350 1346
1351 val = readl(_PRCMU_BASE + clk_mgt[clock].offset); 1347 val = readl(_PRCMU_BASE + clk_mgt[clock].offset);
@@ -1354,7 +1350,7 @@ int prcmu_set_clock_divider(u8 clock, u8 divider)
1354 writel(val, (_PRCMU_BASE + clk_mgt[clock].offset)); 1350 writel(val, (_PRCMU_BASE + clk_mgt[clock].offset));
1355 1351
1356 /* Release the HW semaphore. */ 1352 /* Release the HW semaphore. */
1357 writel(0, (_PRCMU_BASE + PRCM_SEM)); 1353 writel(0, PRCM_SEM);
1358 1354
1359 spin_unlock_irqrestore(&clk_mgt_lock, flags); 1355 spin_unlock_irqrestore(&clk_mgt_lock, flags);
1360 1356
@@ -1380,7 +1376,7 @@ int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
1380 1376
1381 mutex_lock(&mb5_transfer.lock); 1377 mutex_lock(&mb5_transfer.lock);
1382 1378
1383 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) 1379 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(5))
1384 cpu_relax(); 1380 cpu_relax();
1385 1381
1386 writeb(PRCMU_I2C_READ(slave), (tcdm_base + PRCM_REQ_MB5_I2C_SLAVE_OP)); 1382 writeb(PRCMU_I2C_READ(slave), (tcdm_base + PRCM_REQ_MB5_I2C_SLAVE_OP));
@@ -1388,7 +1384,7 @@ int prcmu_abb_read(u8 slave, u8 reg, u8 *value, u8 size)
1388 writeb(reg, (tcdm_base + PRCM_REQ_MB5_I2C_REG)); 1384 writeb(reg, (tcdm_base + PRCM_REQ_MB5_I2C_REG));
1389 writeb(0, (tcdm_base + PRCM_REQ_MB5_I2C_VAL)); 1385 writeb(0, (tcdm_base + PRCM_REQ_MB5_I2C_VAL));
1390 1386
1391 writel(MBOX_BIT(5), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1387 writel(MBOX_BIT(5), PRCM_MBOX_CPU_SET);
1392 1388
1393 if (!wait_for_completion_timeout(&mb5_transfer.work, 1389 if (!wait_for_completion_timeout(&mb5_transfer.work,
1394 msecs_to_jiffies(20000))) { 1390 msecs_to_jiffies(20000))) {
@@ -1426,7 +1422,7 @@ int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
1426 1422
1427 mutex_lock(&mb5_transfer.lock); 1423 mutex_lock(&mb5_transfer.lock);
1428 1424
1429 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(5)) 1425 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(5))
1430 cpu_relax(); 1426 cpu_relax();
1431 1427
1432 writeb(PRCMU_I2C_WRITE(slave), (tcdm_base + PRCM_REQ_MB5_I2C_SLAVE_OP)); 1428 writeb(PRCMU_I2C_WRITE(slave), (tcdm_base + PRCM_REQ_MB5_I2C_SLAVE_OP));
@@ -1434,7 +1430,7 @@ int prcmu_abb_write(u8 slave, u8 reg, u8 *value, u8 size)
1434 writeb(reg, (tcdm_base + PRCM_REQ_MB5_I2C_REG)); 1430 writeb(reg, (tcdm_base + PRCM_REQ_MB5_I2C_REG));
1435 writeb(*value, (tcdm_base + PRCM_REQ_MB5_I2C_VAL)); 1431 writeb(*value, (tcdm_base + PRCM_REQ_MB5_I2C_VAL));
1436 1432
1437 writel(MBOX_BIT(5), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1433 writel(MBOX_BIT(5), PRCM_MBOX_CPU_SET);
1438 1434
1439 if (!wait_for_completion_timeout(&mb5_transfer.work, 1435 if (!wait_for_completion_timeout(&mb5_transfer.work,
1440 msecs_to_jiffies(20000))) { 1436 msecs_to_jiffies(20000))) {
@@ -1459,14 +1455,13 @@ void prcmu_ac_wake_req(void)
1459 1455
1460 mutex_lock(&mb0_transfer.ac_wake_lock); 1456 mutex_lock(&mb0_transfer.ac_wake_lock);
1461 1457
1462 val = readl(_PRCMU_BASE + PRCM_HOSTACCESS_REQ); 1458 val = readl(PRCM_HOSTACCESS_REQ);
1463 if (val & PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ) 1459 if (val & PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ)
1464 goto unlock_and_return; 1460 goto unlock_and_return;
1465 1461
1466 atomic_set(&ac_wake_req_state, 1); 1462 atomic_set(&ac_wake_req_state, 1);
1467 1463
1468 writel((val | PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ), 1464 writel((val | PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ), PRCM_HOSTACCESS_REQ);
1469 (_PRCMU_BASE + PRCM_HOSTACCESS_REQ));
1470 1465
1471 if (!wait_for_completion_timeout(&mb0_transfer.ac_wake_work, 1466 if (!wait_for_completion_timeout(&mb0_transfer.ac_wake_work,
1472 msecs_to_jiffies(20000))) { 1467 msecs_to_jiffies(20000))) {
@@ -1487,12 +1482,12 @@ void prcmu_ac_sleep_req()
1487 1482
1488 mutex_lock(&mb0_transfer.ac_wake_lock); 1483 mutex_lock(&mb0_transfer.ac_wake_lock);
1489 1484
1490 val = readl(_PRCMU_BASE + PRCM_HOSTACCESS_REQ); 1485 val = readl(PRCM_HOSTACCESS_REQ);
1491 if (!(val & PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ)) 1486 if (!(val & PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ))
1492 goto unlock_and_return; 1487 goto unlock_and_return;
1493 1488
1494 writel((val & ~PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ), 1489 writel((val & ~PRCM_HOSTACCESS_REQ_HOSTACCESS_REQ),
1495 (_PRCMU_BASE + PRCM_HOSTACCESS_REQ)); 1490 PRCM_HOSTACCESS_REQ);
1496 1491
1497 if (!wait_for_completion_timeout(&mb0_transfer.ac_wake_work, 1492 if (!wait_for_completion_timeout(&mb0_transfer.ac_wake_work,
1498 msecs_to_jiffies(20000))) { 1493 msecs_to_jiffies(20000))) {
@@ -1520,7 +1515,7 @@ bool prcmu_is_ac_wake_requested(void)
1520void prcmu_system_reset(u16 reset_code) 1515void prcmu_system_reset(u16 reset_code)
1521{ 1516{
1522 writew(reset_code, (tcdm_base + PRCM_SW_RST_REASON)); 1517 writew(reset_code, (tcdm_base + PRCM_SW_RST_REASON));
1523 writel(1, (_PRCMU_BASE + PRCM_APE_SOFTRST)); 1518 writel(1, PRCM_APE_SOFTRST);
1524} 1519}
1525 1520
1526/** 1521/**
@@ -1530,11 +1525,11 @@ void prcmu_modem_reset(void)
1530{ 1525{
1531 mutex_lock(&mb1_transfer.lock); 1526 mutex_lock(&mb1_transfer.lock);
1532 1527
1533 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(1)) 1528 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(1))
1534 cpu_relax(); 1529 cpu_relax();
1535 1530
1536 writeb(MB1H_RESET_MODEM, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1)); 1531 writeb(MB1H_RESET_MODEM, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB1));
1537 writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1532 writel(MBOX_BIT(1), PRCM_MBOX_CPU_SET);
1538 wait_for_completion(&mb1_transfer.work); 1533 wait_for_completion(&mb1_transfer.work);
1539 1534
1540 /* 1535 /*
@@ -1551,11 +1546,11 @@ static void ack_dbb_wakeup(void)
1551 1546
1552 spin_lock_irqsave(&mb0_transfer.lock, flags); 1547 spin_lock_irqsave(&mb0_transfer.lock, flags);
1553 1548
1554 while (readl(_PRCMU_BASE + PRCM_MBOX_CPU_VAL) & MBOX_BIT(0)) 1549 while (readl(PRCM_MBOX_CPU_VAL) & MBOX_BIT(0))
1555 cpu_relax(); 1550 cpu_relax();
1556 1551
1557 writeb(MB0H_READ_WAKEUP_ACK, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0)); 1552 writeb(MB0H_READ_WAKEUP_ACK, (tcdm_base + PRCM_MBOX_HEADER_REQ_MB0));
1558 writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_MBOX_CPU_SET)); 1553 writel(MBOX_BIT(0), PRCM_MBOX_CPU_SET);
1559 1554
1560 spin_unlock_irqrestore(&mb0_transfer.lock, flags); 1555 spin_unlock_irqrestore(&mb0_transfer.lock, flags);
1561} 1556}
@@ -1600,7 +1595,7 @@ static bool read_mailbox_0(void)
1600 r = false; 1595 r = false;
1601 break; 1596 break;
1602 } 1597 }
1603 writel(MBOX_BIT(0), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1598 writel(MBOX_BIT(0), PRCM_ARM_IT1_CLR);
1604 return r; 1599 return r;
1605} 1600}
1606 1601
@@ -1613,7 +1608,7 @@ static bool read_mailbox_1(void)
1613 PRCM_ACK_MB1_CURRENT_APE_OPP); 1608 PRCM_ACK_MB1_CURRENT_APE_OPP);
1614 mb1_transfer.ack.ape_voltage_status = readb(tcdm_base + 1609 mb1_transfer.ack.ape_voltage_status = readb(tcdm_base +
1615 PRCM_ACK_MB1_APE_VOLTAGE_STATUS); 1610 PRCM_ACK_MB1_APE_VOLTAGE_STATUS);
1616 writel(MBOX_BIT(1), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1611 writel(MBOX_BIT(1), PRCM_ARM_IT1_CLR);
1617 complete(&mb1_transfer.work); 1612 complete(&mb1_transfer.work);
1618 return false; 1613 return false;
1619} 1614}
@@ -1621,14 +1616,14 @@ static bool read_mailbox_1(void)
1621static bool read_mailbox_2(void) 1616static bool read_mailbox_2(void)
1622{ 1617{
1623 mb2_transfer.ack.status = readb(tcdm_base + PRCM_ACK_MB2_DPS_STATUS); 1618 mb2_transfer.ack.status = readb(tcdm_base + PRCM_ACK_MB2_DPS_STATUS);
1624 writel(MBOX_BIT(2), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1619 writel(MBOX_BIT(2), PRCM_ARM_IT1_CLR);
1625 complete(&mb2_transfer.work); 1620 complete(&mb2_transfer.work);
1626 return false; 1621 return false;
1627} 1622}
1628 1623
1629static bool read_mailbox_3(void) 1624static bool read_mailbox_3(void)
1630{ 1625{
1631 writel(MBOX_BIT(3), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1626 writel(MBOX_BIT(3), PRCM_ARM_IT1_CLR);
1632 return false; 1627 return false;
1633} 1628}
1634 1629
@@ -1650,7 +1645,7 @@ static bool read_mailbox_4(void)
1650 break; 1645 break;
1651 } 1646 }
1652 1647
1653 writel(MBOX_BIT(4), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1648 writel(MBOX_BIT(4), PRCM_ARM_IT1_CLR);
1654 1649
1655 if (do_complete) 1650 if (do_complete)
1656 complete(&mb4_transfer.work); 1651 complete(&mb4_transfer.work);
@@ -1662,20 +1657,20 @@ static bool read_mailbox_5(void)
1662{ 1657{
1663 mb5_transfer.ack.status = readb(tcdm_base + PRCM_ACK_MB5_I2C_STATUS); 1658 mb5_transfer.ack.status = readb(tcdm_base + PRCM_ACK_MB5_I2C_STATUS);
1664 mb5_transfer.ack.value = readb(tcdm_base + PRCM_ACK_MB5_I2C_VAL); 1659 mb5_transfer.ack.value = readb(tcdm_base + PRCM_ACK_MB5_I2C_VAL);
1665 writel(MBOX_BIT(5), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1660 writel(MBOX_BIT(5), PRCM_ARM_IT1_CLR);
1666 complete(&mb5_transfer.work); 1661 complete(&mb5_transfer.work);
1667 return false; 1662 return false;
1668} 1663}
1669 1664
1670static bool read_mailbox_6(void) 1665static bool read_mailbox_6(void)
1671{ 1666{
1672 writel(MBOX_BIT(6), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1667 writel(MBOX_BIT(6), PRCM_ARM_IT1_CLR);
1673 return false; 1668 return false;
1674} 1669}
1675 1670
1676static bool read_mailbox_7(void) 1671static bool read_mailbox_7(void)
1677{ 1672{
1678 writel(MBOX_BIT(7), (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 1673 writel(MBOX_BIT(7), PRCM_ARM_IT1_CLR);
1679 return false; 1674 return false;
1680} 1675}
1681 1676
@@ -1696,7 +1691,7 @@ static irqreturn_t prcmu_irq_handler(int irq, void *data)
1696 u8 n; 1691 u8 n;
1697 irqreturn_t r; 1692 irqreturn_t r;
1698 1693
1699 bits = (readl(_PRCMU_BASE + PRCM_ARM_IT1_VAL) & ALL_MBOX_BITS); 1694 bits = (readl(PRCM_ARM_IT1_VAL) & ALL_MBOX_BITS);
1700 if (unlikely(!bits)) 1695 if (unlikely(!bits))
1701 return IRQ_NONE; 1696 return IRQ_NONE;
1702 1697
@@ -2025,7 +2020,7 @@ static int __init db8500_prcmu_probe(struct platform_device *pdev)
2025 return -ENODEV; 2020 return -ENODEV;
2026 2021
2027 /* Clean up the mailbox interrupts after pre-kernel code. */ 2022 /* Clean up the mailbox interrupts after pre-kernel code. */
2028 writel(ALL_MBOX_BITS, (_PRCMU_BASE + PRCM_ARM_IT1_CLR)); 2023 writel(ALL_MBOX_BITS, PRCM_ARM_IT1_CLR);
2029 2024
2030 err = request_threaded_irq(IRQ_DB8500_PRCMU1, prcmu_irq_handler, 2025 err = request_threaded_irq(IRQ_DB8500_PRCMU1, prcmu_irq_handler,
2031 prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL); 2026 prcmu_irq_thread_fn, IRQF_NO_SUSPEND, "prcmu", NULL);