aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-09-21 00:16:30 -0400
committerOlof Johansson <olof@lixom.net>2012-09-21 00:16:30 -0400
commitb74aae9a2074e1caa2e40bf119f3a633f77c94e4 (patch)
treeba465514cff017a3213e65556674c68be5db29f6 /arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c
parent5698bd757d55b1bb87edd1a9744ab09c142abfc2 (diff)
parentb97ba3ab4e8ec88164a47c98c91955e90ecd7c6a (diff)
Merge branch 'next/cleanup' into next/multiplatform
* next/cleanup: (358 commits) ARM: tegra: harmony: fix ldo7 regulator-name ARM: OMAP2+: Make omap4-keypad.h local ARM: OMAP2+: Make l4_3xxx.h local ARM: OMAP2+: Make l4_2xxx.h local ARM: OMAP2+: Make l3_3xxx.h local ARM: OMAP2+: Make l3_2xxx.h local ARM: OMAP1: Move irda.h from plat to mach ARM: OMAP2+: Make hdq1w.h local ARM: OMAP2+: Make gpmc-smsc911x.h local ARM: OMAP2+: Make gpmc-smc91x.h local ARM: OMAP1: Move flash.h from plat to mach ARM: OMAP2+: Make debug-devices.h local ARM: OMAP1: Move board-voiceblue.h from plat to mach ARM: OMAP1: Move board-sx1.h from plat to mach ARM: OMAP2+: Make omap-wakeupgen.h local ARM: OMAP2+: Make omap-secure.h local ARM: OMAP2+: Make ctrl_module_wkup_44xx.h local ARM: OMAP2+: Make ctrl_module_pad_wkup_44xx.h local ARM: OMAP2+: Make ctrl_module_pad_core_44xx.h local ARM: OMAP2+: Make ctrl_module_core_44xx.h local ...
Diffstat (limited to 'arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c')
-rw-r--r--arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c90
1 files changed, 40 insertions, 50 deletions
diff --git a/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c b/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c
index 367df75d4bb3..8377d8054168 100644
--- a/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c
+++ b/arch/arm/mach-bcmring/csp/chipc/chipcHw_init.c
@@ -26,15 +26,15 @@
26 26
27/* ---- Include Files ---------------------------------------------------- */ 27/* ---- Include Files ---------------------------------------------------- */
28 28
29#include <csp/errno.h> 29#include <linux/errno.h>
30#include <csp/stdint.h> 30#include <linux/types.h>
31#include <csp/module.h> 31#include <linux/export.h>
32 32
33#include <mach/csp/chipcHw_def.h> 33#include <mach/csp/chipcHw_def.h>
34#include <mach/csp/chipcHw_inline.h> 34#include <mach/csp/chipcHw_inline.h>
35 35
36#include <csp/reg.h> 36#include <mach/csp/reg.h>
37#include <csp/delay.h> 37#include <linux/delay.h>
38/* ---- Private Constants and Types --------------------------------------- */ 38/* ---- Private Constants and Types --------------------------------------- */
39 39
40/* 40/*
@@ -73,9 +73,9 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz)
73 73
74 { 74 {
75 REG_LOCAL_IRQ_SAVE; 75 REG_LOCAL_IRQ_SAVE;
76 pChipcHw->PLLConfig2 = 76 writel(chipcHw_REG_PLL_CONFIG_D_RESET |
77 chipcHw_REG_PLL_CONFIG_D_RESET | 77 chipcHw_REG_PLL_CONFIG_A_RESET,
78 chipcHw_REG_PLL_CONFIG_A_RESET; 78 &pChipcHw->PLLConfig2);
79 79
80 pllPreDivider2 = chipcHw_REG_PLL_PREDIVIDER_POWER_DOWN | 80 pllPreDivider2 = chipcHw_REG_PLL_PREDIVIDER_POWER_DOWN |
81 chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER | 81 chipcHw_REG_PLL_PREDIVIDER_NDIV_MODE_INTEGER |
@@ -87,28 +87,30 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz)
87 chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT); 87 chipcHw_REG_PLL_PREDIVIDER_P2_SHIFT);
88 88
89 /* Enable CHIPC registers to control the PLL */ 89 /* Enable CHIPC registers to control the PLL */
90 pChipcHw->PLLStatus |= chipcHw_REG_PLL_STATUS_CONTROL_ENABLE; 90 writel(readl(&pChipcHw->PLLStatus) | chipcHw_REG_PLL_STATUS_CONTROL_ENABLE, &pChipcHw->PLLStatus);
91 91
92 /* Set pre divider to get desired VCO frequency */ 92 /* Set pre divider to get desired VCO frequency */
93 pChipcHw->PLLPreDivider2 = pllPreDivider2; 93 writel(pllPreDivider2, &pChipcHw->PLLPreDivider2);
94 /* Set NDIV Frac */ 94 /* Set NDIV Frac */
95 pChipcHw->PLLDivider2 = chipcHw_REG_PLL_DIVIDER_NDIV_f; 95 writel(chipcHw_REG_PLL_DIVIDER_NDIV_f, &pChipcHw->PLLDivider2);
96 96
97 /* This has to be removed once the default values are fixed for PLL2. */ 97 /* This has to be removed once the default values are fixed for PLL2. */
98 pChipcHw->PLLControl12 = 0x38000700; 98 writel(0x38000700, &pChipcHw->PLLControl12);
99 pChipcHw->PLLControl22 = 0x00000015; 99 writel(0x00000015, &pChipcHw->PLLControl22);
100 100
101 /* Reset PLL2 */ 101 /* Reset PLL2 */
102 if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) { 102 if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) {
103 pChipcHw->PLLConfig2 = chipcHw_REG_PLL_CONFIG_D_RESET | 103 writel(chipcHw_REG_PLL_CONFIG_D_RESET |
104 chipcHw_REG_PLL_CONFIG_A_RESET | 104 chipcHw_REG_PLL_CONFIG_A_RESET |
105 chipcHw_REG_PLL_CONFIG_VCO_1601_3200 | 105 chipcHw_REG_PLL_CONFIG_VCO_1601_3200 |
106 chipcHw_REG_PLL_CONFIG_POWER_DOWN; 106 chipcHw_REG_PLL_CONFIG_POWER_DOWN,
107 &pChipcHw->PLLConfig2);
107 } else { 108 } else {
108 pChipcHw->PLLConfig2 = chipcHw_REG_PLL_CONFIG_D_RESET | 109 writel(chipcHw_REG_PLL_CONFIG_D_RESET |
109 chipcHw_REG_PLL_CONFIG_A_RESET | 110 chipcHw_REG_PLL_CONFIG_A_RESET |
110 chipcHw_REG_PLL_CONFIG_VCO_800_1600 | 111 chipcHw_REG_PLL_CONFIG_VCO_800_1600 |
111 chipcHw_REG_PLL_CONFIG_POWER_DOWN; 112 chipcHw_REG_PLL_CONFIG_POWER_DOWN,
113 &pChipcHw->PLLConfig2);
112 } 114 }
113 REG_LOCAL_IRQ_RESTORE; 115 REG_LOCAL_IRQ_RESTORE;
114 } 116 }
@@ -119,22 +121,25 @@ void chipcHw_pll2Enable(uint32_t vcoFreqHz)
119 { 121 {
120 REG_LOCAL_IRQ_SAVE; 122 REG_LOCAL_IRQ_SAVE;
121 /* Remove analog reset and Power on the PLL */ 123 /* Remove analog reset and Power on the PLL */
122 pChipcHw->PLLConfig2 &= 124 writel(readl(&pChipcHw->PLLConfig2) &
123 ~(chipcHw_REG_PLL_CONFIG_A_RESET | 125 ~(chipcHw_REG_PLL_CONFIG_A_RESET |
124 chipcHw_REG_PLL_CONFIG_POWER_DOWN); 126 chipcHw_REG_PLL_CONFIG_POWER_DOWN),
127 &pChipcHw->PLLConfig2);
125 128
126 REG_LOCAL_IRQ_RESTORE; 129 REG_LOCAL_IRQ_RESTORE;
127 130
128 } 131 }
129 132
130 /* Wait until PLL is locked */ 133 /* Wait until PLL is locked */
131 while (!(pChipcHw->PLLStatus2 & chipcHw_REG_PLL_STATUS_LOCKED)) 134 while (!(readl(&pChipcHw->PLLStatus2) & chipcHw_REG_PLL_STATUS_LOCKED))
132 ; 135 ;
133 136
134 { 137 {
135 REG_LOCAL_IRQ_SAVE; 138 REG_LOCAL_IRQ_SAVE;
136 /* Remove digital reset */ 139 /* Remove digital reset */
137 pChipcHw->PLLConfig2 &= ~chipcHw_REG_PLL_CONFIG_D_RESET; 140 writel(readl(&pChipcHw->PLLConfig2) &
141 ~chipcHw_REG_PLL_CONFIG_D_RESET,
142 &pChipcHw->PLLConfig2);
138 143
139 REG_LOCAL_IRQ_RESTORE; 144 REG_LOCAL_IRQ_RESTORE;
140 } 145 }
@@ -157,9 +162,9 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport)
157 { 162 {
158 REG_LOCAL_IRQ_SAVE; 163 REG_LOCAL_IRQ_SAVE;
159 164
160 pChipcHw->PLLConfig = 165 writel(chipcHw_REG_PLL_CONFIG_D_RESET |
161 chipcHw_REG_PLL_CONFIG_D_RESET | 166 chipcHw_REG_PLL_CONFIG_A_RESET,
162 chipcHw_REG_PLL_CONFIG_A_RESET; 167 &pChipcHw->PLLConfig);
163 /* Setting VCO frequency */ 168 /* Setting VCO frequency */
164 if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) { 169 if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) {
165 pllPreDivider = 170 pllPreDivider =
@@ -182,30 +187,22 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport)
182 } 187 }
183 188
184 /* Enable CHIPC registers to control the PLL */ 189 /* Enable CHIPC registers to control the PLL */
185 pChipcHw->PLLStatus |= chipcHw_REG_PLL_STATUS_CONTROL_ENABLE; 190 writel(readl(&pChipcHw->PLLStatus) | chipcHw_REG_PLL_STATUS_CONTROL_ENABLE, &pChipcHw->PLLStatus);
186 191
187 /* Set pre divider to get desired VCO frequency */ 192 /* Set pre divider to get desired VCO frequency */
188 pChipcHw->PLLPreDivider = pllPreDivider; 193 writel(pllPreDivider, &pChipcHw->PLLPreDivider);
189 /* Set NDIV Frac */ 194 /* Set NDIV Frac */
190 if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) { 195 if (ssSupport == chipcHw_SPREAD_SPECTRUM_ALLOW) {
191 pChipcHw->PLLDivider = chipcHw_REG_PLL_DIVIDER_M1DIV | 196 writel(chipcHw_REG_PLL_DIVIDER_M1DIV | chipcHw_REG_PLL_DIVIDER_NDIV_f_SS, &pChipcHw->PLLDivider);
192 chipcHw_REG_PLL_DIVIDER_NDIV_f_SS;
193 } else { 197 } else {
194 pChipcHw->PLLDivider = chipcHw_REG_PLL_DIVIDER_M1DIV | 198 writel(chipcHw_REG_PLL_DIVIDER_M1DIV | chipcHw_REG_PLL_DIVIDER_NDIV_f, &pChipcHw->PLLDivider);
195 chipcHw_REG_PLL_DIVIDER_NDIV_f;
196 } 199 }
197 200
198 /* Reset PLL1 */ 201 /* Reset PLL1 */
199 if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) { 202 if (vcoFreqHz > chipcHw_REG_PLL_CONFIG_VCO_SPLIT_FREQ) {
200 pChipcHw->PLLConfig = chipcHw_REG_PLL_CONFIG_D_RESET | 203 writel(chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_VCO_1601_3200 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, &pChipcHw->PLLConfig);
201 chipcHw_REG_PLL_CONFIG_A_RESET |
202 chipcHw_REG_PLL_CONFIG_VCO_1601_3200 |
203 chipcHw_REG_PLL_CONFIG_POWER_DOWN;
204 } else { 204 } else {
205 pChipcHw->PLLConfig = chipcHw_REG_PLL_CONFIG_D_RESET | 205 writel(chipcHw_REG_PLL_CONFIG_D_RESET | chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_VCO_800_1600 | chipcHw_REG_PLL_CONFIG_POWER_DOWN, &pChipcHw->PLLConfig);
206 chipcHw_REG_PLL_CONFIG_A_RESET |
207 chipcHw_REG_PLL_CONFIG_VCO_800_1600 |
208 chipcHw_REG_PLL_CONFIG_POWER_DOWN;
209 } 206 }
210 207
211 REG_LOCAL_IRQ_RESTORE; 208 REG_LOCAL_IRQ_RESTORE;
@@ -216,22 +213,19 @@ void chipcHw_pll1Enable(uint32_t vcoFreqHz, chipcHw_SPREAD_SPECTRUM_e ssSupport)
216 { 213 {
217 REG_LOCAL_IRQ_SAVE; 214 REG_LOCAL_IRQ_SAVE;
218 /* Remove analog reset and Power on the PLL */ 215 /* Remove analog reset and Power on the PLL */
219 pChipcHw->PLLConfig &= 216 writel(readl(&pChipcHw->PLLConfig) & ~(chipcHw_REG_PLL_CONFIG_A_RESET | chipcHw_REG_PLL_CONFIG_POWER_DOWN), &pChipcHw->PLLConfig);
220 ~(chipcHw_REG_PLL_CONFIG_A_RESET |
221 chipcHw_REG_PLL_CONFIG_POWER_DOWN);
222 REG_LOCAL_IRQ_RESTORE; 217 REG_LOCAL_IRQ_RESTORE;
223 } 218 }
224 219
225 /* Wait until PLL is locked */ 220 /* Wait until PLL is locked */
226 while (!(pChipcHw->PLLStatus & chipcHw_REG_PLL_STATUS_LOCKED) 221 while (!(readl(&pChipcHw->PLLStatus) & chipcHw_REG_PLL_STATUS_LOCKED)
227 || !(pChipcHw-> 222 || !(readl(&pChipcHw->PLLStatus2) & chipcHw_REG_PLL_STATUS_LOCKED))
228 PLLStatus2 & chipcHw_REG_PLL_STATUS_LOCKED))
229 ; 223 ;
230 224
231 /* Remove digital reset */ 225 /* Remove digital reset */
232 { 226 {
233 REG_LOCAL_IRQ_SAVE; 227 REG_LOCAL_IRQ_SAVE;
234 pChipcHw->PLLConfig &= ~chipcHw_REG_PLL_CONFIG_D_RESET; 228 writel(readl(&pChipcHw->PLLConfig) & ~chipcHw_REG_PLL_CONFIG_D_RESET, &pChipcHw->PLLConfig);
235 REG_LOCAL_IRQ_RESTORE; 229 REG_LOCAL_IRQ_RESTORE;
236 } 230 }
237 } 231 }
@@ -267,11 +261,7 @@ void chipcHw_Init(chipcHw_INIT_PARAM_t *initParam /* [ IN ] Misc chip initializ
267 chipcHw_clearStickyBits(chipcHw_REG_STICKY_CHIP_SOFT_RESET); 261 chipcHw_clearStickyBits(chipcHw_REG_STICKY_CHIP_SOFT_RESET);
268 262
269 /* Before configuring the ARM clock, atleast we need to make sure BUS clock maintains the proper ratio with ARM clock */ 263 /* Before configuring the ARM clock, atleast we need to make sure BUS clock maintains the proper ratio with ARM clock */
270 pChipcHw->ACLKClock = 264 writel((readl(&pChipcHw->ACLKClock) & ~chipcHw_REG_ACLKClock_CLK_DIV_MASK) | (initParam-> armBusRatio & chipcHw_REG_ACLKClock_CLK_DIV_MASK), &pChipcHw->ACLKClock);
271 (pChipcHw->
272 ACLKClock & ~chipcHw_REG_ACLKClock_CLK_DIV_MASK) | (initParam->
273 armBusRatio &
274 chipcHw_REG_ACLKClock_CLK_DIV_MASK);
275 265
276 /* Set various core component frequencies. The order in which this is done is important for some. */ 266 /* Set various core component frequencies. The order in which this is done is important for some. */
277 /* The RTBUS (DDR PHY) is derived from the BUS, and the BUS from the ARM, and VPM needs to know BUS */ 267 /* The RTBUS (DDR PHY) is derived from the BUS, and the BUS from the ARM, and VPM needs to know BUS */