blob: 47e6526d57576a9654821fd534e1db00442e3bd7 [file] [log] [blame]
Shashank Mittal23b8f422010-04-16 19:27:21 -07001/*
Amol Jadic52c8a32011-07-12 11:27:04 -07002 * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
Shashank Mittal23b8f422010-04-16 19:27:21 -07003 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution.
11 * * Neither the name of Code Aurora nor
12 * the names of its contributors may be used to endorse or promote
13 * products derived from this software without specific prior written
14 * permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <stdint.h>
30#include <debug.h>
Amol Jadic52c8a32011-07-12 11:27:04 -070031#include <reg.h>
Shashank Mittal23b8f422010-04-16 19:27:21 -070032#include <kernel/thread.h>
33#include <platform/iomap.h>
Shashank Mittal402d0972010-09-29 10:09:52 -070034#include <platform/clock.h>
Ajay Dudani8534b1a2011-01-26 11:35:39 -080035#include <platform/scm-io.h>
Amol Jadic52c8a32011-07-12 11:27:04 -070036#include <uart_dm.h>
37#include <gsbi.h>
Amol Jadi82254562011-06-27 11:25:48 -070038#include <mmc.h>
Shashank Mittal23b8f422010-04-16 19:27:21 -070039
Shashank Mittal402d0972010-09-29 10:09:52 -070040/* Read, modify, then write-back a register. */
41static void rmwreg(uint32_t val, uint32_t reg, uint32_t mask)
42{
Ajay Dudanib01e5062011-12-03 23:23:42 -080043 uint32_t regval = readl(reg);
44 regval &= ~mask;
45 regval |= val;
46 writel(regval, reg);
Shashank Mittal402d0972010-09-29 10:09:52 -070047}
48
Shashank Mittal402d0972010-09-29 10:09:52 -070049/* Enable/disable for non-shared NT PLLs. */
50int nt_pll_enable(uint8_t src, uint8_t enable)
51{
Ajay Dudanib01e5062011-12-03 23:23:42 -080052 static const struct {
53 uint32_t const mode_reg;
54 uint32_t const status_reg;
55 } pll_reg[] = {
56 [PLL_1] = {
57 MM_PLL0_MODE_REG, MM_PLL0_STATUS_REG},[PLL_2] = {
58 MM_PLL1_MODE_REG, MM_PLL1_STATUS_REG},[PLL_3] = {
59 MM_PLL2_MODE_REG, MM_PLL2_STATUS_REG},};
60 uint32_t pll_mode;
Shashank Mittal402d0972010-09-29 10:09:52 -070061
Ajay Dudanib01e5062011-12-03 23:23:42 -080062 pll_mode = secure_readl(pll_reg[src].mode_reg);
63 if (enable) {
64 /* Disable PLL bypass mode. */
65 pll_mode |= (1 << 1);
66 secure_writel(pll_mode, pll_reg[src].mode_reg);
Shashank Mittal402d0972010-09-29 10:09:52 -070067
Ajay Dudanib01e5062011-12-03 23:23:42 -080068 /* H/W requires a 5us delay between disabling the bypass and
69 * de-asserting the reset. Delay 10us just to be safe. */
70 udelay(10);
Shashank Mittal402d0972010-09-29 10:09:52 -070071
Ajay Dudanib01e5062011-12-03 23:23:42 -080072 /* De-assert active-low PLL reset. */
73 pll_mode |= (1 << 2);
74 secure_writel(pll_mode, pll_reg[src].mode_reg);
Shashank Mittal402d0972010-09-29 10:09:52 -070075
Ajay Dudanib01e5062011-12-03 23:23:42 -080076 /* Enable PLL output. */
77 pll_mode |= (1 << 0);
78 secure_writel(pll_mode, pll_reg[src].mode_reg);
Shashank Mittal402d0972010-09-29 10:09:52 -070079
Ajay Dudanib01e5062011-12-03 23:23:42 -080080 /* Wait until PLL is enabled. */
81 while (!secure_readl(pll_reg[src].status_reg)) ;
82 } else {
83 /* Disable the PLL output, disable test mode, enable
84 * the bypass mode, and assert the reset. */
85 pll_mode &= 0xFFFFFFF0;
86 secure_writel(pll_mode, pll_reg[src].mode_reg);
87 }
Shashank Mittal402d0972010-09-29 10:09:52 -070088
Ajay Dudanib01e5062011-12-03 23:23:42 -080089 return 0;
Shashank Mittal402d0972010-09-29 10:09:52 -070090}
91
Shashank Mittal402d0972010-09-29 10:09:52 -070092/* Write the M,N,D values and enable the MDP Core Clock */
Ajay Dudanib01e5062011-12-03 23:23:42 -080093void config_mdp_clk(uint32_t ns,
94 uint32_t md,
95 uint32_t cc,
96 uint32_t ns_addr, uint32_t md_addr, uint32_t cc_addr)
Shashank Mittal402d0972010-09-29 10:09:52 -070097{
Ajay Dudanib01e5062011-12-03 23:23:42 -080098 unsigned int val = 0;
Shashank Mittal402d0972010-09-29 10:09:52 -070099
Ajay Dudanib01e5062011-12-03 23:23:42 -0800100 /* MN counter reset */
101 val = 1 << 31;
102 secure_writel(val, ns_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700103
Ajay Dudanib01e5062011-12-03 23:23:42 -0800104 /* Write the MD and CC register values */
105 secure_writel(md, md_addr);
106 secure_writel(cc, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700107
Ajay Dudanib01e5062011-12-03 23:23:42 -0800108 /* Reset the clk control, and Write ns val */
109 val = 1 << 31;
110 val |= ns;
111 secure_writel(val, ns_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700112
Ajay Dudanib01e5062011-12-03 23:23:42 -0800113 /* Clear MN counter reset */
114 val = 1 << 31;
115 val = ~val;
116 val = val & secure_readl(ns_addr);
117 secure_writel(val, ns_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700118
Ajay Dudanib01e5062011-12-03 23:23:42 -0800119 /* Enable MND counter */
120 val = 1 << 8;
121 val = val | secure_readl(cc_addr);
122 secure_writel(val, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700123
Ajay Dudanib01e5062011-12-03 23:23:42 -0800124 /* Enable the root of the clock tree */
125 val = 1 << 2;
126 val = val | secure_readl(cc_addr);
127 secure_writel(val, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700128
Ajay Dudanib01e5062011-12-03 23:23:42 -0800129 /* Enable the MDP Clock */
130 val = 1 << 0;
131 val = val | secure_readl(cc_addr);
132 secure_writel(val, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700133}
134
135/* Write the M,N,D values and enable the Pixel Core Clock */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800136void config_pixel_clk(uint32_t ns,
137 uint32_t md,
138 uint32_t cc,
139 uint32_t ns_addr, uint32_t md_addr, uint32_t cc_addr)
140{
141 unsigned int val = 0;
Shashank Mittal402d0972010-09-29 10:09:52 -0700142
Ajay Dudanib01e5062011-12-03 23:23:42 -0800143 /* Activate the reset for the M/N Counter */
144 val = 1 << 7;
145 secure_writel(val, ns_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700146
Ajay Dudanib01e5062011-12-03 23:23:42 -0800147 /* Write the MD and CC register values */
148 secure_writel(md, md_addr);
149 secure_writel(cc, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700150
Ajay Dudanib01e5062011-12-03 23:23:42 -0800151 /* Write the ns value, and active reset for M/N Counter, again */
152 val = 1 << 7;
153 val |= ns;
154 secure_writel(val, ns_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700155
Ajay Dudanib01e5062011-12-03 23:23:42 -0800156 /* De-activate the reset for M/N Counter */
157 val = 1 << 7;
158 val = ~val;
159 val = val & secure_readl(ns_addr);
160 secure_writel(val, ns_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700161
Ajay Dudanib01e5062011-12-03 23:23:42 -0800162 /* Enable MND counter */
163 val = 1 << 5;
164 val = val | secure_readl(cc_addr);
165 secure_writel(val, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700166
Ajay Dudanib01e5062011-12-03 23:23:42 -0800167 /* Enable the root of the clock tree */
168 val = 1 << 2;
169 val = val | secure_readl(cc_addr);
170 secure_writel(val, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700171
Ajay Dudanib01e5062011-12-03 23:23:42 -0800172 /* Enable the MDP Clock */
173 val = 1 << 0;
174 val = val | secure_readl(cc_addr);
175 secure_writel(val, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700176
Ajay Dudanib01e5062011-12-03 23:23:42 -0800177 /* Enable the LCDC Clock */
178 val = 1 << 8;
179 val = val | secure_readl(cc_addr);
180 secure_writel(val, cc_addr);
Shashank Mittal402d0972010-09-29 10:09:52 -0700181}
182
Shashank Mittalc69512e2010-09-22 16:40:48 -0700183/* Set rate and enable the clock */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800184void clock_config(uint32_t ns, uint32_t md, uint32_t ns_addr, uint32_t md_addr)
Shashank Mittalc69512e2010-09-22 16:40:48 -0700185{
Ajay Dudanib01e5062011-12-03 23:23:42 -0800186 unsigned int val = 0;
Shashank Mittalc69512e2010-09-22 16:40:48 -0700187
Ajay Dudanib01e5062011-12-03 23:23:42 -0800188 /* Activate the reset for the M/N Counter */
189 val = 1 << 7;
190 writel(val, ns_addr);
Shashank Mittalc69512e2010-09-22 16:40:48 -0700191
Ajay Dudanib01e5062011-12-03 23:23:42 -0800192 /* Write the MD value into the MD register */
193 writel(md, md_addr);
Shashank Mittalc69512e2010-09-22 16:40:48 -0700194
Ajay Dudanib01e5062011-12-03 23:23:42 -0800195 /* Write the ns value, and active reset for M/N Counter, again */
196 val = 1 << 7;
197 val |= ns;
198 writel(val, ns_addr);
Shashank Mittalc69512e2010-09-22 16:40:48 -0700199
Ajay Dudanib01e5062011-12-03 23:23:42 -0800200 /* De-activate the reset for M/N Counter */
201 val = 1 << 7;
202 val = ~val;
203 val = val & readl(ns_addr);
204 writel(val, ns_addr);
Shashank Mittalc69512e2010-09-22 16:40:48 -0700205
Ajay Dudanib01e5062011-12-03 23:23:42 -0800206 /* Enable the M/N Counter */
207 val = 1 << 8;
208 val = val | readl(ns_addr);
209 writel(val, ns_addr);
Shashank Mittalc69512e2010-09-22 16:40:48 -0700210
Ajay Dudanib01e5062011-12-03 23:23:42 -0800211 /* Enable the Clock Root */
212 val = 1 << 11;
213 val = val | readl(ns_addr);
214 writel(val, ns_addr);
Shashank Mittalc69512e2010-09-22 16:40:48 -0700215
Ajay Dudanib01e5062011-12-03 23:23:42 -0800216 /* Enable the Clock Branch */
217 val = 1 << 9;
218 val = val | readl(ns_addr);
219 writel(val, ns_addr);
Shashank Mittalc69512e2010-09-22 16:40:48 -0700220}
221
Shashank Mittaled177732011-05-06 19:12:59 -0700222void pll8_enable(void)
Shashank Mittal23b8f422010-04-16 19:27:21 -0700223{
Ajay Dudanib01e5062011-12-03 23:23:42 -0800224 /* Currently both UART and USB depend on this PLL8 clock initialization. */
225 unsigned int curr_value = 0;
Shashank Mittaled177732011-05-06 19:12:59 -0700226
Ajay Dudanib01e5062011-12-03 23:23:42 -0800227 /* Vote for PLL8 to be enabled */
228 curr_value = readl(MSM_BOOT_PLL_ENABLE_SC0);
229 curr_value |= (1 << 8);
230 writel(curr_value, MSM_BOOT_PLL_ENABLE_SC0);
Shashank Mittaled177732011-05-06 19:12:59 -0700231
Ajay Dudanib01e5062011-12-03 23:23:42 -0800232 /* Proceed only after PLL is enabled */
233 while (!(readl(MSM_BOOT_PLL8_STATUS) & (1 << 16))) ;
Shashank Mittaled177732011-05-06 19:12:59 -0700234}
235
236void uart_clock_init(void)
237{
238 /* Enable PLL8 */
239 pll8_enable();
Shashank Mittal23b8f422010-04-16 19:27:21 -0700240}
Ajay Dudani7d605522010-10-01 19:52:37 -0700241
242void hsusb_clock_init(void)
243{
244 int val;
Shashank Mittaled177732011-05-06 19:12:59 -0700245
246 /* Enable PLL8 */
247 pll8_enable();
Ajay Dudani7d605522010-10-01 19:52:37 -0700248
249 //Set 7th bit in NS Register
250 val = 1 << 7;
Shashank Mittaled177732011-05-06 19:12:59 -0700251 writel(val, USB_HS1_XCVR_FS_CLK_NS);
Ajay Dudani7d605522010-10-01 19:52:37 -0700252
253 //Set rate specific value in MD
Shashank Mittaled177732011-05-06 19:12:59 -0700254 writel(0x000500DF, USB_HS1_XCVR_FS_CLK_MD);
Ajay Dudani7d605522010-10-01 19:52:37 -0700255
256 //Set value in NS register
257 val = 1 << 7;
258 val |= 0x00E400C3;
Shashank Mittaled177732011-05-06 19:12:59 -0700259 writel(val, USB_HS1_XCVR_FS_CLK_NS);
Ajay Dudani7d605522010-10-01 19:52:37 -0700260
261 // Clear 7th bit
262 val = 1 << 7;
263 val = ~val;
Shashank Mittaled177732011-05-06 19:12:59 -0700264 val = val & readl(USB_HS1_XCVR_FS_CLK_NS);
265 writel(val, USB_HS1_XCVR_FS_CLK_NS);
Ajay Dudani7d605522010-10-01 19:52:37 -0700266
267 //set 11th bit
268 val = 1 << 11;
Shashank Mittaled177732011-05-06 19:12:59 -0700269 val |= readl(USB_HS1_XCVR_FS_CLK_NS);
270 writel(val, USB_HS1_XCVR_FS_CLK_NS);
Ajay Dudani7d605522010-10-01 19:52:37 -0700271
272 //set 9th bit
273 val = 1 << 9;
Shashank Mittaled177732011-05-06 19:12:59 -0700274 val |= readl(USB_HS1_XCVR_FS_CLK_NS);
275 writel(val, USB_HS1_XCVR_FS_CLK_NS);
Ajay Dudani7d605522010-10-01 19:52:37 -0700276
277 //set 8th bit
278 val = 1 << 8;
Shashank Mittaled177732011-05-06 19:12:59 -0700279 val |= readl(USB_HS1_XCVR_FS_CLK_NS);
280 writel(val, USB_HS1_XCVR_FS_CLK_NS);
Ajay Dudani7d605522010-10-01 19:52:37 -0700281}
282
Subbaraman Narayanamurthy05872db2011-02-28 11:34:58 -0800283void ce_clock_init(void)
284{
285 /* Enable clock branch for CE2 */
Ajay Dudanib01e5062011-12-03 23:23:42 -0800286 writel((1 << 4), CE2_HCLK_CTL);
Subbaraman Narayanamurthy05872db2011-02-28 11:34:58 -0800287 return;
288}
Amol Jadic52c8a32011-07-12 11:27:04 -0700289
290/* Configure UART clock - based on the gsbi id */
291void clock_config_uart_dm(uint8_t id)
292{
293 uint32_t ns = UART_DM_CLK_NS_115200;
294 uint32_t md = UART_DM_CLK_MD_115200;
295
296 /* Enable PLL8 */
297 pll8_enable();
298
299 /* Enable gsbi_uart_clk */
300 clock_config(ns, md, GSBIn_UART_APPS_NS(id), GSBIn_UART_APPS_MD(id));
301
302 /* Enable the GSBI HCLK */
303 writel(GSBI_HCLK_CTL_CLK_ENA << GSBI_HCLK_CTL_S, GSBIn_HCLK_CTL(id));
304}
305
306/* Configure i2c clock */
307void clock_config_i2c(uint8_t id, uint32_t freq)
308{
309 uint32_t ns;
310 uint32_t md;
311
Ajay Dudanib01e5062011-12-03 23:23:42 -0800312 switch (freq) {
Amol Jadic52c8a32011-07-12 11:27:04 -0700313 case 24000000:
314 ns = I2C_CLK_NS_24MHz;
315 md = I2C_CLK_MD_24MHz;
316 break;
317 default:
318 ASSERT(0);
319 }
320
321 clock_config(ns, md, GSBIn_QUP_APPS_NS(id), GSBIn_QUP_APPS_MD(id));
322
323 /* Enable the GSBI HCLK */
324 writel(GSBI_HCLK_CTL_CLK_ENA << GSBI_HCLK_CTL_S, GSBIn_HCLK_CTL(id));
325}
326
Amol Jadi82254562011-06-27 11:25:48 -0700327/* Intialize MMC clock */
328void clock_init_mmc(uint32_t interface)
329{
330 /* Nothing to be done. */
331}
332
333/* Configure MMC clock */
334void clock_config_mmc(uint32_t interface, uint32_t freq)
335{
336 uint32_t reg = 0;
337
Ajay Dudanib01e5062011-12-03 23:23:42 -0800338 switch (freq) {
Amol Jadi82254562011-06-27 11:25:48 -0700339 case MMC_CLK_400KHZ:
340 clock_config(SDC_CLK_NS_400KHZ,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800341 SDC_CLK_MD_400KHZ,
342 SDC_NS(interface), SDC_MD(interface));
Amol Jadi82254562011-06-27 11:25:48 -0700343 break;
344 case MMC_CLK_48MHZ:
Ajay Dudanib01e5062011-12-03 23:23:42 -0800345 case MMC_CLK_50MHZ: /* Max supported is 48MHZ */
Amol Jadi82254562011-06-27 11:25:48 -0700346 clock_config(SDC_CLK_NS_48MHZ,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800347 SDC_CLK_MD_48MHZ,
348 SDC_NS(interface), SDC_MD(interface));
Amol Jadi82254562011-06-27 11:25:48 -0700349 break;
350 default:
351 ASSERT(0);
352
353 }
354
355 reg |= MMC_BOOT_MCI_CLK_ENABLE;
356 reg |= MMC_BOOT_MCI_CLK_ENA_FLOW;
357 reg |= MMC_BOOT_MCI_CLK_IN_FEEDBACK;
Ajay Dudanib01e5062011-12-03 23:23:42 -0800358 writel(reg, MMC_BOOT_MCI_CLK);
Amol Jadi82254562011-06-27 11:25:48 -0700359}
Kinson Chikfe931032011-07-21 10:01:34 -0700360
361void mdp_clock_init(void)
362{
363 /* Turn on the PLL2, to ramp up the MDP clock to max (200MHz) */
364 nt_pll_enable(PLL_2, 1);
365
366 config_mdp_clk(MDP_NS_VAL, MDP_MD_VAL,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800367 MDP_CC_VAL, MDP_NS_REG, MDP_MD_REG, MDP_CC_REG);
Kinson Chikfe931032011-07-21 10:01:34 -0700368}
369
Wentao Xu8d6150c2011-06-22 11:03:18 -0400370void mmss_pixel_clock_configure(uint32_t pclk_id)
Kinson Chikfe931032011-07-21 10:01:34 -0700371{
Wentao Xu8d6150c2011-06-22 11:03:18 -0400372 if (pclk_id == PIXEL_CLK_INDEX_25M) {
373 config_pixel_clk(PIXEL_NS_VAL_25M, PIXEL_MD_VAL_25M,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800374 PIXEL_CC_VAL_25M, MMSS_PIXEL_NS_REG,
375 MMSS_PIXEL_MD_REG, MMSS_PIXEL_CC_REG);
376 } else {
Wentao Xu8d6150c2011-06-22 11:03:18 -0400377 config_pixel_clk(PIXEL_NS_VAL, PIXEL_MD_VAL,
Ajay Dudanib01e5062011-12-03 23:23:42 -0800378 PIXEL_CC_VAL, MMSS_PIXEL_NS_REG,
379 MMSS_PIXEL_MD_REG, MMSS_PIXEL_CC_REG);
Wentao Xu8d6150c2011-06-22 11:03:18 -0400380 }
Kinson Chikfe931032011-07-21 10:01:34 -0700381}
382
383void configure_dsicore_dsiclk()
384{
385 unsigned char mnd_mode, root_en, clk_en;
386 unsigned long src_sel = 0x3; // dsi_phy_pll0_src
Ajay Dudanib01e5062011-12-03 23:23:42 -0800387 unsigned long pre_div_func = 0x00; // predivide by 1
Kinson Chikfe931032011-07-21 10:01:34 -0700388 unsigned long pmxo_sel;
389
390 secure_writel(pre_div_func << 14 | src_sel, DSI_NS_REG);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800391 mnd_mode = 0; // Bypass MND
Kinson Chikfe931032011-07-21 10:01:34 -0700392 root_en = 1;
393 clk_en = 1;
394 pmxo_sel = 0;
395
396 secure_writel((pmxo_sel << 8) | (mnd_mode << 6), DSI_CC_REG);
397 secure_writel(secure_readl(DSI_CC_REG) | root_en << 2, DSI_CC_REG);
398 secure_writel(secure_readl(DSI_CC_REG) | clk_en, DSI_CC_REG);
399}
400
401void configure_dsicore_byteclk(void)
402{
Ajay Dudanib01e5062011-12-03 23:23:42 -0800403 secure_writel(0x00400401, MISC_CC2_REG); // select pxo
Kinson Chikfe931032011-07-21 10:01:34 -0700404}
405
406void configure_dsicore_pclk(void)
407{
408 unsigned char mnd_mode, root_en, clk_en;
409 unsigned long src_sel = 0x3; // dsi_phy_pll0_src
Ajay Dudanib01e5062011-12-03 23:23:42 -0800410 unsigned long pre_div_func = 0x01; // predivide by 2
Kinson Chikfe931032011-07-21 10:01:34 -0700411
412 secure_writel(pre_div_func << 12 | src_sel, PIXEL_NS_REG);
413
Ajay Dudanib01e5062011-12-03 23:23:42 -0800414 mnd_mode = 0; // Bypass MND
Kinson Chikfe931032011-07-21 10:01:34 -0700415 root_en = 1;
416 clk_en = 1;
417 secure_writel(mnd_mode << 6, PIXEL_CC_REG);
Ajay Dudanib01e5062011-12-03 23:23:42 -0800418 secure_writel(secure_readl(PIXEL_CC_REG) | root_en << 2, PIXEL_CC_REG);
419 secure_writel(secure_readl(PIXEL_CC_REG) | clk_en, PIXEL_CC_REG);
Kinson Chikfe931032011-07-21 10:01:34 -0700420}