2 * Copyright (c) 2017, The Linux Foundation. All rights reserved.
4 * This software is licensed under the terms of the GNU General Public
5 * License version 2, as published by the Free Software Foundation, and
6 * may be copied, distributed, and modified under those terms.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #include <linux/kernel.h>
15 #include <linux/err.h>
16 #include <linux/platform_device.h>
17 #include <linux/module.h>
19 #include <linux/of_device.h>
20 #include <linux/clk-provider.h>
21 #include <linux/regmap.h>
23 #include <dt-bindings/clock/qcom,gcc-ipq8074.h>
26 #include "clk-regmap.h"
29 #include "clk-branch.h"
30 #include "clk-alpha-pll.h"
33 #define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }
41 static const char * const gcc_xo_gpll0_gpll0_out_main_div2[] = {
44 "gpll0_out_main_div2",
47 static const struct parent_map gcc_xo_gpll0_gpll0_out_main_div2_map[] = {
53 static struct clk_alpha_pll gpll0_main = {
56 .enable_reg = 0x0b000,
57 .enable_mask = BIT(0),
58 .hw.init = &(struct clk_init_data){
60 .parent_names = (const char *[]){
64 .ops = &clk_alpha_pll_ops,
69 static struct clk_fixed_factor gpll0_out_main_div2 = {
72 .hw.init = &(struct clk_init_data){
73 .name = "gpll0_out_main_div2",
74 .parent_names = (const char *[]){
78 .ops = &clk_fixed_factor_ops,
79 .flags = CLK_SET_RATE_PARENT,
83 static struct clk_alpha_pll_postdiv gpll0 = {
85 .clkr.hw.init = &(struct clk_init_data){
87 .parent_names = (const char *[]){
91 .ops = &clk_alpha_pll_postdiv_ops,
95 static const struct freq_tbl ftbl_pcnoc_bfdcd_clk_src[] = {
96 F(19200000, P_XO, 1, 0, 0),
97 F(50000000, P_GPLL0, 16, 0, 0),
98 F(100000000, P_GPLL0, 8, 0, 0),
102 static struct clk_rcg2 pcnoc_bfdcd_clk_src = {
104 .freq_tbl = ftbl_pcnoc_bfdcd_clk_src,
106 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
107 .clkr.hw.init = &(struct clk_init_data){
108 .name = "pcnoc_bfdcd_clk_src",
109 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
111 .ops = &clk_rcg2_ops,
112 .flags = CLK_IS_CRITICAL,
116 static struct clk_fixed_factor pcnoc_clk_src = {
119 .hw.init = &(struct clk_init_data){
120 .name = "pcnoc_clk_src",
121 .parent_names = (const char *[]){
122 "pcnoc_bfdcd_clk_src"
125 .ops = &clk_fixed_factor_ops,
126 .flags = CLK_SET_RATE_PARENT,
130 static struct clk_branch gcc_sleep_clk_src = {
133 .enable_reg = 0x30000,
134 .enable_mask = BIT(1),
135 .hw.init = &(struct clk_init_data){
136 .name = "gcc_sleep_clk_src",
137 .parent_names = (const char *[]){
141 .ops = &clk_branch2_ops,
142 .flags = CLK_IS_CRITICAL,
147 static const struct freq_tbl ftbl_blsp1_qup_i2c_apps_clk_src[] = {
148 F(19200000, P_XO, 1, 0, 0),
149 F(25000000, P_GPLL0_DIV2, 16, 0, 0),
150 F(50000000, P_GPLL0, 16, 0, 0),
154 static struct clk_rcg2 blsp1_qup1_i2c_apps_clk_src = {
156 .freq_tbl = ftbl_blsp1_qup_i2c_apps_clk_src,
158 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
159 .clkr.hw.init = &(struct clk_init_data){
160 .name = "blsp1_qup1_i2c_apps_clk_src",
161 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
163 .ops = &clk_rcg2_ops,
167 static const struct freq_tbl ftbl_blsp1_qup_spi_apps_clk_src[] = {
168 F(960000, P_XO, 10, 1, 2),
169 F(4800000, P_XO, 4, 0, 0),
170 F(9600000, P_XO, 2, 0, 0),
171 F(12500000, P_GPLL0_DIV2, 16, 1, 2),
172 F(16000000, P_GPLL0, 10, 1, 5),
173 F(19200000, P_XO, 1, 0, 0),
174 F(25000000, P_GPLL0, 16, 1, 2),
175 F(50000000, P_GPLL0, 16, 0, 0),
179 static struct clk_rcg2 blsp1_qup1_spi_apps_clk_src = {
181 .freq_tbl = ftbl_blsp1_qup_spi_apps_clk_src,
184 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
185 .clkr.hw.init = &(struct clk_init_data){
186 .name = "blsp1_qup1_spi_apps_clk_src",
187 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
189 .ops = &clk_rcg2_ops,
193 static struct clk_rcg2 blsp1_qup2_i2c_apps_clk_src = {
195 .freq_tbl = ftbl_blsp1_qup_i2c_apps_clk_src,
197 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
198 .clkr.hw.init = &(struct clk_init_data){
199 .name = "blsp1_qup2_i2c_apps_clk_src",
200 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
202 .ops = &clk_rcg2_ops,
206 static struct clk_rcg2 blsp1_qup2_spi_apps_clk_src = {
208 .freq_tbl = ftbl_blsp1_qup_spi_apps_clk_src,
211 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
212 .clkr.hw.init = &(struct clk_init_data){
213 .name = "blsp1_qup2_spi_apps_clk_src",
214 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
216 .ops = &clk_rcg2_ops,
220 static struct clk_rcg2 blsp1_qup3_i2c_apps_clk_src = {
222 .freq_tbl = ftbl_blsp1_qup_i2c_apps_clk_src,
224 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
225 .clkr.hw.init = &(struct clk_init_data){
226 .name = "blsp1_qup3_i2c_apps_clk_src",
227 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
229 .ops = &clk_rcg2_ops,
233 static struct clk_rcg2 blsp1_qup3_spi_apps_clk_src = {
235 .freq_tbl = ftbl_blsp1_qup_spi_apps_clk_src,
238 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
239 .clkr.hw.init = &(struct clk_init_data){
240 .name = "blsp1_qup3_spi_apps_clk_src",
241 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
243 .ops = &clk_rcg2_ops,
247 static struct clk_rcg2 blsp1_qup4_i2c_apps_clk_src = {
249 .freq_tbl = ftbl_blsp1_qup_i2c_apps_clk_src,
251 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
252 .clkr.hw.init = &(struct clk_init_data){
253 .name = "blsp1_qup4_i2c_apps_clk_src",
254 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
256 .ops = &clk_rcg2_ops,
260 static struct clk_rcg2 blsp1_qup4_spi_apps_clk_src = {
262 .freq_tbl = ftbl_blsp1_qup_spi_apps_clk_src,
265 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
266 .clkr.hw.init = &(struct clk_init_data){
267 .name = "blsp1_qup4_spi_apps_clk_src",
268 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
270 .ops = &clk_rcg2_ops,
274 static struct clk_rcg2 blsp1_qup5_i2c_apps_clk_src = {
276 .freq_tbl = ftbl_blsp1_qup_i2c_apps_clk_src,
278 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
279 .clkr.hw.init = &(struct clk_init_data){
280 .name = "blsp1_qup5_i2c_apps_clk_src",
281 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
283 .ops = &clk_rcg2_ops,
287 static struct clk_rcg2 blsp1_qup5_spi_apps_clk_src = {
289 .freq_tbl = ftbl_blsp1_qup_spi_apps_clk_src,
292 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
293 .clkr.hw.init = &(struct clk_init_data){
294 .name = "blsp1_qup5_spi_apps_clk_src",
295 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
297 .ops = &clk_rcg2_ops,
301 static struct clk_rcg2 blsp1_qup6_i2c_apps_clk_src = {
303 .freq_tbl = ftbl_blsp1_qup_i2c_apps_clk_src,
305 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
306 .clkr.hw.init = &(struct clk_init_data){
307 .name = "blsp1_qup6_i2c_apps_clk_src",
308 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
310 .ops = &clk_rcg2_ops,
314 static struct clk_rcg2 blsp1_qup6_spi_apps_clk_src = {
316 .freq_tbl = ftbl_blsp1_qup_spi_apps_clk_src,
319 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
320 .clkr.hw.init = &(struct clk_init_data){
321 .name = "blsp1_qup6_spi_apps_clk_src",
322 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
324 .ops = &clk_rcg2_ops,
328 static const struct freq_tbl ftbl_blsp1_uart_apps_clk_src[] = {
329 F(3686400, P_GPLL0_DIV2, 1, 144, 15625),
330 F(7372800, P_GPLL0_DIV2, 1, 288, 15625),
331 F(14745600, P_GPLL0_DIV2, 1, 576, 15625),
332 F(16000000, P_GPLL0_DIV2, 5, 1, 5),
333 F(19200000, P_XO, 1, 0, 0),
334 F(24000000, P_GPLL0, 1, 3, 100),
335 F(25000000, P_GPLL0, 16, 1, 2),
336 F(32000000, P_GPLL0, 1, 1, 25),
337 F(40000000, P_GPLL0, 1, 1, 20),
338 F(46400000, P_GPLL0, 1, 29, 500),
339 F(48000000, P_GPLL0, 1, 3, 50),
340 F(51200000, P_GPLL0, 1, 8, 125),
341 F(56000000, P_GPLL0, 1, 7, 100),
342 F(58982400, P_GPLL0, 1, 1152, 15625),
343 F(60000000, P_GPLL0, 1, 3, 40),
344 F(64000000, P_GPLL0, 12.5, 1, 1),
348 static struct clk_rcg2 blsp1_uart1_apps_clk_src = {
350 .freq_tbl = ftbl_blsp1_uart_apps_clk_src,
353 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
354 .clkr.hw.init = &(struct clk_init_data){
355 .name = "blsp1_uart1_apps_clk_src",
356 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
358 .ops = &clk_rcg2_ops,
362 static struct clk_rcg2 blsp1_uart2_apps_clk_src = {
364 .freq_tbl = ftbl_blsp1_uart_apps_clk_src,
367 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
368 .clkr.hw.init = &(struct clk_init_data){
369 .name = "blsp1_uart2_apps_clk_src",
370 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
372 .ops = &clk_rcg2_ops,
376 static struct clk_rcg2 blsp1_uart3_apps_clk_src = {
378 .freq_tbl = ftbl_blsp1_uart_apps_clk_src,
381 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
382 .clkr.hw.init = &(struct clk_init_data){
383 .name = "blsp1_uart3_apps_clk_src",
384 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
386 .ops = &clk_rcg2_ops,
390 static struct clk_rcg2 blsp1_uart4_apps_clk_src = {
392 .freq_tbl = ftbl_blsp1_uart_apps_clk_src,
395 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
396 .clkr.hw.init = &(struct clk_init_data){
397 .name = "blsp1_uart4_apps_clk_src",
398 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
400 .ops = &clk_rcg2_ops,
404 static struct clk_rcg2 blsp1_uart5_apps_clk_src = {
406 .freq_tbl = ftbl_blsp1_uart_apps_clk_src,
409 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
410 .clkr.hw.init = &(struct clk_init_data){
411 .name = "blsp1_uart5_apps_clk_src",
412 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
414 .ops = &clk_rcg2_ops,
418 static struct clk_rcg2 blsp1_uart6_apps_clk_src = {
420 .freq_tbl = ftbl_blsp1_uart_apps_clk_src,
423 .parent_map = gcc_xo_gpll0_gpll0_out_main_div2_map,
424 .clkr.hw.init = &(struct clk_init_data){
425 .name = "blsp1_uart6_apps_clk_src",
426 .parent_names = gcc_xo_gpll0_gpll0_out_main_div2,
428 .ops = &clk_rcg2_ops,
432 static struct clk_branch gcc_blsp1_ahb_clk = {
435 .enable_reg = 0x01008,
436 .enable_mask = BIT(0),
437 .hw.init = &(struct clk_init_data){
438 .name = "gcc_blsp1_ahb_clk",
439 .parent_names = (const char *[]){
443 .flags = CLK_SET_RATE_PARENT,
444 .ops = &clk_branch2_ops,
449 static struct clk_branch gcc_blsp1_qup1_i2c_apps_clk = {
452 .enable_reg = 0x02008,
453 .enable_mask = BIT(0),
454 .hw.init = &(struct clk_init_data){
455 .name = "gcc_blsp1_qup1_i2c_apps_clk",
456 .parent_names = (const char *[]){
457 "blsp1_qup1_i2c_apps_clk_src"
460 .flags = CLK_SET_RATE_PARENT,
461 .ops = &clk_branch2_ops,
466 static struct clk_branch gcc_blsp1_qup1_spi_apps_clk = {
469 .enable_reg = 0x02004,
470 .enable_mask = BIT(0),
471 .hw.init = &(struct clk_init_data){
472 .name = "gcc_blsp1_qup1_spi_apps_clk",
473 .parent_names = (const char *[]){
474 "blsp1_qup1_spi_apps_clk_src"
477 .flags = CLK_SET_RATE_PARENT,
478 .ops = &clk_branch2_ops,
483 static struct clk_branch gcc_blsp1_qup2_i2c_apps_clk = {
486 .enable_reg = 0x03010,
487 .enable_mask = BIT(0),
488 .hw.init = &(struct clk_init_data){
489 .name = "gcc_blsp1_qup2_i2c_apps_clk",
490 .parent_names = (const char *[]){
491 "blsp1_qup2_i2c_apps_clk_src"
494 .flags = CLK_SET_RATE_PARENT,
495 .ops = &clk_branch2_ops,
500 static struct clk_branch gcc_blsp1_qup2_spi_apps_clk = {
503 .enable_reg = 0x0300c,
504 .enable_mask = BIT(0),
505 .hw.init = &(struct clk_init_data){
506 .name = "gcc_blsp1_qup2_spi_apps_clk",
507 .parent_names = (const char *[]){
508 "blsp1_qup2_spi_apps_clk_src"
511 .flags = CLK_SET_RATE_PARENT,
512 .ops = &clk_branch2_ops,
517 static struct clk_branch gcc_blsp1_qup3_i2c_apps_clk = {
520 .enable_reg = 0x04010,
521 .enable_mask = BIT(0),
522 .hw.init = &(struct clk_init_data){
523 .name = "gcc_blsp1_qup3_i2c_apps_clk",
524 .parent_names = (const char *[]){
525 "blsp1_qup3_i2c_apps_clk_src"
528 .flags = CLK_SET_RATE_PARENT,
529 .ops = &clk_branch2_ops,
534 static struct clk_branch gcc_blsp1_qup3_spi_apps_clk = {
537 .enable_reg = 0x0400c,
538 .enable_mask = BIT(0),
539 .hw.init = &(struct clk_init_data){
540 .name = "gcc_blsp1_qup3_spi_apps_clk",
541 .parent_names = (const char *[]){
542 "blsp1_qup3_spi_apps_clk_src"
545 .flags = CLK_SET_RATE_PARENT,
546 .ops = &clk_branch2_ops,
551 static struct clk_branch gcc_blsp1_qup4_i2c_apps_clk = {
554 .enable_reg = 0x05010,
555 .enable_mask = BIT(0),
556 .hw.init = &(struct clk_init_data){
557 .name = "gcc_blsp1_qup4_i2c_apps_clk",
558 .parent_names = (const char *[]){
559 "blsp1_qup4_i2c_apps_clk_src"
562 .flags = CLK_SET_RATE_PARENT,
563 .ops = &clk_branch2_ops,
568 static struct clk_branch gcc_blsp1_qup4_spi_apps_clk = {
571 .enable_reg = 0x0500c,
572 .enable_mask = BIT(0),
573 .hw.init = &(struct clk_init_data){
574 .name = "gcc_blsp1_qup4_spi_apps_clk",
575 .parent_names = (const char *[]){
576 "blsp1_qup4_spi_apps_clk_src"
579 .flags = CLK_SET_RATE_PARENT,
580 .ops = &clk_branch2_ops,
585 static struct clk_branch gcc_blsp1_qup5_i2c_apps_clk = {
588 .enable_reg = 0x06010,
589 .enable_mask = BIT(0),
590 .hw.init = &(struct clk_init_data){
591 .name = "gcc_blsp1_qup5_i2c_apps_clk",
592 .parent_names = (const char *[]){
593 "blsp1_qup5_i2c_apps_clk_src"
596 .flags = CLK_SET_RATE_PARENT,
597 .ops = &clk_branch2_ops,
602 static struct clk_branch gcc_blsp1_qup5_spi_apps_clk = {
605 .enable_reg = 0x0600c,
606 .enable_mask = BIT(0),
607 .hw.init = &(struct clk_init_data){
608 .name = "gcc_blsp1_qup5_spi_apps_clk",
609 .parent_names = (const char *[]){
610 "blsp1_qup5_spi_apps_clk_src"
613 .flags = CLK_SET_RATE_PARENT,
614 .ops = &clk_branch2_ops,
619 static struct clk_branch gcc_blsp1_qup6_i2c_apps_clk = {
622 .enable_reg = 0x07010,
623 .enable_mask = BIT(0),
624 .hw.init = &(struct clk_init_data){
625 .name = "gcc_blsp1_qup6_i2c_apps_clk",
626 .parent_names = (const char *[]){
627 "blsp1_qup6_i2c_apps_clk_src"
630 .flags = CLK_SET_RATE_PARENT,
631 .ops = &clk_branch2_ops,
636 static struct clk_branch gcc_blsp1_qup6_spi_apps_clk = {
639 .enable_reg = 0x0700c,
640 .enable_mask = BIT(0),
641 .hw.init = &(struct clk_init_data){
642 .name = "gcc_blsp1_qup6_spi_apps_clk",
643 .parent_names = (const char *[]){
644 "blsp1_qup6_spi_apps_clk_src"
647 .flags = CLK_SET_RATE_PARENT,
648 .ops = &clk_branch2_ops,
653 static struct clk_branch gcc_blsp1_uart1_apps_clk = {
656 .enable_reg = 0x0203c,
657 .enable_mask = BIT(0),
658 .hw.init = &(struct clk_init_data){
659 .name = "gcc_blsp1_uart1_apps_clk",
660 .parent_names = (const char *[]){
661 "blsp1_uart1_apps_clk_src"
664 .flags = CLK_SET_RATE_PARENT,
665 .ops = &clk_branch2_ops,
670 static struct clk_branch gcc_blsp1_uart2_apps_clk = {
673 .enable_reg = 0x0302c,
674 .enable_mask = BIT(0),
675 .hw.init = &(struct clk_init_data){
676 .name = "gcc_blsp1_uart2_apps_clk",
677 .parent_names = (const char *[]){
678 "blsp1_uart2_apps_clk_src"
681 .flags = CLK_SET_RATE_PARENT,
682 .ops = &clk_branch2_ops,
687 static struct clk_branch gcc_blsp1_uart3_apps_clk = {
690 .enable_reg = 0x0402c,
691 .enable_mask = BIT(0),
692 .hw.init = &(struct clk_init_data){
693 .name = "gcc_blsp1_uart3_apps_clk",
694 .parent_names = (const char *[]){
695 "blsp1_uart3_apps_clk_src"
698 .flags = CLK_SET_RATE_PARENT,
699 .ops = &clk_branch2_ops,
704 static struct clk_branch gcc_blsp1_uart4_apps_clk = {
707 .enable_reg = 0x0502c,
708 .enable_mask = BIT(0),
709 .hw.init = &(struct clk_init_data){
710 .name = "gcc_blsp1_uart4_apps_clk",
711 .parent_names = (const char *[]){
712 "blsp1_uart4_apps_clk_src"
715 .flags = CLK_SET_RATE_PARENT,
716 .ops = &clk_branch2_ops,
721 static struct clk_branch gcc_blsp1_uart5_apps_clk = {
724 .enable_reg = 0x0602c,
725 .enable_mask = BIT(0),
726 .hw.init = &(struct clk_init_data){
727 .name = "gcc_blsp1_uart5_apps_clk",
728 .parent_names = (const char *[]){
729 "blsp1_uart5_apps_clk_src"
732 .flags = CLK_SET_RATE_PARENT,
733 .ops = &clk_branch2_ops,
738 static struct clk_branch gcc_blsp1_uart6_apps_clk = {
741 .enable_reg = 0x0702c,
742 .enable_mask = BIT(0),
743 .hw.init = &(struct clk_init_data){
744 .name = "gcc_blsp1_uart6_apps_clk",
745 .parent_names = (const char *[]){
746 "blsp1_uart6_apps_clk_src"
749 .flags = CLK_SET_RATE_PARENT,
750 .ops = &clk_branch2_ops,
755 static struct clk_branch gcc_prng_ahb_clk = {
757 .halt_check = BRANCH_HALT_VOTED,
759 .enable_reg = 0x0b004,
760 .enable_mask = BIT(8),
761 .hw.init = &(struct clk_init_data){
762 .name = "gcc_prng_ahb_clk",
763 .parent_names = (const char *[]){
767 .flags = CLK_SET_RATE_PARENT,
768 .ops = &clk_branch2_ops,
773 static struct clk_branch gcc_qpic_ahb_clk = {
776 .enable_reg = 0x57024,
777 .enable_mask = BIT(0),
778 .hw.init = &(struct clk_init_data){
779 .name = "gcc_qpic_ahb_clk",
780 .parent_names = (const char *[]){
784 .flags = CLK_SET_RATE_PARENT,
785 .ops = &clk_branch2_ops,
790 static struct clk_branch gcc_qpic_clk = {
793 .enable_reg = 0x57020,
794 .enable_mask = BIT(0),
795 .hw.init = &(struct clk_init_data){
796 .name = "gcc_qpic_clk",
797 .parent_names = (const char *[]){
801 .flags = CLK_SET_RATE_PARENT,
802 .ops = &clk_branch2_ops,
807 static struct clk_hw *gcc_ipq8074_hws[] = {
808 &gpll0_out_main_div2.hw,
812 static struct clk_regmap *gcc_ipq8074_clks[] = {
813 [GPLL0_MAIN] = &gpll0_main.clkr,
814 [GPLL0] = &gpll0.clkr,
815 [PCNOC_BFDCD_CLK_SRC] = &pcnoc_bfdcd_clk_src.clkr,
816 [GCC_SLEEP_CLK_SRC] = &gcc_sleep_clk_src.clkr,
817 [BLSP1_QUP1_I2C_APPS_CLK_SRC] = &blsp1_qup1_i2c_apps_clk_src.clkr,
818 [BLSP1_QUP1_SPI_APPS_CLK_SRC] = &blsp1_qup1_spi_apps_clk_src.clkr,
819 [BLSP1_QUP2_I2C_APPS_CLK_SRC] = &blsp1_qup2_i2c_apps_clk_src.clkr,
820 [BLSP1_QUP2_SPI_APPS_CLK_SRC] = &blsp1_qup2_spi_apps_clk_src.clkr,
821 [BLSP1_QUP3_I2C_APPS_CLK_SRC] = &blsp1_qup3_i2c_apps_clk_src.clkr,
822 [BLSP1_QUP3_SPI_APPS_CLK_SRC] = &blsp1_qup3_spi_apps_clk_src.clkr,
823 [BLSP1_QUP4_I2C_APPS_CLK_SRC] = &blsp1_qup4_i2c_apps_clk_src.clkr,
824 [BLSP1_QUP4_SPI_APPS_CLK_SRC] = &blsp1_qup4_spi_apps_clk_src.clkr,
825 [BLSP1_QUP5_I2C_APPS_CLK_SRC] = &blsp1_qup5_i2c_apps_clk_src.clkr,
826 [BLSP1_QUP5_SPI_APPS_CLK_SRC] = &blsp1_qup5_spi_apps_clk_src.clkr,
827 [BLSP1_QUP6_I2C_APPS_CLK_SRC] = &blsp1_qup6_i2c_apps_clk_src.clkr,
828 [BLSP1_QUP6_SPI_APPS_CLK_SRC] = &blsp1_qup6_spi_apps_clk_src.clkr,
829 [BLSP1_UART1_APPS_CLK_SRC] = &blsp1_uart1_apps_clk_src.clkr,
830 [BLSP1_UART2_APPS_CLK_SRC] = &blsp1_uart2_apps_clk_src.clkr,
831 [BLSP1_UART3_APPS_CLK_SRC] = &blsp1_uart3_apps_clk_src.clkr,
832 [BLSP1_UART4_APPS_CLK_SRC] = &blsp1_uart4_apps_clk_src.clkr,
833 [BLSP1_UART5_APPS_CLK_SRC] = &blsp1_uart5_apps_clk_src.clkr,
834 [BLSP1_UART6_APPS_CLK_SRC] = &blsp1_uart6_apps_clk_src.clkr,
835 [GCC_BLSP1_AHB_CLK] = &gcc_blsp1_ahb_clk.clkr,
836 [GCC_BLSP1_QUP1_I2C_APPS_CLK] = &gcc_blsp1_qup1_i2c_apps_clk.clkr,
837 [GCC_BLSP1_QUP1_SPI_APPS_CLK] = &gcc_blsp1_qup1_spi_apps_clk.clkr,
838 [GCC_BLSP1_QUP2_I2C_APPS_CLK] = &gcc_blsp1_qup2_i2c_apps_clk.clkr,
839 [GCC_BLSP1_QUP2_SPI_APPS_CLK] = &gcc_blsp1_qup2_spi_apps_clk.clkr,
840 [GCC_BLSP1_QUP3_I2C_APPS_CLK] = &gcc_blsp1_qup3_i2c_apps_clk.clkr,
841 [GCC_BLSP1_QUP3_SPI_APPS_CLK] = &gcc_blsp1_qup3_spi_apps_clk.clkr,
842 [GCC_BLSP1_QUP4_I2C_APPS_CLK] = &gcc_blsp1_qup4_i2c_apps_clk.clkr,
843 [GCC_BLSP1_QUP4_SPI_APPS_CLK] = &gcc_blsp1_qup4_spi_apps_clk.clkr,
844 [GCC_BLSP1_QUP5_I2C_APPS_CLK] = &gcc_blsp1_qup5_i2c_apps_clk.clkr,
845 [GCC_BLSP1_QUP5_SPI_APPS_CLK] = &gcc_blsp1_qup5_spi_apps_clk.clkr,
846 [GCC_BLSP1_QUP6_I2C_APPS_CLK] = &gcc_blsp1_qup6_i2c_apps_clk.clkr,
847 [GCC_BLSP1_QUP6_SPI_APPS_CLK] = &gcc_blsp1_qup6_spi_apps_clk.clkr,
848 [GCC_BLSP1_UART1_APPS_CLK] = &gcc_blsp1_uart1_apps_clk.clkr,
849 [GCC_BLSP1_UART2_APPS_CLK] = &gcc_blsp1_uart2_apps_clk.clkr,
850 [GCC_BLSP1_UART3_APPS_CLK] = &gcc_blsp1_uart3_apps_clk.clkr,
851 [GCC_BLSP1_UART4_APPS_CLK] = &gcc_blsp1_uart4_apps_clk.clkr,
852 [GCC_BLSP1_UART5_APPS_CLK] = &gcc_blsp1_uart5_apps_clk.clkr,
853 [GCC_BLSP1_UART6_APPS_CLK] = &gcc_blsp1_uart6_apps_clk.clkr,
854 [GCC_PRNG_AHB_CLK] = &gcc_prng_ahb_clk.clkr,
855 [GCC_QPIC_AHB_CLK] = &gcc_qpic_ahb_clk.clkr,
856 [GCC_QPIC_CLK] = &gcc_qpic_clk.clkr,
859 static const struct qcom_reset_map gcc_ipq8074_resets[] = {
860 [GCC_BLSP1_BCR] = { 0x01000, 0 },
861 [GCC_BLSP1_QUP1_BCR] = { 0x02000, 0 },
862 [GCC_BLSP1_UART1_BCR] = { 0x02038, 0 },
863 [GCC_BLSP1_QUP2_BCR] = { 0x03008, 0 },
864 [GCC_BLSP1_UART2_BCR] = { 0x03028, 0 },
865 [GCC_BLSP1_QUP3_BCR] = { 0x04008, 0 },
866 [GCC_BLSP1_UART3_BCR] = { 0x04028, 0 },
867 [GCC_BLSP1_QUP4_BCR] = { 0x05008, 0 },
868 [GCC_BLSP1_UART4_BCR] = { 0x05028, 0 },
869 [GCC_BLSP1_QUP5_BCR] = { 0x06008, 0 },
870 [GCC_BLSP1_UART5_BCR] = { 0x06028, 0 },
871 [GCC_BLSP1_QUP6_BCR] = { 0x07008, 0 },
872 [GCC_BLSP1_UART6_BCR] = { 0x07028, 0 },
873 [GCC_IMEM_BCR] = { 0x0e000, 0 },
874 [GCC_SMMU_BCR] = { 0x12000, 0 },
875 [GCC_APSS_TCU_BCR] = { 0x12050, 0 },
876 [GCC_SMMU_XPU_BCR] = { 0x12054, 0 },
877 [GCC_PCNOC_TBU_BCR] = { 0x12058, 0 },
878 [GCC_SMMU_CFG_BCR] = { 0x1208c, 0 },
879 [GCC_PRNG_BCR] = { 0x13000, 0 },
880 [GCC_BOOT_ROM_BCR] = { 0x13008, 0 },
881 [GCC_CRYPTO_BCR] = { 0x16000, 0 },
882 [GCC_WCSS_BCR] = { 0x18000, 0 },
883 [GCC_WCSS_Q6_BCR] = { 0x18100, 0 },
884 [GCC_NSS_BCR] = { 0x19000, 0 },
885 [GCC_SEC_CTRL_BCR] = { 0x1a000, 0 },
886 [GCC_ADSS_BCR] = { 0x1c000, 0 },
887 [GCC_DDRSS_BCR] = { 0x1e000, 0 },
888 [GCC_SYSTEM_NOC_BCR] = { 0x26000, 0 },
889 [GCC_PCNOC_BCR] = { 0x27018, 0 },
890 [GCC_TCSR_BCR] = { 0x28000, 0 },
891 [GCC_QDSS_BCR] = { 0x29000, 0 },
892 [GCC_DCD_BCR] = { 0x2a000, 0 },
893 [GCC_MSG_RAM_BCR] = { 0x2b000, 0 },
894 [GCC_MPM_BCR] = { 0x2c000, 0 },
895 [GCC_SPMI_BCR] = { 0x2e000, 0 },
896 [GCC_SPDM_BCR] = { 0x2f000, 0 },
897 [GCC_RBCPR_BCR] = { 0x33000, 0 },
898 [GCC_RBCPR_MX_BCR] = { 0x33014, 0 },
899 [GCC_TLMM_BCR] = { 0x34000, 0 },
900 [GCC_RBCPR_WCSS_BCR] = { 0x3a000, 0 },
901 [GCC_USB0_PHY_BCR] = { 0x3e034, 0 },
902 [GCC_USB3PHY_0_PHY_BCR] = { 0x3e03c, 0 },
903 [GCC_USB0_BCR] = { 0x3e070, 0 },
904 [GCC_USB1_PHY_BCR] = { 0x3f034, 0 },
905 [GCC_USB3PHY_1_PHY_BCR] = { 0x3f03c, 0 },
906 [GCC_USB1_BCR] = { 0x3f070, 0 },
907 [GCC_QUSB2_0_PHY_BCR] = { 0x4103c, 0 },
908 [GCC_QUSB2_1_PHY_BCR] = { 0x41040, 0 },
909 [GCC_SDCC1_BCR] = { 0x42000, 0 },
910 [GCC_SDCC2_BCR] = { 0x43000, 0 },
911 [GCC_SNOC_BUS_TIMEOUT0_BCR] = { 0x47000, 0 },
912 [GCC_SNOC_BUS_TIMEOUT2_BCR] = { 0x47008, 0 },
913 [GCC_SNOC_BUS_TIMEOUT3_BCR] = { 0x47010, 0 },
914 [GCC_PCNOC_BUS_TIMEOUT0_BCR] = { 0x48000, 0 },
915 [GCC_PCNOC_BUS_TIMEOUT1_BCR] = { 0x48008, 0 },
916 [GCC_PCNOC_BUS_TIMEOUT2_BCR] = { 0x48010, 0 },
917 [GCC_PCNOC_BUS_TIMEOUT3_BCR] = { 0x48018, 0 },
918 [GCC_PCNOC_BUS_TIMEOUT4_BCR] = { 0x48020, 0 },
919 [GCC_PCNOC_BUS_TIMEOUT5_BCR] = { 0x48028, 0 },
920 [GCC_PCNOC_BUS_TIMEOUT6_BCR] = { 0x48030, 0 },
921 [GCC_PCNOC_BUS_TIMEOUT7_BCR] = { 0x48038, 0 },
922 [GCC_PCNOC_BUS_TIMEOUT8_BCR] = { 0x48040, 0 },
923 [GCC_PCNOC_BUS_TIMEOUT9_BCR] = { 0x48048, 0 },
924 [GCC_UNIPHY0_BCR] = { 0x56000, 0 },
925 [GCC_UNIPHY1_BCR] = { 0x56100, 0 },
926 [GCC_UNIPHY2_BCR] = { 0x56200, 0 },
927 [GCC_CMN_12GPLL_BCR] = { 0x56300, 0 },
928 [GCC_QPIC_BCR] = { 0x57018, 0 },
929 [GCC_MDIO_BCR] = { 0x58000, 0 },
930 [GCC_PCIE1_TBU_BCR] = { 0x65000, 0 },
931 [GCC_WCSS_CORE_TBU_BCR] = { 0x66000, 0 },
932 [GCC_WCSS_Q6_TBU_BCR] = { 0x67000, 0 },
933 [GCC_USB0_TBU_BCR] = { 0x6a000, 0 },
934 [GCC_USB1_TBU_BCR] = { 0x6a004, 0 },
935 [GCC_PCIE0_TBU_BCR] = { 0x6b000, 0 },
936 [GCC_NSS_NOC_TBU_BCR] = { 0x6e000, 0 },
937 [GCC_PCIE0_BCR] = { 0x75004, 0 },
938 [GCC_PCIE0_PHY_BCR] = { 0x75038, 0 },
939 [GCC_PCIE0PHY_PHY_BCR] = { 0x7503c, 0 },
940 [GCC_PCIE0_LINK_DOWN_BCR] = { 0x75044, 0 },
941 [GCC_PCIE1_BCR] = { 0x76004, 0 },
942 [GCC_PCIE1_PHY_BCR] = { 0x76038, 0 },
943 [GCC_PCIE1PHY_PHY_BCR] = { 0x7603c, 0 },
944 [GCC_PCIE1_LINK_DOWN_BCR] = { 0x76044, 0 },
945 [GCC_DCC_BCR] = { 0x77000, 0 },
946 [GCC_APC0_VOLTAGE_DROOP_DETECTOR_BCR] = { 0x78000, 0 },
947 [GCC_APC1_VOLTAGE_DROOP_DETECTOR_BCR] = { 0x79000, 0 },
948 [GCC_SMMU_CATS_BCR] = { 0x7c000, 0 },
951 static const struct of_device_id gcc_ipq8074_match_table[] = {
952 { .compatible = "qcom,gcc-ipq8074" },
955 MODULE_DEVICE_TABLE(of, gcc_ipq8074_match_table);
957 static const struct regmap_config gcc_ipq8074_regmap_config = {
961 .max_register = 0x7fffc,
965 static const struct qcom_cc_desc gcc_ipq8074_desc = {
966 .config = &gcc_ipq8074_regmap_config,
967 .clks = gcc_ipq8074_clks,
968 .num_clks = ARRAY_SIZE(gcc_ipq8074_clks),
969 .resets = gcc_ipq8074_resets,
970 .num_resets = ARRAY_SIZE(gcc_ipq8074_resets),
973 static int gcc_ipq8074_probe(struct platform_device *pdev)
977 for (i = 0; i < ARRAY_SIZE(gcc_ipq8074_hws); i++) {
978 ret = devm_clk_hw_register(&pdev->dev, gcc_ipq8074_hws[i]);
983 return qcom_cc_probe(pdev, &gcc_ipq8074_desc);
986 static struct platform_driver gcc_ipq8074_driver = {
987 .probe = gcc_ipq8074_probe,
989 .name = "qcom,gcc-ipq8074",
990 .of_match_table = gcc_ipq8074_match_table,
994 static int __init gcc_ipq8074_init(void)
996 return platform_driver_register(&gcc_ipq8074_driver);
998 core_initcall(gcc_ipq8074_init);
1000 static void __exit gcc_ipq8074_exit(void)
1002 platform_driver_unregister(&gcc_ipq8074_driver);
1004 module_exit(gcc_ipq8074_exit);
1006 MODULE_DESCRIPTION("QCOM GCC IPQ8074 Driver");
1007 MODULE_LICENSE("GPL v2");
1008 MODULE_ALIAS("platform:gcc-ipq8074");