blob: f01aa7ef4607fa01ac61b8999cef6f4c4f4e0127 [file] [log] [blame]
Ajay Singh Parmarfa6450d2014-07-23 23:06:29 -07001/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
Deepa Dinamani554b0622013-05-16 15:00:30 -07002 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * 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
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#include <assert.h>
30#include <reg.h>
31#include <err.h>
32#include <clock.h>
33#include <clock_pll.h>
34#include <clock_lib2.h>
35#include <platform/clock.h>
36#include <platform/iomap.h>
37
38
39/* Mux source select values */
40#define cxo_source_val 0
41#define gpll0_source_val 1
Channagoud Kadabi908353c2013-09-23 11:38:48 -070042#define gpll4_source_val 5
Deepa Dinamani554b0622013-05-16 15:00:30 -070043#define cxo_mm_source_val 0
44#define mmpll0_mm_source_val 1
45#define mmpll1_mm_source_val 2
46#define mmpll3_mm_source_val 3
47#define gpll0_mm_source_val 5
Kuogee Hsiehacc31942014-06-17 15:12:10 -070048#define edppll_270_mm_source_val 4
49#define edppll_350_mm_source_val 4
Ajay Singh Parmarfa6450d2014-07-23 23:06:29 -070050#define hdmipll_mm_source_val 3
Deepa Dinamani554b0622013-05-16 15:00:30 -070051
52struct clk_freq_tbl rcg_dummy_freq = F_END;
53
54
55/* Clock Operations */
56static struct clk_ops clk_ops_branch =
57{
58 .enable = clock_lib2_branch_clk_enable,
59 .disable = clock_lib2_branch_clk_disable,
60 .set_rate = clock_lib2_branch_set_rate,
61};
62
63static struct clk_ops clk_ops_rcg_mnd =
64{
65 .enable = clock_lib2_rcg_enable,
66 .set_rate = clock_lib2_rcg_set_rate,
67};
68
69static struct clk_ops clk_ops_rcg =
70{
71 .enable = clock_lib2_rcg_enable,
72 .set_rate = clock_lib2_rcg_set_rate,
73};
74
75static struct clk_ops clk_ops_cxo =
76{
77 .enable = cxo_clk_enable,
78 .disable = cxo_clk_disable,
79};
80
81static struct clk_ops clk_ops_pll_vote =
82{
83 .enable = pll_vote_clk_enable,
84 .disable = pll_vote_clk_disable,
85 .auto_off = pll_vote_clk_disable,
86 .is_enabled = pll_vote_clk_is_enabled,
87};
88
89static struct clk_ops clk_ops_vote =
90{
91 .enable = clock_lib2_vote_clk_enable,
92 .disable = clock_lib2_vote_clk_disable,
93};
94
95/* Clock Sources */
96static struct fixed_clk cxo_clk_src =
97{
98 .c = {
99 .rate = 19200000,
100 .dbg_name = "cxo_clk_src",
101 .ops = &clk_ops_cxo,
102 },
103};
104
Channagoud Kadabi908353c2013-09-23 11:38:48 -0700105static struct pll_vote_clk gpll4_clk_src = {
106 .en_reg = (void *)APCS_GPLL_ENA_VOTE,
107 .en_mask = BIT(4),
108 .status_reg = (void *)GPLL4_STATUS,
109 .status_mask = BIT(17),
110
111 .c = {
112 .rate = 768000000,
113 .dbg_name = "gpll4_clk_src",
114 .ops = &clk_ops_pll_vote,
115 },
116};
117
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700118static struct pll_vote_clk gpll0_clk_src =
119{
120 .en_reg = (void *) APCS_GPLL_ENA_VOTE,
121 .en_mask = BIT(0),
122 .status_reg = (void *) GPLL0_STATUS,
123 .status_mask = BIT(17),
124 .parent = &cxo_clk_src.c,
125
126 .c = {
127 .rate = 600000000,
128 .dbg_name = "gpll0_clk_src",
129 .ops = &clk_ops_pll_vote,
130 },
131};
132
133/* UART Clocks */
134static struct clk_freq_tbl ftbl_gcc_blsp1_2_uart1_6_apps_clk[] =
135{
136 F( 3686400, gpll0, 1, 96, 15625),
137 F( 7372800, gpll0, 1, 192, 15625),
138 F(14745600, gpll0, 1, 384, 15625),
139 F(16000000, gpll0, 5, 2, 15),
140 F(19200000, cxo, 1, 0, 0),
141 F(24000000, gpll0, 5, 1, 5),
142 F(32000000, gpll0, 1, 4, 75),
143 F(40000000, gpll0, 15, 0, 0),
144 F(46400000, gpll0, 1, 29, 375),
145 F(48000000, gpll0, 12.5, 0, 0),
146 F(51200000, gpll0, 1, 32, 375),
147 F(56000000, gpll0, 1, 7, 75),
148 F(58982400, gpll0, 1, 1536, 15625),
149 F(60000000, gpll0, 10, 0, 0),
150 F_END
151};
152
Sundarajan Srinivasand8b7c6f2013-09-13 16:50:22 -0700153static struct rcg_clk blsp2_uart2_apps_clk_src =
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700154{
Sundarajan Srinivasand8b7c6f2013-09-13 16:50:22 -0700155 .cmd_reg = (uint32_t *) BLSP2_UART2_APPS_CMD_RCGR,
156 .cfg_reg = (uint32_t *) BLSP2_UART2_APPS_CFG_RCGR,
157 .m_reg = (uint32_t *) BLSP2_UART2_APPS_M,
158 .n_reg = (uint32_t *) BLSP2_UART2_APPS_N,
159 .d_reg = (uint32_t *) BLSP2_UART2_APPS_D,
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700160
161 .set_rate = clock_lib2_rcg_set_rate_mnd,
162 .freq_tbl = ftbl_gcc_blsp1_2_uart1_6_apps_clk,
163 .current_freq = &rcg_dummy_freq,
164
165 .c = {
166 .dbg_name = "blsp1_uart2_apps_clk",
167 .ops = &clk_ops_rcg_mnd,
168 },
169};
170
Sundarajan Srinivasand8b7c6f2013-09-13 16:50:22 -0700171static struct branch_clk gcc_blsp2_uart2_apps_clk =
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700172{
Sundarajan Srinivasand8b7c6f2013-09-13 16:50:22 -0700173 .cbcr_reg = (uint32_t *) BLSP2_UART2_APPS_CBCR,
174 .parent = &blsp2_uart2_apps_clk_src.c,
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700175
176 .c = {
Sundarajan Srinivasand8b7c6f2013-09-13 16:50:22 -0700177 .dbg_name = "gcc_blsp2_uart2_apps_clk",
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700178 .ops = &clk_ops_branch,
179 },
180};
181
182static struct vote_clk gcc_blsp1_ahb_clk = {
183 .cbcr_reg = (uint32_t *) BLSP1_AHB_CBCR,
184 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
185 .en_mask = BIT(17),
186
187 .c = {
188 .dbg_name = "gcc_blsp1_ahb_clk",
189 .ops = &clk_ops_vote,
190 },
191};
192
193static struct vote_clk gcc_blsp2_ahb_clk = {
194 .cbcr_reg = (uint32_t *) BLSP2_AHB_CBCR,
195 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
196 .en_mask = BIT(15),
197
198 .c = {
199 .dbg_name = "gcc_blsp2_ahb_clk",
200 .ops = &clk_ops_vote,
201 },
202};
203
204/* USB Clocks */
205static struct clk_freq_tbl ftbl_gcc_usb_hs_system_clk[] =
206{
207 F(75000000, gpll0, 8, 0, 0),
208 F_END
209};
210
211static struct rcg_clk usb_hs_system_clk_src =
212{
213 .cmd_reg = (uint32_t *) USB_HS_SYSTEM_CMD_RCGR,
214 .cfg_reg = (uint32_t *) USB_HS_SYSTEM_CFG_RCGR,
215
216 .set_rate = clock_lib2_rcg_set_rate_hid,
217 .freq_tbl = ftbl_gcc_usb_hs_system_clk,
218 .current_freq = &rcg_dummy_freq,
219
220 .c = {
221 .dbg_name = "usb_hs_system_clk",
222 .ops = &clk_ops_rcg,
223 },
224};
225
226static struct branch_clk gcc_usb_hs_system_clk =
227{
228 .cbcr_reg = (uint32_t *) USB_HS_SYSTEM_CBCR,
229 .parent = &usb_hs_system_clk_src.c,
230
231 .c = {
232 .dbg_name = "gcc_usb_hs_system_clk",
233 .ops = &clk_ops_branch,
234 },
235};
236
237static struct branch_clk gcc_usb_hs_ahb_clk =
238{
239 .cbcr_reg = (uint32_t *) USB_HS_AHB_CBCR,
240 .has_sibling = 1,
241
242 .c = {
243 .dbg_name = "gcc_usb_hs_ahb_clk",
244 .ops = &clk_ops_branch,
245 },
246};
247
248/* SDCC Clocks */
Channagoud Kadabide9b2d32013-11-08 13:24:47 -0800249static struct clk_freq_tbl ftbl_gcc_sdcc1_apps_clk[] =
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700250{
251 F( 144000, cxo, 16, 3, 25),
252 F( 400000, cxo, 12, 1, 4),
253 F( 20000000, gpll0, 15, 1, 2),
254 F( 25000000, gpll0, 12, 1, 2),
255 F( 50000000, gpll0, 12, 0, 0),
256 F(100000000, gpll0, 6, 0, 0),
Channagoud Kadabi908353c2013-09-23 11:38:48 -0700257 F(192000000, gpll4, 4, 0, 0),
258 F(384000000, gpll4, 2, 0, 0),
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700259 F_END
260};
261
Channagoud Kadabide9b2d32013-11-08 13:24:47 -0800262static struct clk_freq_tbl ftbl_gcc_sdcc2_4_apps_clk[] =
263{
264 F( 144000, cxo, 16, 3, 25),
265 F( 400000, cxo, 12, 1, 4),
266 F( 20000000, gpll0, 15, 1, 2),
267 F( 25000000, gpll0, 12, 1, 2),
268 F( 50000000, gpll0, 12, 0, 0),
269 F(100000000, gpll0, 6, 0, 0),
270 F(200000000, gpll0, 3, 0, 0),
271 F_END
272};
273
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700274static struct rcg_clk sdcc1_apps_clk_src =
275{
276 .cmd_reg = (uint32_t *) SDCC1_CMD_RCGR,
277 .cfg_reg = (uint32_t *) SDCC1_CFG_RCGR,
278 .m_reg = (uint32_t *) SDCC1_M,
279 .n_reg = (uint32_t *) SDCC1_N,
280 .d_reg = (uint32_t *) SDCC1_D,
281
282 .set_rate = clock_lib2_rcg_set_rate_mnd,
Channagoud Kadabide9b2d32013-11-08 13:24:47 -0800283 .freq_tbl = ftbl_gcc_sdcc1_apps_clk,
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700284 .current_freq = &rcg_dummy_freq,
285
286 .c = {
287 .dbg_name = "sdc1_clk",
288 .ops = &clk_ops_rcg_mnd,
289 },
290};
291
292static struct branch_clk gcc_sdcc1_apps_clk =
293{
294 .cbcr_reg = (uint32_t *) SDCC1_APPS_CBCR,
295 .parent = &sdcc1_apps_clk_src.c,
296
297 .c = {
298 .dbg_name = "gcc_sdcc1_apps_clk",
299 .ops = &clk_ops_branch,
300 },
301};
302
303static struct branch_clk gcc_sdcc1_ahb_clk =
304{
305 .cbcr_reg = (uint32_t *) SDCC1_AHB_CBCR,
306 .has_sibling = 1,
307
308 .c = {
309 .dbg_name = "gcc_sdcc1_ahb_clk",
310 .ops = &clk_ops_branch,
311 },
312};
313
Channagoud Kadabide9b2d32013-11-08 13:24:47 -0800314static struct rcg_clk sdcc2_apps_clk_src =
315{
316 .cmd_reg = (uint32_t *) SDCC2_CMD_RCGR,
317 .cfg_reg = (uint32_t *) SDCC2_CFG_RCGR,
318 .m_reg = (uint32_t *) SDCC2_M,
319 .n_reg = (uint32_t *) SDCC2_N,
320 .d_reg = (uint32_t *) SDCC2_D,
321
322 .set_rate = clock_lib2_rcg_set_rate_mnd,
323 .freq_tbl = ftbl_gcc_sdcc2_4_apps_clk,
324 .current_freq = &rcg_dummy_freq,
325
326 .c = {
327 .dbg_name = "sdc2_clk",
328 .ops = &clk_ops_rcg_mnd,
329 },
330};
331
332static struct branch_clk gcc_sdcc2_apps_clk =
333{
334 .cbcr_reg = (uint32_t *) SDCC2_APPS_CBCR,
335 .parent = &sdcc2_apps_clk_src.c,
336
337 .c = {
338 .dbg_name = "gcc_sdcc2_apps_clk",
339 .ops = &clk_ops_branch,
340 },
341};
342
343static struct branch_clk gcc_sdcc2_ahb_clk =
344{
345 .cbcr_reg = (uint32_t *) SDCC2_AHB_CBCR,
346 .has_sibling = 1,
347
348 .c = {
349 .dbg_name = "gcc_sdcc2_ahb_clk",
350 .ops = &clk_ops_branch,
351 },
352};
353
Amol Jadi0a4c9b42013-10-11 14:22:11 -0700354/* USB 3.0 Clocks */
355static struct clk_freq_tbl ftbl_gcc_usb30_master_clk[] =
356{
357 F(125000000, gpll0, 1, 5, 24),
358 F_END
359};
360
361static struct rcg_clk usb30_master_clk_src =
362{
363 .cmd_reg = (uint32_t *) GCC_USB30_MASTER_CMD_RCGR,
364 .cfg_reg = (uint32_t *) GCC_USB30_MASTER_CFG_RCGR,
365 .m_reg = (uint32_t *) GCC_USB30_MASTER_M,
366 .n_reg = (uint32_t *) GCC_USB30_MASTER_N,
367 .d_reg = (uint32_t *) GCC_USB30_MASTER_D,
368
369 .set_rate = clock_lib2_rcg_set_rate_mnd,
370 .freq_tbl = ftbl_gcc_usb30_master_clk,
371 .current_freq = &rcg_dummy_freq,
372
373 .c = {
374 .dbg_name = "usb30_master_clk_src",
375 .ops = &clk_ops_rcg,
376 },
377};
378
379
380static struct branch_clk gcc_usb30_master_clk =
381{
382 .cbcr_reg = (uint32_t *) GCC_USB30_MASTER_CBCR,
383 .parent = &usb30_master_clk_src.c,
384
385 .c = {
386 .dbg_name = "gcc_usb30_master_clk",
387 .ops = &clk_ops_branch,
388 },
389};
390
391static struct branch_clk gcc_sys_noc_usb30_axi_clk =
392{
393 .cbcr_reg = (uint32_t *) SYS_NOC_USB3_AXI_CBCR,
394 .has_sibling = 1,
395
396 .c = {
397 .dbg_name = "gcc_sys_noc_usb3_axi_clk",
398 .ops = &clk_ops_branch,
399 },
400};
401
Sundarajan Srinivasan21263d62013-11-19 11:49:38 -0800402/* CE Clocks */
403static struct clk_freq_tbl ftbl_gcc_ce2_clk[] = {
404 F( 50000000, gpll0, 12, 0, 0),
405 F(100000000, gpll0, 6, 0, 0),
406 F_END
407};
408
409static struct rcg_clk ce2_clk_src = {
410 .cmd_reg = (uint32_t *) GCC_CE2_CMD_RCGR,
411 .cfg_reg = (uint32_t *) GCC_CE2_CFG_RCGR,
412 .set_rate = clock_lib2_rcg_set_rate_hid,
413 .freq_tbl = ftbl_gcc_ce2_clk,
414 .current_freq = &rcg_dummy_freq,
415
416 .c = {
417 .dbg_name = "ce2_clk_src",
418 .ops = &clk_ops_rcg,
419 },
420};
421
422static struct vote_clk gcc_ce2_clk = {
423 .cbcr_reg = (uint32_t *) GCC_CE2_CBCR,
424 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
425 .en_mask = BIT(2),
426
427 .c = {
428 .dbg_name = "gcc_ce2_clk",
429 .ops = &clk_ops_vote,
430 },
431};
432
433static struct vote_clk gcc_ce2_ahb_clk = {
434 .cbcr_reg = (uint32_t *) GCC_CE2_AHB_CBCR,
435 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
436 .en_mask = BIT(0),
437
438 .c = {
439 .dbg_name = "gcc_ce2_ahb_clk",
440 .ops = &clk_ops_vote,
441 },
442};
443
444static struct vote_clk gcc_ce2_axi_clk = {
445 .cbcr_reg = (uint32_t *) GCC_CE2_AXI_CBCR,
446 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
447 .en_mask = BIT(1),
448
449 .c = {
450 .dbg_name = "gcc_ce2_axi_clk",
451 .ops = &clk_ops_vote,
452 },
453};
454
455static struct clk_freq_tbl ftbl_gcc_ce1_clk[] = {
456 F( 50000000, gpll0, 12, 0, 0),
457 F(100000000, gpll0, 6, 0, 0),
458 F_END
459};
460
461static struct rcg_clk ce1_clk_src = {
462 .cmd_reg = (uint32_t *) GCC_CE1_CMD_RCGR,
463 .cfg_reg = (uint32_t *) GCC_CE1_CFG_RCGR,
464 .set_rate = clock_lib2_rcg_set_rate_hid,
465 .freq_tbl = ftbl_gcc_ce1_clk,
466 .current_freq = &rcg_dummy_freq,
467
468 .c = {
469 .dbg_name = "ce1_clk_src",
470 .ops = &clk_ops_rcg,
471 },
472};
473
474static struct vote_clk gcc_ce1_clk = {
475 .cbcr_reg = (uint32_t *) GCC_CE1_CBCR,
476 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
477 .en_mask = BIT(5),
478
479 .c = {
480 .dbg_name = "gcc_ce1_clk",
481 .ops = &clk_ops_vote,
482 },
483};
484
485static struct vote_clk gcc_ce1_ahb_clk = {
486 .cbcr_reg = (uint32_t *) GCC_CE1_AHB_CBCR,
487 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
488 .en_mask = BIT(3),
489
490 .c = {
491 .dbg_name = "gcc_ce1_ahb_clk",
492 .ops = &clk_ops_vote,
493 },
494};
495
496static struct vote_clk gcc_ce1_axi_clk = {
497 .cbcr_reg = (uint32_t *) GCC_CE1_AXI_CBCR,
498 .vote_reg = (uint32_t *) APCS_CLOCK_BRANCH_ENA_VOTE,
499 .en_mask = BIT(4),
500
501 .c = {
502 .dbg_name = "gcc_ce1_axi_clk",
503 .ops = &clk_ops_vote,
504 },
505};
506
Dhaval Patel4a87d522013-10-18 19:02:37 -0700507/* Display clocks */
508static struct clk_freq_tbl ftbl_mdss_esc0_1_clk[] = {
509 F_MM(19200000, cxo, 1, 0, 0),
510 F_END
511};
512
513static struct clk_freq_tbl ftbl_mdss_esc1_1_clk[] = {
514 F_MM(19200000, cxo, 1, 0, 0),
515 F_END
516};
517
518static struct clk_freq_tbl ftbl_mmss_axi_clk[] = {
519 F_MM(19200000, cxo, 1, 0, 0),
520 F_MM(100000000, gpll0, 6, 0, 0),
521 F_END
522};
523
524static struct clk_freq_tbl ftbl_mdp_clk[] = {
525 F_MM( 75000000, gpll0, 8, 0, 0),
526 F_MM( 240000000, gpll0, 2.5, 0, 0),
527 F_END
528};
529
530static struct rcg_clk dsi_esc0_clk_src = {
531 .cmd_reg = (uint32_t *) DSI_ESC0_CMD_RCGR,
532 .cfg_reg = (uint32_t *) DSI_ESC0_CFG_RCGR,
533 .set_rate = clock_lib2_rcg_set_rate_hid,
534 .freq_tbl = ftbl_mdss_esc0_1_clk,
535
536 .c = {
537 .dbg_name = "dsi_esc0_clk_src",
538 .ops = &clk_ops_rcg,
539 },
540};
541
542static struct rcg_clk dsi_esc1_clk_src = {
543 .cmd_reg = (uint32_t *) DSI_ESC1_CMD_RCGR,
544 .cfg_reg = (uint32_t *) DSI_ESC1_CFG_RCGR,
545 .set_rate = clock_lib2_rcg_set_rate_hid,
546 .freq_tbl = ftbl_mdss_esc1_1_clk,
547
548 .c = {
549 .dbg_name = "dsi_esc1_clk_src",
550 .ops = &clk_ops_rcg,
551 },
552};
553
554static struct clk_freq_tbl ftbl_mdss_vsync_clk[] = {
555 F_MM(19200000, cxo, 1, 0, 0),
556 F_END
557};
558
559static struct rcg_clk vsync_clk_src = {
560 .cmd_reg = (uint32_t *) VSYNC_CMD_RCGR,
561 .cfg_reg = (uint32_t *) VSYNC_CFG_RCGR,
562 .set_rate = clock_lib2_rcg_set_rate_hid,
563 .freq_tbl = ftbl_mdss_vsync_clk,
564
565 .c = {
566 .dbg_name = "vsync_clk_src",
567 .ops = &clk_ops_rcg,
568 },
569};
570
571static struct rcg_clk mdp_axi_clk_src = {
572 .cmd_reg = (uint32_t *) MDP_AXI_CMD_RCGR,
573 .cfg_reg = (uint32_t *) MDP_AXI_CFG_RCGR,
574 .set_rate = clock_lib2_rcg_set_rate_hid,
575 .freq_tbl = ftbl_mmss_axi_clk,
576
577 .c = {
578 .dbg_name = "mdp_axi_clk_src",
579 .ops = &clk_ops_rcg,
580 },
581};
582
583static struct branch_clk mdss_esc0_clk = {
584 .cbcr_reg = (uint32_t *) DSI_ESC0_CBCR,
585 .parent = &dsi_esc0_clk_src.c,
586 .has_sibling = 0,
587
588 .c = {
589 .dbg_name = "mdss_esc0_clk",
590 .ops = &clk_ops_branch,
591 },
592};
593
594static struct branch_clk mdss_esc1_clk = {
595 .cbcr_reg = (uint32_t *) DSI_ESC1_CBCR,
596 .parent = &dsi_esc1_clk_src.c,
597 .has_sibling = 0,
598
599 .c = {
600 .dbg_name = "mdss_esc1_clk",
601 .ops = &clk_ops_branch,
602 },
603};
604
605static struct branch_clk mdss_axi_clk = {
606 .cbcr_reg = (uint32_t *) MDP_AXI_CBCR,
607 .parent = &mdp_axi_clk_src.c,
608 .has_sibling = 0,
609
610 .c = {
611 .dbg_name = "mdss_axi_clk",
612 .ops = &clk_ops_branch,
613 },
614};
615
616static struct branch_clk mmss_mmssnoc_axi_clk = {
617 .cbcr_reg = (uint32_t *) MMSS_MMSSNOC_AXI_CBCR,
618 .parent = &mdp_axi_clk_src.c,
619 .has_sibling = 0,
620
621 .c = {
622 .dbg_name = "mmss_mmssnoc_axi_clk",
623 .ops = &clk_ops_branch,
624 },
625};
626
627static struct branch_clk mmss_s0_axi_clk = {
628 .cbcr_reg = (uint32_t *) MMSS_S0_AXI_CBCR,
629 .parent = &mdp_axi_clk_src.c,
630 .has_sibling = 0,
631
632 .c = {
633 .dbg_name = "mmss_s0_axi_clk",
634 .ops = &clk_ops_branch,
635 },
636};
637
638static struct branch_clk mdp_ahb_clk = {
639 .cbcr_reg = (uint32_t *) MDP_AHB_CBCR,
640 .has_sibling = 1,
641
642 .c = {
643 .dbg_name = "mdp_ahb_clk",
644 .ops = &clk_ops_branch,
645 },
646};
647
648static struct rcg_clk mdss_mdp_clk_src = {
649 .cmd_reg = (uint32_t *) MDP_CMD_RCGR,
650 .cfg_reg = (uint32_t *) MDP_CFG_RCGR,
651 .set_rate = clock_lib2_rcg_set_rate_hid,
652 .freq_tbl = ftbl_mdp_clk,
653 .current_freq = &rcg_dummy_freq,
654
655 .c = {
656 .dbg_name = "mdss_mdp_clk_src",
657 .ops = &clk_ops_rcg,
658 },
659};
660
661static struct branch_clk mdss_mdp_clk = {
662 .cbcr_reg = (uint32_t *) MDP_CBCR,
663 .parent = &mdss_mdp_clk_src.c,
664 .has_sibling = 1,
665
666 .c = {
667 .dbg_name = "mdss_mdp_clk",
668 .ops = &clk_ops_branch,
669 },
670};
671
672static struct branch_clk mdss_mdp_lut_clk = {
673 .cbcr_reg = MDP_LUT_CBCR,
674 .parent = &mdss_mdp_clk_src.c,
675 .has_sibling = 1,
676
677 .c = {
678 .dbg_name = "mdss_mdp_lut_clk",
679 .ops = &clk_ops_branch,
680 },
681};
682
683static struct branch_clk mdss_vsync_clk = {
684 .cbcr_reg = MDSS_VSYNC_CBCR,
685 .parent = &vsync_clk_src.c,
686 .has_sibling = 0,
687
688 .c = {
689 .dbg_name = "mdss_vsync_clk",
690 .ops = &clk_ops_branch,
691 },
692};
693
Ajay Singh Parmarfa6450d2014-07-23 23:06:29 -0700694static struct branch_clk mdss_hdmi_ahb_clk = {
695 .cbcr_reg = MDSS_HDMI_AHB_CBCR,
696 .has_sibling = 1,
697 .c = {
698 .dbg_name = "mdss_hdmi_ahb_clk",
699 .ops = &clk_ops_branch,
700 },
701};
702
703static struct clk_freq_tbl ftbl_mdss_hdmi_clk[] = {
704 F_MM( 19200000, cxo, 1, 0, 0),
705 F_END
706};
707
708static struct rcg_clk hdmi_clk_src = {
709 .cmd_reg = HDMI_CMD_RCGR,
710 .cfg_reg = HDMI_CFG_RCGR,
711 .set_rate = clock_lib2_rcg_set_rate_hid,
712 .freq_tbl = ftbl_mdss_hdmi_clk,
713 .current_freq = &rcg_dummy_freq,
714 .c = {
715 .dbg_name = "hdmi_clk_src",
716 .ops = &clk_ops_rcg,
717 },
718};
719
720static struct branch_clk mdss_hdmi_clk = {
721 .cbcr_reg = MDSS_HDMI_CBCR,
722 .has_sibling = 0,
723 .parent = &hdmi_clk_src.c,
724 .c = {
725 .dbg_name = "mdss_hdmi_clk",
726 .ops = &clk_ops_branch,
727 },
728};
729
730static struct clk_freq_tbl ftbl_mdss_extpclk_clk[] = {
731 F_MDSS(148500000, hdmipll, 1, 0, 0),
732 F_END
733};
734
735static struct rcg_clk extpclk_clk_src = {
736 .cmd_reg = EXTPCLK_CMD_RCGR,
737 .cfg_reg = EXTPCLK_CFG_RCGR,
738 .set_rate = clock_lib2_rcg_set_rate_hid,
739 .freq_tbl = ftbl_mdss_extpclk_clk,
740 .current_freq = &rcg_dummy_freq,
741 .c = {
742 .dbg_name = "extpclk_clk_src",
743 .ops = &clk_ops_rcg,
744 },
745};
746
747static struct branch_clk mdss_extpclk_clk = {
748 .cbcr_reg = MDSS_EXTPCLK_CBCR,
749 .has_sibling = 0,
750 .parent = &extpclk_clk_src.c,
751 .c = {
752 .dbg_name = "mdss_extpclk_clk",
753 .ops = &clk_ops_branch,
754 },
755};
756
Kuogee Hsiehacc31942014-06-17 15:12:10 -0700757static struct clk_freq_tbl ftbl_mdss_edpaux_clk[] = {
758 F_MM(19200000, cxo, 1, 0, 0),
759 F_END
760};
761
762static struct rcg_clk edpaux_clk_src = {
763 .cmd_reg = (uint32_t *) EDPAUX_CMD_RCGR,
764 .set_rate = clock_lib2_rcg_set_rate_hid,
765 .freq_tbl = ftbl_mdss_edpaux_clk,
766
767 .c = {
768 .dbg_name = "edpaux_clk_src",
769 .ops = &clk_ops_rcg,
770 },
771};
772
773static struct branch_clk mdss_edpaux_clk = {
774 .cbcr_reg = MDSS_EDPAUX_CBCR,
775 .parent = &edpaux_clk_src.c,
776 .has_sibling = 0,
777
778 .c = {
779 .dbg_name = "mdss_edpaux_clk",
780 .ops = &clk_ops_branch,
781 },
782};
783
784static struct clk_freq_tbl ftbl_mdss_edplink_clk[] = {
785 F_MDSS(162000000, edppll_270, 2, 0, 0),
786 F_MDSS(270000000, edppll_270, 11, 0, 0),
787 F_END
788};
789
790static struct rcg_clk edplink_clk_src = {
791 .cmd_reg = (uint32_t *)EDPLINK_CMD_RCGR,
792 .set_rate = clock_lib2_rcg_set_rate_hid,
793 .freq_tbl = ftbl_mdss_edplink_clk,
794 .current_freq = &rcg_dummy_freq,
795 .c = {
796 .dbg_name = "edplink_clk_src",
797 .ops = &clk_ops_rcg,
798 },
799};
800
801static struct clk_freq_tbl ftbl_mdss_edppixel_clk[] = {
802 F_MDSS(138500000, edppll_350, 2, 0, 0),
803 F_MDSS(350000000, edppll_350, 11, 0, 0),
804 F_END
805};
806
807static struct rcg_clk edppixel_clk_src = {
808 .cmd_reg = (uint32_t *)EDPPIXEL_CMD_RCGR,
809 .set_rate = clock_lib2_rcg_set_rate_mnd,
810 .freq_tbl = ftbl_mdss_edppixel_clk,
811 .current_freq = &rcg_dummy_freq,
812 .c = {
813 .dbg_name = "edppixel_clk_src",
814 .ops = &clk_ops_rcg_mnd,
815 },
816};
817
818static struct branch_clk mdss_edplink_clk = {
819 .cbcr_reg = (uint32_t *)MDSS_EDPLINK_CBCR,
820 .has_sibling = 0,
821 .parent = &edplink_clk_src.c,
822 .c = {
823 .dbg_name = "mdss_edplink_clk",
824 .ops = &clk_ops_branch,
825 },
826};
827
828static struct branch_clk mdss_edppixel_clk = {
829 .cbcr_reg = (uint32_t *)MDSS_EDPPIXEL_CBCR,
830 .has_sibling = 0,
831 .parent = &edppixel_clk_src.c,
832 .c = {
833 .dbg_name = "mdss_edppixel_clk",
834 .ops = &clk_ops_branch,
835 },
836};
837
Channagoud Kadabi908353c2013-09-23 11:38:48 -0700838static struct branch_clk gcc_sdcc1_cdccal_ff_clk = {
839 .cbcr_reg = SDCC1_CDCCAL_FF_CBCR,
840 .has_sibling = 1,
841
842 .c = {
843 .dbg_name = "gcc_sdcc1_cdccal_ff_clk",
844 .ops = &clk_ops_branch,
845 },
846};
847
848static struct branch_clk gcc_sdcc1_cdccal_sleep_clk = {
849 .cbcr_reg = SDCC1_CDCCAL_SLEEP_CBCR,
850 .has_sibling = 1,
851
852 .c = {
853 .dbg_name = "gcc_sdcc1_cdccal_sleep_clk",
854 .ops = &clk_ops_branch,
855 },
856};
Dhaval Patel4a87d522013-10-18 19:02:37 -0700857
Deepa Dinamani554b0622013-05-16 15:00:30 -0700858/* Clock lookup table */
859static struct clk_lookup msm_clocks_8084[] =
860{
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700861 CLK_LOOKUP("sdc1_iface_clk", gcc_sdcc1_ahb_clk.c),
862 CLK_LOOKUP("sdc1_core_clk", gcc_sdcc1_apps_clk.c),
Deepa Dinamani554b0622013-05-16 15:00:30 -0700863
Channagoud Kadabide9b2d32013-11-08 13:24:47 -0800864 CLK_LOOKUP("sdc2_iface_clk", gcc_sdcc2_ahb_clk.c),
865 CLK_LOOKUP("sdc2_core_clk", gcc_sdcc2_apps_clk.c),
866
Channagoud Kadabi908353c2013-09-23 11:38:48 -0700867 CLK_LOOKUP("gcc_sdcc1_cdccal_sleep_clk", gcc_sdcc1_cdccal_sleep_clk.c),
868 CLK_LOOKUP("gcc_sdcc1_cdccal_ff_clk", gcc_sdcc1_cdccal_ff_clk.c),
869
Sundarajan Srinivasand8b7c6f2013-09-13 16:50:22 -0700870 CLK_LOOKUP("uart7_iface_clk", gcc_blsp2_ahb_clk.c),
871 CLK_LOOKUP("uart7_core_clk", gcc_blsp2_uart2_apps_clk.c),
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700872
873 CLK_LOOKUP("usb_iface_clk", gcc_usb_hs_ahb_clk.c),
874 CLK_LOOKUP("usb_core_clk", gcc_usb_hs_system_clk.c),
Amol Jadi0a4c9b42013-10-11 14:22:11 -0700875
Sundarajan Srinivasan21263d62013-11-19 11:49:38 -0800876 CLK_LOOKUP("ce2_ahb_clk", gcc_ce2_ahb_clk.c),
877 CLK_LOOKUP("ce2_axi_clk", gcc_ce2_axi_clk.c),
878 CLK_LOOKUP("ce2_core_clk", gcc_ce2_clk.c),
879 CLK_LOOKUP("ce2_src_clk", ce2_clk_src.c),
880
881 CLK_LOOKUP("ce1_ahb_clk", gcc_ce1_ahb_clk.c),
882 CLK_LOOKUP("ce1_axi_clk", gcc_ce1_axi_clk.c),
883 CLK_LOOKUP("ce1_core_clk", gcc_ce1_clk.c),
884 CLK_LOOKUP("ce1_src_clk", ce1_clk_src.c),
885
Amol Jadi0a4c9b42013-10-11 14:22:11 -0700886 /* USB 3.0 */
887 CLK_LOOKUP("usb30_iface_clk", gcc_sys_noc_usb30_axi_clk.c),
888 CLK_LOOKUP("usb30_master_clk", gcc_usb30_master_clk.c),
Dhaval Patel4a87d522013-10-18 19:02:37 -0700889
890 /* mdss clocks */
891 CLK_LOOKUP("mdp_ahb_clk", mdp_ahb_clk.c),
892 CLK_LOOKUP("mdss_esc0_clk", mdss_esc0_clk.c),
893 CLK_LOOKUP("mdss_esc1_clk", mdss_esc1_clk.c),
894 CLK_LOOKUP("mdss_axi_clk", mdss_axi_clk.c),
895 CLK_LOOKUP("mmss_mmssnoc_axi_clk", mmss_mmssnoc_axi_clk.c),
896 CLK_LOOKUP("mmss_s0_axi_clk", mmss_s0_axi_clk.c),
897 CLK_LOOKUP("mdss_vsync_clk", mdss_vsync_clk.c),
898 CLK_LOOKUP("mdss_mdp_clk_src", mdss_mdp_clk_src.c),
899 CLK_LOOKUP("mdss_mdp_clk", mdss_mdp_clk.c),
900 CLK_LOOKUP("mdss_mdp_lut_clk", mdss_mdp_lut_clk.c),
Kuogee Hsiehacc31942014-06-17 15:12:10 -0700901
902 CLK_LOOKUP("edp_pixel_clk", mdss_edppixel_clk.c),
903 CLK_LOOKUP("edp_link_clk", mdss_edplink_clk.c),
904 CLK_LOOKUP("edp_aux_clk", mdss_edpaux_clk.c),
Ajay Singh Parmarfa6450d2014-07-23 23:06:29 -0700905
906 CLK_LOOKUP("hdmi_ahb_clk", mdss_hdmi_ahb_clk.c),
907 CLK_LOOKUP("hdmi_core_clk", mdss_hdmi_clk.c),
908 CLK_LOOKUP("hdmi_extp_clk", mdss_extpclk_clk.c),
Sundarajan Srinivasan09374ed2013-06-18 13:29:32 -0700909};
Deepa Dinamani554b0622013-05-16 15:00:30 -0700910
911void platform_clock_init(void)
912{
913 clk_init(msm_clocks_8084, ARRAY_SIZE(msm_clocks_8084));
914}