2 * Copyright (c) 2015 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>
22 #include <linux/reset-controller.h>
23 #include <linux/math64.h>
24 #include <linux/delay.h>
26 #include <dt-bindings/clock/qcom,gcc-ipq4019.h>
29 #include "clk-regmap.h"
31 #include "clk-branch.h"
33 #include "clk-regmap-divider.h"
35 #define to_clk_regmap_div(_hw) container_of(to_clk_regmap(_hw),\
36 struct clk_regmap_div, clkr)
38 #define to_clk_fepll(_hw) container_of(to_clk_regmap_div(_hw),\
39 struct clk_fepll, cdiv)
53 * struct clk_fepll_vco - vco feedback divider corresponds for FEPLL clocks
54 * @fdbkdiv_shift: lowest bit for FDBKDIV
55 * @fdbkdiv_width: number of bits in FDBKDIV
56 * @refclkdiv_shift: lowest bit for REFCLKDIV
57 * @refclkdiv_width: number of bits in REFCLKDIV
58 * @reg: PLL_DIV register address
60 struct clk_fepll_vco
{
69 * struct clk_fepll - clk divider corresponds to FEPLL clocks
70 * @fixed_div: fixed divider value if divider is fixed
71 * @parent_map: map from software's parent index to hardware's src_sel field
72 * @cdiv: divider values for PLL_DIV
73 * @pll_vco: vco feedback divider
74 * @div_table: mapping for actual divider value to register divider value
75 * in case of non fixed divider
76 * @freq_tbl: frequency table
81 struct clk_regmap_div cdiv
;
82 const struct clk_fepll_vco
*pll_vco
;
83 const struct clk_div_table
*div_table
;
84 const struct freq_tbl
*freq_tbl
;
87 static struct parent_map gcc_xo_200_500_map
[] = {
93 static const char * const gcc_xo_200_500
[] = {
99 static struct parent_map gcc_xo_200_map
[] = {
104 static const char * const gcc_xo_200
[] = {
109 static struct parent_map gcc_xo_200_spi_map
[] = {
114 static const char * const gcc_xo_200_spi
[] = {
119 static struct parent_map gcc_xo_sdcc1_500_map
[] = {
125 static const char * const gcc_xo_sdcc1_500
[] = {
131 static struct parent_map gcc_xo_wcss2g_map
[] = {
133 { P_FEPLLWCSS2G
, 1 },
136 static const char * const gcc_xo_wcss2g
[] = {
141 static struct parent_map gcc_xo_wcss5g_map
[] = {
143 { P_FEPLLWCSS5G
, 1 },
146 static const char * const gcc_xo_wcss5g
[] = {
151 static struct parent_map gcc_xo_125_dly_map
[] = {
153 { P_FEPLL125DLY
, 1 },
156 static const char * const gcc_xo_125_dly
[] = {
161 static struct parent_map gcc_xo_ddr_500_200_map
[] = {
168 static const char * const gcc_xo_ddr_500_200
[] = {
175 #define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) }
177 static const struct freq_tbl ftbl_gcc_audio_pwm_clk
[] = {
178 F(48000000, P_XO
, 1, 0, 0),
179 F(200000000, P_FEPLL200
, 1, 0, 0),
183 static struct clk_rcg2 audio_clk_src
= {
186 .parent_map
= gcc_xo_200_map
,
187 .freq_tbl
= ftbl_gcc_audio_pwm_clk
,
188 .clkr
.hw
.init
= &(struct clk_init_data
){
189 .name
= "audio_clk_src",
190 .parent_names
= gcc_xo_200
,
192 .ops
= &clk_rcg2_ops
,
197 static struct clk_branch gcc_audio_ahb_clk
= {
200 .enable_reg
= 0x1b010,
201 .enable_mask
= BIT(0),
202 .hw
.init
= &(struct clk_init_data
){
203 .name
= "gcc_audio_ahb_clk",
204 .parent_names
= (const char *[]){
207 .flags
= CLK_SET_RATE_PARENT
,
209 .ops
= &clk_branch2_ops
,
214 static struct clk_branch gcc_audio_pwm_clk
= {
217 .enable_reg
= 0x1b00C,
218 .enable_mask
= BIT(0),
219 .hw
.init
= &(struct clk_init_data
){
220 .name
= "gcc_audio_pwm_clk",
221 .parent_names
= (const char *[]){
224 .flags
= CLK_SET_RATE_PARENT
,
226 .ops
= &clk_branch2_ops
,
231 static const struct freq_tbl ftbl_gcc_blsp1_qup1_2_i2c_apps_clk
[] = {
232 F(19050000, P_FEPLL200
, 10.5, 1, 1),
236 static struct clk_rcg2 blsp1_qup1_i2c_apps_clk_src
= {
239 .parent_map
= gcc_xo_200_map
,
240 .freq_tbl
= ftbl_gcc_blsp1_qup1_2_i2c_apps_clk
,
241 .clkr
.hw
.init
= &(struct clk_init_data
){
242 .name
= "blsp1_qup1_i2c_apps_clk_src",
243 .parent_names
= gcc_xo_200
,
245 .ops
= &clk_rcg2_ops
,
249 static struct clk_branch gcc_blsp1_qup1_i2c_apps_clk
= {
252 .enable_reg
= 0x2008,
253 .enable_mask
= BIT(0),
254 .hw
.init
= &(struct clk_init_data
){
255 .name
= "gcc_blsp1_qup1_i2c_apps_clk",
256 .parent_names
= (const char *[]){
257 "blsp1_qup1_i2c_apps_clk_src",
260 .ops
= &clk_branch2_ops
,
261 .flags
= CLK_SET_RATE_PARENT
,
266 static struct clk_rcg2 blsp1_qup2_i2c_apps_clk_src
= {
269 .parent_map
= gcc_xo_200_map
,
270 .freq_tbl
= ftbl_gcc_blsp1_qup1_2_i2c_apps_clk
,
271 .clkr
.hw
.init
= &(struct clk_init_data
){
272 .name
= "blsp1_qup2_i2c_apps_clk_src",
273 .parent_names
= gcc_xo_200
,
275 .ops
= &clk_rcg2_ops
,
279 static struct clk_branch gcc_blsp1_qup2_i2c_apps_clk
= {
282 .enable_reg
= 0x3010,
283 .enable_mask
= BIT(0),
284 .hw
.init
= &(struct clk_init_data
){
285 .name
= "gcc_blsp1_qup2_i2c_apps_clk",
286 .parent_names
= (const char *[]){
287 "blsp1_qup2_i2c_apps_clk_src",
290 .ops
= &clk_branch2_ops
,
291 .flags
= CLK_SET_RATE_PARENT
,
296 static const struct freq_tbl ftbl_gcc_blsp1_qup1_2_spi_apps_clk
[] = {
297 F(960000, P_XO
, 12, 1, 4),
298 F(4800000, P_XO
, 1, 1, 10),
299 F(9600000, P_XO
, 1, 1, 5),
300 F(15000000, P_XO
, 1, 1, 3),
301 F(19200000, P_XO
, 1, 2, 5),
302 F(24000000, P_XO
, 1, 1, 2),
303 F(48000000, P_XO
, 1, 0, 0),
307 static struct clk_rcg2 blsp1_qup1_spi_apps_clk_src
= {
311 .parent_map
= gcc_xo_200_spi_map
,
312 .freq_tbl
= ftbl_gcc_blsp1_qup1_2_spi_apps_clk
,
313 .clkr
.hw
.init
= &(struct clk_init_data
){
314 .name
= "blsp1_qup1_spi_apps_clk_src",
315 .parent_names
= gcc_xo_200_spi
,
317 .ops
= &clk_rcg2_ops
,
321 static struct clk_branch gcc_blsp1_qup1_spi_apps_clk
= {
324 .enable_reg
= 0x2004,
325 .enable_mask
= BIT(0),
326 .hw
.init
= &(struct clk_init_data
){
327 .name
= "gcc_blsp1_qup1_spi_apps_clk",
328 .parent_names
= (const char *[]){
329 "blsp1_qup1_spi_apps_clk_src",
332 .ops
= &clk_branch2_ops
,
333 .flags
= CLK_SET_RATE_PARENT
,
338 static struct clk_rcg2 blsp1_qup2_spi_apps_clk_src
= {
342 .freq_tbl
= ftbl_gcc_blsp1_qup1_2_spi_apps_clk
,
343 .parent_map
= gcc_xo_200_spi_map
,
344 .clkr
.hw
.init
= &(struct clk_init_data
){
345 .name
= "blsp1_qup2_spi_apps_clk_src",
346 .parent_names
= gcc_xo_200_spi
,
348 .ops
= &clk_rcg2_ops
,
352 static struct clk_branch gcc_blsp1_qup2_spi_apps_clk
= {
355 .enable_reg
= 0x300c,
356 .enable_mask
= BIT(0),
357 .hw
.init
= &(struct clk_init_data
){
358 .name
= "gcc_blsp1_qup2_spi_apps_clk",
359 .parent_names
= (const char *[]){
360 "blsp1_qup2_spi_apps_clk_src",
363 .ops
= &clk_branch2_ops
,
364 .flags
= CLK_SET_RATE_PARENT
,
369 static const struct freq_tbl ftbl_gcc_blsp1_uart1_2_apps_clk
[] = {
370 F(1843200, P_FEPLL200
, 1, 144, 15625),
371 F(3686400, P_FEPLL200
, 1, 288, 15625),
372 F(7372800, P_FEPLL200
, 1, 576, 15625),
373 F(14745600, P_FEPLL200
, 1, 1152, 15625),
374 F(16000000, P_FEPLL200
, 1, 2, 25),
375 F(24000000, P_XO
, 1, 1, 2),
376 F(32000000, P_FEPLL200
, 1, 4, 25),
377 F(40000000, P_FEPLL200
, 1, 1, 5),
378 F(46400000, P_FEPLL200
, 1, 29, 125),
379 F(48000000, P_XO
, 1, 0, 0),
383 static struct clk_rcg2 blsp1_uart1_apps_clk_src
= {
387 .freq_tbl
= ftbl_gcc_blsp1_uart1_2_apps_clk
,
388 .parent_map
= gcc_xo_200_spi_map
,
389 .clkr
.hw
.init
= &(struct clk_init_data
){
390 .name
= "blsp1_uart1_apps_clk_src",
391 .parent_names
= gcc_xo_200_spi
,
393 .ops
= &clk_rcg2_ops
,
397 static struct clk_branch gcc_blsp1_uart1_apps_clk
= {
400 .enable_reg
= 0x203c,
401 .enable_mask
= BIT(0),
402 .hw
.init
= &(struct clk_init_data
){
403 .name
= "gcc_blsp1_uart1_apps_clk",
404 .parent_names
= (const char *[]){
405 "blsp1_uart1_apps_clk_src",
407 .flags
= CLK_SET_RATE_PARENT
,
409 .ops
= &clk_branch2_ops
,
414 static struct clk_rcg2 blsp1_uart2_apps_clk_src
= {
418 .freq_tbl
= ftbl_gcc_blsp1_uart1_2_apps_clk
,
419 .parent_map
= gcc_xo_200_spi_map
,
420 .clkr
.hw
.init
= &(struct clk_init_data
){
421 .name
= "blsp1_uart2_apps_clk_src",
422 .parent_names
= gcc_xo_200_spi
,
424 .ops
= &clk_rcg2_ops
,
428 static struct clk_branch gcc_blsp1_uart2_apps_clk
= {
431 .enable_reg
= 0x302c,
432 .enable_mask
= BIT(0),
433 .hw
.init
= &(struct clk_init_data
){
434 .name
= "gcc_blsp1_uart2_apps_clk",
435 .parent_names
= (const char *[]){
436 "blsp1_uart2_apps_clk_src",
439 .ops
= &clk_branch2_ops
,
440 .flags
= CLK_SET_RATE_PARENT
,
445 static const struct freq_tbl ftbl_gcc_gp_clk
[] = {
446 F(1250000, P_FEPLL200
, 1, 16, 0),
447 F(2500000, P_FEPLL200
, 1, 8, 0),
448 F(5000000, P_FEPLL200
, 1, 4, 0),
452 static struct clk_rcg2 gp1_clk_src
= {
456 .freq_tbl
= ftbl_gcc_gp_clk
,
457 .parent_map
= gcc_xo_200_map
,
458 .clkr
.hw
.init
= &(struct clk_init_data
){
459 .name
= "gp1_clk_src",
460 .parent_names
= gcc_xo_200
,
462 .ops
= &clk_rcg2_ops
,
466 static struct clk_branch gcc_gp1_clk
= {
469 .enable_reg
= 0x8000,
470 .enable_mask
= BIT(0),
471 .hw
.init
= &(struct clk_init_data
){
472 .name
= "gcc_gp1_clk",
473 .parent_names
= (const char *[]){
477 .ops
= &clk_branch2_ops
,
478 .flags
= CLK_SET_RATE_PARENT
,
483 static struct clk_rcg2 gp2_clk_src
= {
487 .freq_tbl
= ftbl_gcc_gp_clk
,
488 .parent_map
= gcc_xo_200_map
,
489 .clkr
.hw
.init
= &(struct clk_init_data
){
490 .name
= "gp2_clk_src",
491 .parent_names
= gcc_xo_200
,
493 .ops
= &clk_rcg2_ops
,
497 static struct clk_branch gcc_gp2_clk
= {
500 .enable_reg
= 0x9000,
501 .enable_mask
= BIT(0),
502 .hw
.init
= &(struct clk_init_data
){
503 .name
= "gcc_gp2_clk",
504 .parent_names
= (const char *[]){
508 .ops
= &clk_branch2_ops
,
509 .flags
= CLK_SET_RATE_PARENT
,
514 static struct clk_rcg2 gp3_clk_src
= {
518 .freq_tbl
= ftbl_gcc_gp_clk
,
519 .parent_map
= gcc_xo_200_map
,
520 .clkr
.hw
.init
= &(struct clk_init_data
){
521 .name
= "gp3_clk_src",
522 .parent_names
= gcc_xo_200
,
524 .ops
= &clk_rcg2_ops
,
528 static struct clk_branch gcc_gp3_clk
= {
531 .enable_reg
= 0xa000,
532 .enable_mask
= BIT(0),
533 .hw
.init
= &(struct clk_init_data
){
534 .name
= "gcc_gp3_clk",
535 .parent_names
= (const char *[]){
539 .ops
= &clk_branch2_ops
,
540 .flags
= CLK_SET_RATE_PARENT
,
545 static const struct freq_tbl ftbl_gcc_sdcc1_apps_clk
[] = {
546 F(144000, P_XO
, 1, 3, 240),
547 F(400000, P_XO
, 1, 1, 0),
548 F(20000000, P_FEPLL500
, 1, 1, 25),
549 F(25000000, P_FEPLL500
, 1, 1, 20),
550 F(50000000, P_FEPLL500
, 1, 1, 10),
551 F(100000000, P_FEPLL500
, 1, 1, 5),
552 F(192000000, P_DDRPLL
, 1, 0, 0),
556 static struct clk_rcg2 sdcc1_apps_clk_src
= {
559 .freq_tbl
= ftbl_gcc_sdcc1_apps_clk
,
560 .parent_map
= gcc_xo_sdcc1_500_map
,
561 .clkr
.hw
.init
= &(struct clk_init_data
){
562 .name
= "sdcc1_apps_clk_src",
563 .parent_names
= gcc_xo_sdcc1_500
,
565 .ops
= &clk_rcg2_ops
,
566 .flags
= CLK_SET_RATE_PARENT
,
570 static const struct freq_tbl ftbl_gcc_apps_clk
[] = {
571 F(48000000, P_XO
, 1, 0, 0),
572 F(200000000, P_FEPLL200
, 1, 0, 0),
573 F(384000000, P_DDRPLLAPSS
, 1, 0, 0),
574 F(413000000, P_DDRPLLAPSS
, 1, 0, 0),
575 F(448000000, P_DDRPLLAPSS
, 1, 0, 0),
576 F(488000000, P_DDRPLLAPSS
, 1, 0, 0),
577 F(500000000, P_FEPLL500
, 1, 0, 0),
578 F(512000000, P_DDRPLLAPSS
, 1, 0, 0),
579 F(537000000, P_DDRPLLAPSS
, 1, 0, 0),
580 F(565000000, P_DDRPLLAPSS
, 1, 0, 0),
581 F(597000000, P_DDRPLLAPSS
, 1, 0, 0),
582 F(632000000, P_DDRPLLAPSS
, 1, 0, 0),
583 F(672000000, P_DDRPLLAPSS
, 1, 0, 0),
584 F(716000000, P_DDRPLLAPSS
, 1, 0, 0),
588 static struct clk_rcg2 apps_clk_src
= {
591 .freq_tbl
= ftbl_gcc_apps_clk
,
592 .parent_map
= gcc_xo_ddr_500_200_map
,
593 .clkr
.hw
.init
= &(struct clk_init_data
){
594 .name
= "apps_clk_src",
595 .parent_names
= gcc_xo_ddr_500_200
,
597 .ops
= &clk_rcg2_ops
,
598 .flags
= CLK_SET_RATE_PARENT
,
602 static const struct freq_tbl ftbl_gcc_apps_ahb_clk
[] = {
603 F(48000000, P_XO
, 1, 0, 0),
604 F(100000000, P_FEPLL200
, 2, 0, 0),
608 static struct clk_rcg2 apps_ahb_clk_src
= {
611 .parent_map
= gcc_xo_200_500_map
,
612 .freq_tbl
= ftbl_gcc_apps_ahb_clk
,
613 .clkr
.hw
.init
= &(struct clk_init_data
){
614 .name
= "apps_ahb_clk_src",
615 .parent_names
= gcc_xo_200_500
,
617 .ops
= &clk_rcg2_ops
,
621 static struct clk_branch gcc_apss_ahb_clk
= {
623 .halt_check
= BRANCH_HALT_VOTED
,
625 .enable_reg
= 0x6000,
626 .enable_mask
= BIT(14),
627 .hw
.init
= &(struct clk_init_data
){
628 .name
= "gcc_apss_ahb_clk",
629 .parent_names
= (const char *[]){
633 .ops
= &clk_branch2_ops
,
634 .flags
= CLK_SET_RATE_PARENT
,
639 static struct clk_branch gcc_blsp1_ahb_clk
= {
641 .halt_check
= BRANCH_HALT_VOTED
,
643 .enable_reg
= 0x6000,
644 .enable_mask
= BIT(10),
645 .hw
.init
= &(struct clk_init_data
){
646 .name
= "gcc_blsp1_ahb_clk",
647 .parent_names
= (const char *[]){
651 .ops
= &clk_branch2_ops
,
656 static struct clk_branch gcc_dcd_xo_clk
= {
659 .enable_reg
= 0x2103c,
660 .enable_mask
= BIT(0),
661 .hw
.init
= &(struct clk_init_data
){
662 .name
= "gcc_dcd_xo_clk",
663 .parent_names
= (const char *[]){
667 .ops
= &clk_branch2_ops
,
672 static struct clk_branch gcc_boot_rom_ahb_clk
= {
675 .enable_reg
= 0x1300c,
676 .enable_mask
= BIT(0),
677 .hw
.init
= &(struct clk_init_data
){
678 .name
= "gcc_boot_rom_ahb_clk",
679 .parent_names
= (const char *[]){
683 .ops
= &clk_branch2_ops
,
684 .flags
= CLK_SET_RATE_PARENT
,
689 static struct clk_branch gcc_crypto_ahb_clk
= {
691 .halt_check
= BRANCH_HALT_VOTED
,
693 .enable_reg
= 0x6000,
694 .enable_mask
= BIT(0),
695 .hw
.init
= &(struct clk_init_data
){
696 .name
= "gcc_crypto_ahb_clk",
697 .parent_names
= (const char *[]){
701 .ops
= &clk_branch2_ops
,
706 static struct clk_branch gcc_crypto_axi_clk
= {
708 .halt_check
= BRANCH_HALT_VOTED
,
710 .enable_reg
= 0x6000,
711 .enable_mask
= BIT(1),
712 .hw
.init
= &(struct clk_init_data
){
713 .name
= "gcc_crypto_axi_clk",
714 .parent_names
= (const char *[]){
718 .ops
= &clk_branch2_ops
,
723 static struct clk_branch gcc_crypto_clk
= {
725 .halt_check
= BRANCH_HALT_VOTED
,
727 .enable_reg
= 0x6000,
728 .enable_mask
= BIT(2),
729 .hw
.init
= &(struct clk_init_data
){
730 .name
= "gcc_crypto_clk",
731 .parent_names
= (const char *[]){
735 .ops
= &clk_branch2_ops
,
740 static struct clk_branch gcc_ess_clk
= {
743 .enable_reg
= 0x12010,
744 .enable_mask
= BIT(0),
745 .hw
.init
= &(struct clk_init_data
){
746 .name
= "gcc_ess_clk",
747 .parent_names
= (const char *[]){
748 "fephy_125m_dly_clk_src",
751 .ops
= &clk_branch2_ops
,
752 .flags
= CLK_SET_RATE_PARENT
,
757 static struct clk_branch gcc_imem_axi_clk
= {
759 .halt_check
= BRANCH_HALT_VOTED
,
761 .enable_reg
= 0x6000,
762 .enable_mask
= BIT(17),
763 .hw
.init
= &(struct clk_init_data
){
764 .name
= "gcc_imem_axi_clk",
765 .parent_names
= (const char *[]){
769 .ops
= &clk_branch2_ops
,
774 static struct clk_branch gcc_imem_cfg_ahb_clk
= {
777 .enable_reg
= 0xe008,
778 .enable_mask
= BIT(0),
779 .hw
.init
= &(struct clk_init_data
){
780 .name
= "gcc_imem_cfg_ahb_clk",
781 .parent_names
= (const char *[]){
785 .ops
= &clk_branch2_ops
,
790 static struct clk_branch gcc_pcie_ahb_clk
= {
793 .enable_reg
= 0x1d00c,
794 .enable_mask
= BIT(0),
795 .hw
.init
= &(struct clk_init_data
){
796 .name
= "gcc_pcie_ahb_clk",
797 .parent_names
= (const char *[]){
801 .ops
= &clk_branch2_ops
,
806 static struct clk_branch gcc_pcie_axi_m_clk
= {
809 .enable_reg
= 0x1d004,
810 .enable_mask
= BIT(0),
811 .hw
.init
= &(struct clk_init_data
){
812 .name
= "gcc_pcie_axi_m_clk",
813 .parent_names
= (const char *[]){
817 .ops
= &clk_branch2_ops
,
822 static struct clk_branch gcc_pcie_axi_s_clk
= {
825 .enable_reg
= 0x1d008,
826 .enable_mask
= BIT(0),
827 .hw
.init
= &(struct clk_init_data
){
828 .name
= "gcc_pcie_axi_s_clk",
829 .parent_names
= (const char *[]){
833 .ops
= &clk_branch2_ops
,
838 static struct clk_branch gcc_prng_ahb_clk
= {
840 .halt_check
= BRANCH_HALT_VOTED
,
842 .enable_reg
= 0x6000,
843 .enable_mask
= BIT(8),
844 .hw
.init
= &(struct clk_init_data
){
845 .name
= "gcc_prng_ahb_clk",
846 .parent_names
= (const char *[]){
850 .ops
= &clk_branch2_ops
,
855 static struct clk_branch gcc_qpic_ahb_clk
= {
858 .enable_reg
= 0x1c008,
859 .enable_mask
= BIT(0),
860 .hw
.init
= &(struct clk_init_data
){
861 .name
= "gcc_qpic_ahb_clk",
862 .parent_names
= (const char *[]){
866 .ops
= &clk_branch2_ops
,
871 static struct clk_branch gcc_qpic_clk
= {
874 .enable_reg
= 0x1c004,
875 .enable_mask
= BIT(0),
876 .hw
.init
= &(struct clk_init_data
){
877 .name
= "gcc_qpic_clk",
878 .parent_names
= (const char *[]){
882 .ops
= &clk_branch2_ops
,
887 static struct clk_branch gcc_sdcc1_ahb_clk
= {
890 .enable_reg
= 0x18010,
891 .enable_mask
= BIT(0),
892 .hw
.init
= &(struct clk_init_data
){
893 .name
= "gcc_sdcc1_ahb_clk",
894 .parent_names
= (const char *[]){
898 .ops
= &clk_branch2_ops
,
903 static struct clk_branch gcc_sdcc1_apps_clk
= {
906 .enable_reg
= 0x1800c,
907 .enable_mask
= BIT(0),
908 .hw
.init
= &(struct clk_init_data
){
909 .name
= "gcc_sdcc1_apps_clk",
910 .parent_names
= (const char *[]){
911 "sdcc1_apps_clk_src",
914 .ops
= &clk_branch2_ops
,
915 .flags
= CLK_SET_RATE_PARENT
,
920 static struct clk_branch gcc_tlmm_ahb_clk
= {
922 .halt_check
= BRANCH_HALT_VOTED
,
924 .enable_reg
= 0x6000,
925 .enable_mask
= BIT(5),
926 .hw
.init
= &(struct clk_init_data
){
927 .name
= "gcc_tlmm_ahb_clk",
928 .parent_names
= (const char *[]){
932 .ops
= &clk_branch2_ops
,
937 static struct clk_branch gcc_usb2_master_clk
= {
940 .enable_reg
= 0x1e00c,
941 .enable_mask
= BIT(0),
942 .hw
.init
= &(struct clk_init_data
){
943 .name
= "gcc_usb2_master_clk",
944 .parent_names
= (const char *[]){
948 .ops
= &clk_branch2_ops
,
953 static struct clk_branch gcc_usb2_sleep_clk
= {
956 .enable_reg
= 0x1e010,
957 .enable_mask
= BIT(0),
958 .hw
.init
= &(struct clk_init_data
){
959 .name
= "gcc_usb2_sleep_clk",
960 .parent_names
= (const char *[]){
964 .ops
= &clk_branch2_ops
,
969 static struct clk_branch gcc_usb2_mock_utmi_clk
= {
972 .enable_reg
= 0x1e014,
973 .enable_mask
= BIT(0),
974 .hw
.init
= &(struct clk_init_data
){
975 .name
= "gcc_usb2_mock_utmi_clk",
976 .parent_names
= (const char *[]){
977 "usb30_mock_utmi_clk_src",
980 .ops
= &clk_branch2_ops
,
981 .flags
= CLK_SET_RATE_PARENT
,
986 static const struct freq_tbl ftbl_gcc_usb30_mock_utmi_clk
[] = {
987 F(2000000, P_FEPLL200
, 10, 0, 0),
991 static struct clk_rcg2 usb30_mock_utmi_clk_src
= {
994 .parent_map
= gcc_xo_200_map
,
995 .freq_tbl
= ftbl_gcc_usb30_mock_utmi_clk
,
996 .clkr
.hw
.init
= &(struct clk_init_data
){
997 .name
= "usb30_mock_utmi_clk_src",
998 .parent_names
= gcc_xo_200
,
1000 .ops
= &clk_rcg2_ops
,
1004 static struct clk_branch gcc_usb3_master_clk
= {
1005 .halt_reg
= 0x1e028,
1007 .enable_reg
= 0x1e028,
1008 .enable_mask
= BIT(0),
1009 .hw
.init
= &(struct clk_init_data
){
1010 .name
= "gcc_usb3_master_clk",
1011 .parent_names
= (const char *[]){
1015 .ops
= &clk_branch2_ops
,
1020 static struct clk_branch gcc_usb3_sleep_clk
= {
1021 .halt_reg
= 0x1e02C,
1023 .enable_reg
= 0x1e02C,
1024 .enable_mask
= BIT(0),
1025 .hw
.init
= &(struct clk_init_data
){
1026 .name
= "gcc_usb3_sleep_clk",
1027 .parent_names
= (const char *[]){
1028 "gcc_sleep_clk_src",
1031 .ops
= &clk_branch2_ops
,
1036 static struct clk_branch gcc_usb3_mock_utmi_clk
= {
1037 .halt_reg
= 0x1e030,
1039 .enable_reg
= 0x1e030,
1040 .enable_mask
= BIT(0),
1041 .hw
.init
= &(struct clk_init_data
){
1042 .name
= "gcc_usb3_mock_utmi_clk",
1043 .parent_names
= (const char *[]){
1044 "usb30_mock_utmi_clk_src",
1047 .ops
= &clk_branch2_ops
,
1048 .flags
= CLK_SET_RATE_PARENT
,
1053 static const struct freq_tbl ftbl_gcc_fephy_dly_clk
[] = {
1054 F(125000000, P_FEPLL125DLY
, 1, 0, 0),
1058 static struct clk_rcg2 fephy_125m_dly_clk_src
= {
1059 .cmd_rcgr
= 0x12000,
1061 .parent_map
= gcc_xo_125_dly_map
,
1062 .freq_tbl
= ftbl_gcc_fephy_dly_clk
,
1063 .clkr
.hw
.init
= &(struct clk_init_data
){
1064 .name
= "fephy_125m_dly_clk_src",
1065 .parent_names
= gcc_xo_125_dly
,
1067 .ops
= &clk_rcg2_ops
,
1072 static const struct freq_tbl ftbl_gcc_wcss2g_clk
[] = {
1073 F(48000000, P_XO
, 1, 0, 0),
1074 F(250000000, P_FEPLLWCSS2G
, 1, 0, 0),
1078 static struct clk_rcg2 wcss2g_clk_src
= {
1079 .cmd_rcgr
= 0x1f000,
1081 .freq_tbl
= ftbl_gcc_wcss2g_clk
,
1082 .parent_map
= gcc_xo_wcss2g_map
,
1083 .clkr
.hw
.init
= &(struct clk_init_data
){
1084 .name
= "wcss2g_clk_src",
1085 .parent_names
= gcc_xo_wcss2g
,
1087 .ops
= &clk_rcg2_ops
,
1088 .flags
= CLK_SET_RATE_PARENT
,
1092 static struct clk_branch gcc_wcss2g_clk
= {
1093 .halt_reg
= 0x1f00C,
1095 .enable_reg
= 0x1f00C,
1096 .enable_mask
= BIT(0),
1097 .hw
.init
= &(struct clk_init_data
){
1098 .name
= "gcc_wcss2g_clk",
1099 .parent_names
= (const char *[]){
1103 .ops
= &clk_branch2_ops
,
1104 .flags
= CLK_SET_RATE_PARENT
,
1109 static struct clk_branch gcc_wcss2g_ref_clk
= {
1110 .halt_reg
= 0x1f00C,
1112 .enable_reg
= 0x1f00C,
1113 .enable_mask
= BIT(0),
1114 .hw
.init
= &(struct clk_init_data
){
1115 .name
= "gcc_wcss2g_ref_clk",
1116 .parent_names
= (const char *[]){
1120 .ops
= &clk_branch2_ops
,
1121 .flags
= CLK_SET_RATE_PARENT
,
1126 static struct clk_branch gcc_wcss2g_rtc_clk
= {
1127 .halt_reg
= 0x1f010,
1129 .enable_reg
= 0x1f010,
1130 .enable_mask
= BIT(0),
1131 .hw
.init
= &(struct clk_init_data
){
1132 .name
= "gcc_wcss2g_rtc_clk",
1133 .parent_names
= (const char *[]){
1134 "gcc_sleep_clk_src",
1137 .ops
= &clk_branch2_ops
,
1142 static const struct freq_tbl ftbl_gcc_wcss5g_clk
[] = {
1143 F(48000000, P_XO
, 1, 0, 0),
1144 F(250000000, P_FEPLLWCSS5G
, 1, 0, 0),
1148 static struct clk_rcg2 wcss5g_clk_src
= {
1149 .cmd_rcgr
= 0x20000,
1151 .parent_map
= gcc_xo_wcss5g_map
,
1152 .freq_tbl
= ftbl_gcc_wcss5g_clk
,
1153 .clkr
.hw
.init
= &(struct clk_init_data
){
1154 .name
= "wcss5g_clk_src",
1155 .parent_names
= gcc_xo_wcss5g
,
1157 .ops
= &clk_rcg2_ops
,
1161 static struct clk_branch gcc_wcss5g_clk
= {
1162 .halt_reg
= 0x2000c,
1164 .enable_reg
= 0x2000c,
1165 .enable_mask
= BIT(0),
1166 .hw
.init
= &(struct clk_init_data
){
1167 .name
= "gcc_wcss5g_clk",
1168 .parent_names
= (const char *[]){
1172 .ops
= &clk_branch2_ops
,
1173 .flags
= CLK_SET_RATE_PARENT
,
1178 static struct clk_branch gcc_wcss5g_ref_clk
= {
1179 .halt_reg
= 0x2000c,
1181 .enable_reg
= 0x2000c,
1182 .enable_mask
= BIT(0),
1183 .hw
.init
= &(struct clk_init_data
){
1184 .name
= "gcc_wcss5g_ref_clk",
1185 .parent_names
= (const char *[]){
1189 .ops
= &clk_branch2_ops
,
1190 .flags
= CLK_SET_RATE_PARENT
,
1195 static struct clk_branch gcc_wcss5g_rtc_clk
= {
1196 .halt_reg
= 0x20010,
1198 .enable_reg
= 0x20010,
1199 .enable_mask
= BIT(0),
1200 .hw
.init
= &(struct clk_init_data
){
1201 .name
= "gcc_wcss5g_rtc_clk",
1202 .parent_names
= (const char *[]){
1203 "gcc_sleep_clk_src",
1206 .ops
= &clk_branch2_ops
,
1207 .flags
= CLK_SET_RATE_PARENT
,
1212 /* Calculates the VCO rate for FEPLL. */
1213 static u64
clk_fepll_vco_calc_rate(struct clk_fepll
*pll_div
,
1214 unsigned long parent_rate
)
1216 const struct clk_fepll_vco
*pll_vco
= pll_div
->pll_vco
;
1217 u32 fdbkdiv
, refclkdiv
, cdiv
;
1220 regmap_read(pll_div
->cdiv
.clkr
.regmap
, pll_vco
->reg
, &cdiv
);
1221 refclkdiv
= (cdiv
>> pll_vco
->refclkdiv_shift
) &
1222 (BIT(pll_vco
->refclkdiv_width
) - 1);
1223 fdbkdiv
= (cdiv
>> pll_vco
->fdbkdiv_shift
) &
1224 (BIT(pll_vco
->fdbkdiv_width
) - 1);
1226 vco
= parent_rate
/ refclkdiv
;
1233 static const struct clk_fepll_vco gcc_apss_ddrpll_vco
= {
1234 .fdbkdiv_shift
= 16,
1236 .refclkdiv_shift
= 24,
1237 .refclkdiv_width
= 5,
1241 static const struct clk_fepll_vco gcc_fepll_vco
= {
1242 .fdbkdiv_shift
= 16,
1244 .refclkdiv_shift
= 24,
1245 .refclkdiv_width
= 5,
1250 * Round rate function for APSS CPU PLL Clock divider.
1251 * It looks up the frequency table and returns the next higher frequency
1252 * supported in hardware.
1254 static long clk_cpu_div_round_rate(struct clk_hw
*hw
, unsigned long rate
,
1255 unsigned long *p_rate
)
1257 struct clk_fepll
*pll
= to_clk_fepll(hw
);
1258 struct clk_hw
*p_hw
;
1259 const struct freq_tbl
*f
;
1261 f
= qcom_find_freq(pll
->freq_tbl
, rate
);
1265 p_hw
= clk_hw_get_parent_by_index(hw
, f
->src
);
1266 *p_rate
= clk_hw_get_rate(p_hw
);
1272 * Clock set rate function for APSS CPU PLL Clock divider.
1273 * It looks up the frequency table and updates the PLL divider to corresponding
1276 static int clk_cpu_div_set_rate(struct clk_hw
*hw
, unsigned long rate
,
1277 unsigned long parent_rate
)
1279 struct clk_fepll
*pll
= to_clk_fepll(hw
);
1280 const struct freq_tbl
*f
;
1284 f
= qcom_find_freq(pll
->freq_tbl
, rate
);
1288 mask
= (BIT(pll
->cdiv
.width
) - 1) << pll
->cdiv
.shift
;
1289 ret
= regmap_update_bits(pll
->cdiv
.clkr
.regmap
,
1290 pll
->cdiv
.reg
, mask
,
1291 f
->pre_div
<< pll
->cdiv
.shift
);
1293 * There is no status bit which can be checked for successful CPU
1294 * divider update operation so using delay for the same.
1302 * Clock frequency calculation function for APSS CPU PLL Clock divider.
1303 * This clock divider is nonlinear so this function calculates the actual
1304 * divider and returns the output frequency by dividing VCO Frequency
1305 * with this actual divider value.
1307 static unsigned long
1308 clk_cpu_div_recalc_rate(struct clk_hw
*hw
,
1309 unsigned long parent_rate
)
1311 struct clk_fepll
*pll
= to_clk_fepll(hw
);
1315 regmap_read(pll
->cdiv
.clkr
.regmap
, pll
->cdiv
.reg
, &cdiv
);
1316 cdiv
= (cdiv
>> pll
->cdiv
.shift
) & (BIT(pll
->cdiv
.width
) - 1);
1319 * Some dividers have value in 0.5 fraction so multiply both VCO
1320 * frequency(parent_rate) and pre_div with 2 to make integer
1324 pre_div
= (cdiv
+ 1) * 2;
1326 pre_div
= cdiv
+ 12;
1328 rate
= clk_fepll_vco_calc_rate(pll
, parent_rate
) * 2;
1329 do_div(rate
, pre_div
);
1334 static const struct clk_ops clk_regmap_cpu_div_ops
= {
1335 .round_rate
= clk_cpu_div_round_rate
,
1336 .set_rate
= clk_cpu_div_set_rate
,
1337 .recalc_rate
= clk_cpu_div_recalc_rate
,
1340 static const struct freq_tbl ftbl_apss_ddr_pll
[] = {
1341 { 384000000, P_XO
, 0xd, 0, 0 },
1342 { 413000000, P_XO
, 0xc, 0, 0 },
1343 { 448000000, P_XO
, 0xb, 0, 0 },
1344 { 488000000, P_XO
, 0xa, 0, 0 },
1345 { 512000000, P_XO
, 0x9, 0, 0 },
1346 { 537000000, P_XO
, 0x8, 0, 0 },
1347 { 565000000, P_XO
, 0x7, 0, 0 },
1348 { 597000000, P_XO
, 0x6, 0, 0 },
1349 { 632000000, P_XO
, 0x5, 0, 0 },
1350 { 672000000, P_XO
, 0x4, 0, 0 },
1351 { 716000000, P_XO
, 0x3, 0, 0 },
1352 { 768000000, P_XO
, 0x2, 0, 0 },
1353 { 823000000, P_XO
, 0x1, 0, 0 },
1354 { 896000000, P_XO
, 0x0, 0, 0 },
1358 static struct clk_fepll gcc_apss_cpu_plldiv_clk
= {
1359 .cdiv
.reg
= 0x2e020,
1363 .enable_reg
= 0x2e000,
1364 .enable_mask
= BIT(0),
1365 .hw
.init
= &(struct clk_init_data
){
1366 .name
= "ddrpllapss",
1367 .parent_names
= (const char *[]){
1371 .ops
= &clk_regmap_cpu_div_ops
,
1374 .freq_tbl
= ftbl_apss_ddr_pll
,
1375 .pll_vco
= &gcc_apss_ddrpll_vco
,
1378 /* Calculates the rate for PLL divider.
1379 * If the divider value is not fixed then it gets the actual divider value
1380 * from divider table. Then, it calculate the clock rate by dividing the
1381 * parent rate with actual divider value.
1383 static unsigned long
1384 clk_regmap_clk_div_recalc_rate(struct clk_hw
*hw
,
1385 unsigned long parent_rate
)
1387 struct clk_fepll
*pll
= to_clk_fepll(hw
);
1388 u32 cdiv
, pre_div
= 1;
1390 const struct clk_div_table
*clkt
;
1392 if (pll
->fixed_div
) {
1393 pre_div
= pll
->fixed_div
;
1395 regmap_read(pll
->cdiv
.clkr
.regmap
, pll
->cdiv
.reg
, &cdiv
);
1396 cdiv
= (cdiv
>> pll
->cdiv
.shift
) & (BIT(pll
->cdiv
.width
) - 1);
1398 for (clkt
= pll
->div_table
; clkt
->div
; clkt
++) {
1399 if (clkt
->val
== cdiv
)
1400 pre_div
= clkt
->div
;
1404 rate
= clk_fepll_vco_calc_rate(pll
, parent_rate
);
1405 do_div(rate
, pre_div
);
1410 static const struct clk_ops clk_fepll_div_ops
= {
1411 .recalc_rate
= clk_regmap_clk_div_recalc_rate
,
1414 static struct clk_fepll gcc_apss_sdcc_clk
= {
1417 .hw
.init
= &(struct clk_init_data
){
1418 .name
= "ddrpllsdcc",
1419 .parent_names
= (const char *[]){
1423 .ops
= &clk_fepll_div_ops
,
1426 .pll_vco
= &gcc_apss_ddrpll_vco
,
1429 static struct clk_fepll gcc_fepll125_clk
= {
1432 .hw
.init
= &(struct clk_init_data
){
1434 .parent_names
= (const char *[]){
1438 .ops
= &clk_fepll_div_ops
,
1441 .pll_vco
= &gcc_fepll_vco
,
1444 static struct clk_fepll gcc_fepll125dly_clk
= {
1447 .hw
.init
= &(struct clk_init_data
){
1448 .name
= "fepll125dly",
1449 .parent_names
= (const char *[]){
1453 .ops
= &clk_fepll_div_ops
,
1456 .pll_vco
= &gcc_fepll_vco
,
1459 static struct clk_fepll gcc_fepll200_clk
= {
1462 .hw
.init
= &(struct clk_init_data
){
1464 .parent_names
= (const char *[]){
1468 .ops
= &clk_fepll_div_ops
,
1471 .pll_vco
= &gcc_fepll_vco
,
1474 static struct clk_fepll gcc_fepll500_clk
= {
1477 .hw
.init
= &(struct clk_init_data
){
1479 .parent_names
= (const char *[]){
1483 .ops
= &clk_fepll_div_ops
,
1486 .pll_vco
= &gcc_fepll_vco
,
1489 static const struct clk_div_table fepllwcss_clk_div_table
[] = {
1497 static struct clk_fepll gcc_fepllwcss2g_clk
= {
1498 .cdiv
.reg
= 0x2f020,
1502 .hw
.init
= &(struct clk_init_data
){
1503 .name
= "fepllwcss2g",
1504 .parent_names
= (const char *[]){
1508 .ops
= &clk_fepll_div_ops
,
1511 .div_table
= fepllwcss_clk_div_table
,
1512 .pll_vco
= &gcc_fepll_vco
,
1515 static struct clk_fepll gcc_fepllwcss5g_clk
= {
1516 .cdiv
.reg
= 0x2f020,
1520 .hw
.init
= &(struct clk_init_data
){
1521 .name
= "fepllwcss5g",
1522 .parent_names
= (const char *[]){
1526 .ops
= &clk_fepll_div_ops
,
1529 .div_table
= fepllwcss_clk_div_table
,
1530 .pll_vco
= &gcc_fepll_vco
,
1533 static const struct freq_tbl ftbl_gcc_pcnoc_ahb_clk
[] = {
1534 F(48000000, P_XO
, 1, 0, 0),
1535 F(100000000, P_FEPLL200
, 2, 0, 0),
1539 static struct clk_rcg2 gcc_pcnoc_ahb_clk_src
= {
1540 .cmd_rcgr
= 0x21024,
1542 .parent_map
= gcc_xo_200_500_map
,
1543 .freq_tbl
= ftbl_gcc_pcnoc_ahb_clk
,
1544 .clkr
.hw
.init
= &(struct clk_init_data
){
1545 .name
= "gcc_pcnoc_ahb_clk_src",
1546 .parent_names
= gcc_xo_200_500
,
1548 .ops
= &clk_rcg2_ops
,
1552 static struct clk_branch pcnoc_clk_src
= {
1553 .halt_reg
= 0x21030,
1555 .enable_reg
= 0x21030,
1556 .enable_mask
= BIT(0),
1557 .hw
.init
= &(struct clk_init_data
){
1558 .name
= "pcnoc_clk_src",
1559 .parent_names
= (const char *[]){
1560 "gcc_pcnoc_ahb_clk_src",
1563 .ops
= &clk_branch2_ops
,
1564 .flags
= CLK_SET_RATE_PARENT
|
1570 static struct clk_regmap
*gcc_ipq4019_clocks
[] = {
1571 [AUDIO_CLK_SRC
] = &audio_clk_src
.clkr
,
1572 [BLSP1_QUP1_I2C_APPS_CLK_SRC
] = &blsp1_qup1_i2c_apps_clk_src
.clkr
,
1573 [BLSP1_QUP1_SPI_APPS_CLK_SRC
] = &blsp1_qup1_spi_apps_clk_src
.clkr
,
1574 [BLSP1_QUP2_I2C_APPS_CLK_SRC
] = &blsp1_qup2_i2c_apps_clk_src
.clkr
,
1575 [BLSP1_QUP2_SPI_APPS_CLK_SRC
] = &blsp1_qup2_spi_apps_clk_src
.clkr
,
1576 [BLSP1_UART1_APPS_CLK_SRC
] = &blsp1_uart1_apps_clk_src
.clkr
,
1577 [BLSP1_UART2_APPS_CLK_SRC
] = &blsp1_uart2_apps_clk_src
.clkr
,
1578 [GCC_USB3_MOCK_UTMI_CLK_SRC
] = &usb30_mock_utmi_clk_src
.clkr
,
1579 [GCC_APPS_CLK_SRC
] = &apps_clk_src
.clkr
,
1580 [GCC_APPS_AHB_CLK_SRC
] = &apps_ahb_clk_src
.clkr
,
1581 [GP1_CLK_SRC
] = &gp1_clk_src
.clkr
,
1582 [GP2_CLK_SRC
] = &gp2_clk_src
.clkr
,
1583 [GP3_CLK_SRC
] = &gp3_clk_src
.clkr
,
1584 [SDCC1_APPS_CLK_SRC
] = &sdcc1_apps_clk_src
.clkr
,
1585 [FEPHY_125M_DLY_CLK_SRC
] = &fephy_125m_dly_clk_src
.clkr
,
1586 [WCSS2G_CLK_SRC
] = &wcss2g_clk_src
.clkr
,
1587 [WCSS5G_CLK_SRC
] = &wcss5g_clk_src
.clkr
,
1588 [GCC_APSS_AHB_CLK
] = &gcc_apss_ahb_clk
.clkr
,
1589 [GCC_AUDIO_AHB_CLK
] = &gcc_audio_ahb_clk
.clkr
,
1590 [GCC_AUDIO_PWM_CLK
] = &gcc_audio_pwm_clk
.clkr
,
1591 [GCC_BLSP1_AHB_CLK
] = &gcc_blsp1_ahb_clk
.clkr
,
1592 [GCC_BLSP1_QUP1_I2C_APPS_CLK
] = &gcc_blsp1_qup1_i2c_apps_clk
.clkr
,
1593 [GCC_BLSP1_QUP1_SPI_APPS_CLK
] = &gcc_blsp1_qup1_spi_apps_clk
.clkr
,
1594 [GCC_BLSP1_QUP2_I2C_APPS_CLK
] = &gcc_blsp1_qup2_i2c_apps_clk
.clkr
,
1595 [GCC_BLSP1_QUP2_SPI_APPS_CLK
] = &gcc_blsp1_qup2_spi_apps_clk
.clkr
,
1596 [GCC_BLSP1_UART1_APPS_CLK
] = &gcc_blsp1_uart1_apps_clk
.clkr
,
1597 [GCC_BLSP1_UART2_APPS_CLK
] = &gcc_blsp1_uart2_apps_clk
.clkr
,
1598 [GCC_DCD_XO_CLK
] = &gcc_dcd_xo_clk
.clkr
,
1599 [GCC_GP1_CLK
] = &gcc_gp1_clk
.clkr
,
1600 [GCC_GP2_CLK
] = &gcc_gp2_clk
.clkr
,
1601 [GCC_GP3_CLK
] = &gcc_gp3_clk
.clkr
,
1602 [GCC_BOOT_ROM_AHB_CLK
] = &gcc_boot_rom_ahb_clk
.clkr
,
1603 [GCC_CRYPTO_AHB_CLK
] = &gcc_crypto_ahb_clk
.clkr
,
1604 [GCC_CRYPTO_AXI_CLK
] = &gcc_crypto_axi_clk
.clkr
,
1605 [GCC_CRYPTO_CLK
] = &gcc_crypto_clk
.clkr
,
1606 [GCC_ESS_CLK
] = &gcc_ess_clk
.clkr
,
1607 [GCC_IMEM_AXI_CLK
] = &gcc_imem_axi_clk
.clkr
,
1608 [GCC_IMEM_CFG_AHB_CLK
] = &gcc_imem_cfg_ahb_clk
.clkr
,
1609 [GCC_PCIE_AHB_CLK
] = &gcc_pcie_ahb_clk
.clkr
,
1610 [GCC_PCIE_AXI_M_CLK
] = &gcc_pcie_axi_m_clk
.clkr
,
1611 [GCC_PCIE_AXI_S_CLK
] = &gcc_pcie_axi_s_clk
.clkr
,
1612 [GCC_PRNG_AHB_CLK
] = &gcc_prng_ahb_clk
.clkr
,
1613 [GCC_QPIC_AHB_CLK
] = &gcc_qpic_ahb_clk
.clkr
,
1614 [GCC_QPIC_CLK
] = &gcc_qpic_clk
.clkr
,
1615 [GCC_SDCC1_AHB_CLK
] = &gcc_sdcc1_ahb_clk
.clkr
,
1616 [GCC_SDCC1_APPS_CLK
] = &gcc_sdcc1_apps_clk
.clkr
,
1617 [GCC_TLMM_AHB_CLK
] = &gcc_tlmm_ahb_clk
.clkr
,
1618 [GCC_USB2_MASTER_CLK
] = &gcc_usb2_master_clk
.clkr
,
1619 [GCC_USB2_SLEEP_CLK
] = &gcc_usb2_sleep_clk
.clkr
,
1620 [GCC_USB2_MOCK_UTMI_CLK
] = &gcc_usb2_mock_utmi_clk
.clkr
,
1621 [GCC_USB3_MASTER_CLK
] = &gcc_usb3_master_clk
.clkr
,
1622 [GCC_USB3_SLEEP_CLK
] = &gcc_usb3_sleep_clk
.clkr
,
1623 [GCC_USB3_MOCK_UTMI_CLK
] = &gcc_usb3_mock_utmi_clk
.clkr
,
1624 [GCC_WCSS2G_CLK
] = &gcc_wcss2g_clk
.clkr
,
1625 [GCC_WCSS2G_REF_CLK
] = &gcc_wcss2g_ref_clk
.clkr
,
1626 [GCC_WCSS2G_RTC_CLK
] = &gcc_wcss2g_rtc_clk
.clkr
,
1627 [GCC_WCSS5G_CLK
] = &gcc_wcss5g_clk
.clkr
,
1628 [GCC_WCSS5G_REF_CLK
] = &gcc_wcss5g_ref_clk
.clkr
,
1629 [GCC_WCSS5G_RTC_CLK
] = &gcc_wcss5g_rtc_clk
.clkr
,
1630 [GCC_SDCC_PLLDIV_CLK
] = &gcc_apss_sdcc_clk
.cdiv
.clkr
,
1631 [GCC_FEPLL125_CLK
] = &gcc_fepll125_clk
.cdiv
.clkr
,
1632 [GCC_FEPLL125DLY_CLK
] = &gcc_fepll125dly_clk
.cdiv
.clkr
,
1633 [GCC_FEPLL200_CLK
] = &gcc_fepll200_clk
.cdiv
.clkr
,
1634 [GCC_FEPLL500_CLK
] = &gcc_fepll500_clk
.cdiv
.clkr
,
1635 [GCC_FEPLL_WCSS2G_CLK
] = &gcc_fepllwcss2g_clk
.cdiv
.clkr
,
1636 [GCC_FEPLL_WCSS5G_CLK
] = &gcc_fepllwcss5g_clk
.cdiv
.clkr
,
1637 [GCC_APSS_CPU_PLLDIV_CLK
] = &gcc_apss_cpu_plldiv_clk
.cdiv
.clkr
,
1638 [GCC_PCNOC_AHB_CLK_SRC
] = &gcc_pcnoc_ahb_clk_src
.clkr
,
1639 [GCC_PCNOC_AHB_CLK
] = &pcnoc_clk_src
.clkr
,
1642 static const struct qcom_reset_map gcc_ipq4019_resets
[] = {
1643 [WIFI0_CPU_INIT_RESET
] = { 0x1f008, 5 },
1644 [WIFI0_RADIO_SRIF_RESET
] = { 0x1f008, 4 },
1645 [WIFI0_RADIO_WARM_RESET
] = { 0x1f008, 3 },
1646 [WIFI0_RADIO_COLD_RESET
] = { 0x1f008, 2 },
1647 [WIFI0_CORE_WARM_RESET
] = { 0x1f008, 1 },
1648 [WIFI0_CORE_COLD_RESET
] = { 0x1f008, 0 },
1649 [WIFI1_CPU_INIT_RESET
] = { 0x20008, 5 },
1650 [WIFI1_RADIO_SRIF_RESET
] = { 0x20008, 4 },
1651 [WIFI1_RADIO_WARM_RESET
] = { 0x20008, 3 },
1652 [WIFI1_RADIO_COLD_RESET
] = { 0x20008, 2 },
1653 [WIFI1_CORE_WARM_RESET
] = { 0x20008, 1 },
1654 [WIFI1_CORE_COLD_RESET
] = { 0x20008, 0 },
1655 [USB3_UNIPHY_PHY_ARES
] = { 0x1e038, 5 },
1656 [USB3_HSPHY_POR_ARES
] = { 0x1e038, 4 },
1657 [USB3_HSPHY_S_ARES
] = { 0x1e038, 2 },
1658 [USB2_HSPHY_POR_ARES
] = { 0x1e01c, 4 },
1659 [USB2_HSPHY_S_ARES
] = { 0x1e01c, 2 },
1660 [PCIE_PHY_AHB_ARES
] = { 0x1d010, 11 },
1661 [PCIE_AHB_ARES
] = { 0x1d010, 10 },
1662 [PCIE_PWR_ARES
] = { 0x1d010, 9 },
1663 [PCIE_PIPE_STICKY_ARES
] = { 0x1d010, 8 },
1664 [PCIE_AXI_M_STICKY_ARES
] = { 0x1d010, 7 },
1665 [PCIE_PHY_ARES
] = { 0x1d010, 6 },
1666 [PCIE_PARF_XPU_ARES
] = { 0x1d010, 5 },
1667 [PCIE_AXI_S_XPU_ARES
] = { 0x1d010, 4 },
1668 [PCIE_AXI_M_VMIDMT_ARES
] = { 0x1d010, 3 },
1669 [PCIE_PIPE_ARES
] = { 0x1d010, 2 },
1670 [PCIE_AXI_S_ARES
] = { 0x1d010, 1 },
1671 [PCIE_AXI_M_ARES
] = { 0x1d010, 0 },
1672 [ESS_RESET
] = { 0x12008, 0},
1673 [GCC_BLSP1_BCR
] = {0x01000, 0},
1674 [GCC_BLSP1_QUP1_BCR
] = {0x02000, 0},
1675 [GCC_BLSP1_UART1_BCR
] = {0x02038, 0},
1676 [GCC_BLSP1_QUP2_BCR
] = {0x03008, 0},
1677 [GCC_BLSP1_UART2_BCR
] = {0x03028, 0},
1678 [GCC_BIMC_BCR
] = {0x04000, 0},
1679 [GCC_TLMM_BCR
] = {0x05000, 0},
1680 [GCC_IMEM_BCR
] = {0x0E000, 0},
1681 [GCC_ESS_BCR
] = {0x12008, 0},
1682 [GCC_PRNG_BCR
] = {0x13000, 0},
1683 [GCC_BOOT_ROM_BCR
] = {0x13008, 0},
1684 [GCC_CRYPTO_BCR
] = {0x16000, 0},
1685 [GCC_SDCC1_BCR
] = {0x18000, 0},
1686 [GCC_SEC_CTRL_BCR
] = {0x1A000, 0},
1687 [GCC_AUDIO_BCR
] = {0x1B008, 0},
1688 [GCC_QPIC_BCR
] = {0x1C000, 0},
1689 [GCC_PCIE_BCR
] = {0x1D000, 0},
1690 [GCC_USB2_BCR
] = {0x1E008, 0},
1691 [GCC_USB2_PHY_BCR
] = {0x1E018, 0},
1692 [GCC_USB3_BCR
] = {0x1E024, 0},
1693 [GCC_USB3_PHY_BCR
] = {0x1E034, 0},
1694 [GCC_SYSTEM_NOC_BCR
] = {0x21000, 0},
1695 [GCC_PCNOC_BCR
] = {0x2102C, 0},
1696 [GCC_DCD_BCR
] = {0x21038, 0},
1697 [GCC_SNOC_BUS_TIMEOUT0_BCR
] = {0x21064, 0},
1698 [GCC_SNOC_BUS_TIMEOUT1_BCR
] = {0x2106C, 0},
1699 [GCC_SNOC_BUS_TIMEOUT2_BCR
] = {0x21074, 0},
1700 [GCC_SNOC_BUS_TIMEOUT3_BCR
] = {0x2107C, 0},
1701 [GCC_PCNOC_BUS_TIMEOUT0_BCR
] = {0x21084, 0},
1702 [GCC_PCNOC_BUS_TIMEOUT1_BCR
] = {0x2108C, 0},
1703 [GCC_PCNOC_BUS_TIMEOUT2_BCR
] = {0x21094, 0},
1704 [GCC_PCNOC_BUS_TIMEOUT3_BCR
] = {0x2109C, 0},
1705 [GCC_PCNOC_BUS_TIMEOUT4_BCR
] = {0x210A4, 0},
1706 [GCC_PCNOC_BUS_TIMEOUT5_BCR
] = {0x210AC, 0},
1707 [GCC_PCNOC_BUS_TIMEOUT6_BCR
] = {0x210B4, 0},
1708 [GCC_PCNOC_BUS_TIMEOUT7_BCR
] = {0x210BC, 0},
1709 [GCC_PCNOC_BUS_TIMEOUT8_BCR
] = {0x210C4, 0},
1710 [GCC_PCNOC_BUS_TIMEOUT9_BCR
] = {0x210CC, 0},
1711 [GCC_TCSR_BCR
] = {0x22000, 0},
1712 [GCC_MPM_BCR
] = {0x24000, 0},
1713 [GCC_SPDM_BCR
] = {0x25000, 0},
1716 static const struct regmap_config gcc_ipq4019_regmap_config
= {
1720 .max_register
= 0x2ffff,
1724 static const struct qcom_cc_desc gcc_ipq4019_desc
= {
1725 .config
= &gcc_ipq4019_regmap_config
,
1726 .clks
= gcc_ipq4019_clocks
,
1727 .num_clks
= ARRAY_SIZE(gcc_ipq4019_clocks
),
1728 .resets
= gcc_ipq4019_resets
,
1729 .num_resets
= ARRAY_SIZE(gcc_ipq4019_resets
),
1732 static const struct of_device_id gcc_ipq4019_match_table
[] = {
1733 { .compatible
= "qcom,gcc-ipq4019" },
1736 MODULE_DEVICE_TABLE(of
, gcc_ipq4019_match_table
);
1738 static int gcc_ipq4019_probe(struct platform_device
*pdev
)
1740 return qcom_cc_probe(pdev
, &gcc_ipq4019_desc
);
1743 static struct platform_driver gcc_ipq4019_driver
= {
1744 .probe
= gcc_ipq4019_probe
,
1746 .name
= "qcom,gcc-ipq4019",
1747 .of_match_table
= gcc_ipq4019_match_table
,
1751 static int __init
gcc_ipq4019_init(void)
1753 return platform_driver_register(&gcc_ipq4019_driver
);
1755 core_initcall(gcc_ipq4019_init
);
1757 static void __exit
gcc_ipq4019_exit(void)
1759 platform_driver_unregister(&gcc_ipq4019_driver
);
1761 module_exit(gcc_ipq4019_exit
);
1763 MODULE_ALIAS("platform:gcc-ipq4019");
1764 MODULE_LICENSE("GPL v2");
1765 MODULE_DESCRIPTION("QCOM GCC IPQ4019 driver");