0001
0002
0003
0004
0005
0006
0007
0008 #include <linux/kernel.h>
0009 #include <linux/bitops.h>
0010 #include <linux/err.h>
0011 #include <linux/platform_device.h>
0012 #include <linux/module.h>
0013 #include <linux/of.h>
0014 #include <linux/of_device.h>
0015 #include <linux/clk-provider.h>
0016 #include <linux/regmap.h>
0017 #include <linux/reset-controller.h>
0018
0019 #include <dt-bindings/clock/qcom,gcc-mdm9615.h>
0020 #include <dt-bindings/reset/qcom,gcc-mdm9615.h>
0021
0022 #include "common.h"
0023 #include "clk-regmap.h"
0024 #include "clk-pll.h"
0025 #include "clk-rcg.h"
0026 #include "clk-branch.h"
0027 #include "reset.h"
0028
0029 static struct clk_fixed_factor cxo = {
0030 .mult = 1,
0031 .div = 1,
0032 .hw.init = &(struct clk_init_data){
0033 .name = "cxo",
0034 .parent_names = (const char *[]){ "cxo_board" },
0035 .num_parents = 1,
0036 .ops = &clk_fixed_factor_ops,
0037 },
0038 };
0039
0040 static struct clk_pll pll0 = {
0041 .l_reg = 0x30c4,
0042 .m_reg = 0x30c8,
0043 .n_reg = 0x30cc,
0044 .config_reg = 0x30d4,
0045 .mode_reg = 0x30c0,
0046 .status_reg = 0x30d8,
0047 .status_bit = 16,
0048 .clkr.hw.init = &(struct clk_init_data){
0049 .name = "pll0",
0050 .parent_names = (const char *[]){ "cxo" },
0051 .num_parents = 1,
0052 .ops = &clk_pll_ops,
0053 },
0054 };
0055
0056 static struct clk_regmap pll0_vote = {
0057 .enable_reg = 0x34c0,
0058 .enable_mask = BIT(0),
0059 .hw.init = &(struct clk_init_data){
0060 .name = "pll0_vote",
0061 .parent_names = (const char *[]){ "pll8" },
0062 .num_parents = 1,
0063 .ops = &clk_pll_vote_ops,
0064 },
0065 };
0066
0067 static struct clk_regmap pll4_vote = {
0068 .enable_reg = 0x34c0,
0069 .enable_mask = BIT(4),
0070 .hw.init = &(struct clk_init_data){
0071 .name = "pll4_vote",
0072 .parent_names = (const char *[]){ "pll4" },
0073 .num_parents = 1,
0074 .ops = &clk_pll_vote_ops,
0075 },
0076 };
0077
0078 static struct clk_pll pll8 = {
0079 .l_reg = 0x3144,
0080 .m_reg = 0x3148,
0081 .n_reg = 0x314c,
0082 .config_reg = 0x3154,
0083 .mode_reg = 0x3140,
0084 .status_reg = 0x3158,
0085 .status_bit = 16,
0086 .clkr.hw.init = &(struct clk_init_data){
0087 .name = "pll8",
0088 .parent_names = (const char *[]){ "cxo" },
0089 .num_parents = 1,
0090 .ops = &clk_pll_ops,
0091 },
0092 };
0093
0094 static struct clk_regmap pll8_vote = {
0095 .enable_reg = 0x34c0,
0096 .enable_mask = BIT(8),
0097 .hw.init = &(struct clk_init_data){
0098 .name = "pll8_vote",
0099 .parent_names = (const char *[]){ "pll8" },
0100 .num_parents = 1,
0101 .ops = &clk_pll_vote_ops,
0102 },
0103 };
0104
0105 static struct clk_pll pll14 = {
0106 .l_reg = 0x31c4,
0107 .m_reg = 0x31c8,
0108 .n_reg = 0x31cc,
0109 .config_reg = 0x31d4,
0110 .mode_reg = 0x31c0,
0111 .status_reg = 0x31d8,
0112 .status_bit = 16,
0113 .clkr.hw.init = &(struct clk_init_data){
0114 .name = "pll14",
0115 .parent_names = (const char *[]){ "cxo" },
0116 .num_parents = 1,
0117 .ops = &clk_pll_ops,
0118 },
0119 };
0120
0121 static struct clk_regmap pll14_vote = {
0122 .enable_reg = 0x34c0,
0123 .enable_mask = BIT(11),
0124 .hw.init = &(struct clk_init_data){
0125 .name = "pll14_vote",
0126 .parent_names = (const char *[]){ "pll14" },
0127 .num_parents = 1,
0128 .ops = &clk_pll_vote_ops,
0129 },
0130 };
0131
0132 enum {
0133 P_CXO,
0134 P_PLL8,
0135 P_PLL14,
0136 };
0137
0138 static const struct parent_map gcc_cxo_pll8_map[] = {
0139 { P_CXO, 0 },
0140 { P_PLL8, 3 }
0141 };
0142
0143 static const char * const gcc_cxo_pll8[] = {
0144 "cxo",
0145 "pll8_vote",
0146 };
0147
0148 static const struct parent_map gcc_cxo_pll14_map[] = {
0149 { P_CXO, 0 },
0150 { P_PLL14, 4 }
0151 };
0152
0153 static const char * const gcc_cxo_pll14[] = {
0154 "cxo",
0155 "pll14_vote",
0156 };
0157
0158 static const struct parent_map gcc_cxo_map[] = {
0159 { P_CXO, 0 },
0160 };
0161
0162 static const char * const gcc_cxo[] = {
0163 "cxo",
0164 };
0165
0166 static struct freq_tbl clk_tbl_gsbi_uart[] = {
0167 { 1843200, P_PLL8, 2, 6, 625 },
0168 { 3686400, P_PLL8, 2, 12, 625 },
0169 { 7372800, P_PLL8, 2, 24, 625 },
0170 { 14745600, P_PLL8, 2, 48, 625 },
0171 { 16000000, P_PLL8, 4, 1, 6 },
0172 { 24000000, P_PLL8, 4, 1, 4 },
0173 { 32000000, P_PLL8, 4, 1, 3 },
0174 { 40000000, P_PLL8, 1, 5, 48 },
0175 { 46400000, P_PLL8, 1, 29, 240 },
0176 { 48000000, P_PLL8, 4, 1, 2 },
0177 { 51200000, P_PLL8, 1, 2, 15 },
0178 { 56000000, P_PLL8, 1, 7, 48 },
0179 { 58982400, P_PLL8, 1, 96, 625 },
0180 { 64000000, P_PLL8, 2, 1, 3 },
0181 { }
0182 };
0183
0184 static struct clk_rcg gsbi1_uart_src = {
0185 .ns_reg = 0x29d4,
0186 .md_reg = 0x29d0,
0187 .mn = {
0188 .mnctr_en_bit = 8,
0189 .mnctr_reset_bit = 7,
0190 .mnctr_mode_shift = 5,
0191 .n_val_shift = 16,
0192 .m_val_shift = 16,
0193 .width = 16,
0194 },
0195 .p = {
0196 .pre_div_shift = 3,
0197 .pre_div_width = 2,
0198 },
0199 .s = {
0200 .src_sel_shift = 0,
0201 .parent_map = gcc_cxo_pll8_map,
0202 },
0203 .freq_tbl = clk_tbl_gsbi_uart,
0204 .clkr = {
0205 .enable_reg = 0x29d4,
0206 .enable_mask = BIT(11),
0207 .hw.init = &(struct clk_init_data){
0208 .name = "gsbi1_uart_src",
0209 .parent_names = gcc_cxo_pll8,
0210 .num_parents = 2,
0211 .ops = &clk_rcg_ops,
0212 .flags = CLK_SET_PARENT_GATE,
0213 },
0214 },
0215 };
0216
0217 static struct clk_branch gsbi1_uart_clk = {
0218 .halt_reg = 0x2fcc,
0219 .halt_bit = 10,
0220 .clkr = {
0221 .enable_reg = 0x29d4,
0222 .enable_mask = BIT(9),
0223 .hw.init = &(struct clk_init_data){
0224 .name = "gsbi1_uart_clk",
0225 .parent_names = (const char *[]){
0226 "gsbi1_uart_src",
0227 },
0228 .num_parents = 1,
0229 .ops = &clk_branch_ops,
0230 .flags = CLK_SET_RATE_PARENT,
0231 },
0232 },
0233 };
0234
0235 static struct clk_rcg gsbi2_uart_src = {
0236 .ns_reg = 0x29f4,
0237 .md_reg = 0x29f0,
0238 .mn = {
0239 .mnctr_en_bit = 8,
0240 .mnctr_reset_bit = 7,
0241 .mnctr_mode_shift = 5,
0242 .n_val_shift = 16,
0243 .m_val_shift = 16,
0244 .width = 16,
0245 },
0246 .p = {
0247 .pre_div_shift = 3,
0248 .pre_div_width = 2,
0249 },
0250 .s = {
0251 .src_sel_shift = 0,
0252 .parent_map = gcc_cxo_pll8_map,
0253 },
0254 .freq_tbl = clk_tbl_gsbi_uart,
0255 .clkr = {
0256 .enable_reg = 0x29f4,
0257 .enable_mask = BIT(11),
0258 .hw.init = &(struct clk_init_data){
0259 .name = "gsbi2_uart_src",
0260 .parent_names = gcc_cxo_pll8,
0261 .num_parents = 2,
0262 .ops = &clk_rcg_ops,
0263 .flags = CLK_SET_PARENT_GATE,
0264 },
0265 },
0266 };
0267
0268 static struct clk_branch gsbi2_uart_clk = {
0269 .halt_reg = 0x2fcc,
0270 .halt_bit = 6,
0271 .clkr = {
0272 .enable_reg = 0x29f4,
0273 .enable_mask = BIT(9),
0274 .hw.init = &(struct clk_init_data){
0275 .name = "gsbi2_uart_clk",
0276 .parent_names = (const char *[]){
0277 "gsbi2_uart_src",
0278 },
0279 .num_parents = 1,
0280 .ops = &clk_branch_ops,
0281 .flags = CLK_SET_RATE_PARENT,
0282 },
0283 },
0284 };
0285
0286 static struct clk_rcg gsbi3_uart_src = {
0287 .ns_reg = 0x2a14,
0288 .md_reg = 0x2a10,
0289 .mn = {
0290 .mnctr_en_bit = 8,
0291 .mnctr_reset_bit = 7,
0292 .mnctr_mode_shift = 5,
0293 .n_val_shift = 16,
0294 .m_val_shift = 16,
0295 .width = 16,
0296 },
0297 .p = {
0298 .pre_div_shift = 3,
0299 .pre_div_width = 2,
0300 },
0301 .s = {
0302 .src_sel_shift = 0,
0303 .parent_map = gcc_cxo_pll8_map,
0304 },
0305 .freq_tbl = clk_tbl_gsbi_uart,
0306 .clkr = {
0307 .enable_reg = 0x2a14,
0308 .enable_mask = BIT(11),
0309 .hw.init = &(struct clk_init_data){
0310 .name = "gsbi3_uart_src",
0311 .parent_names = gcc_cxo_pll8,
0312 .num_parents = 2,
0313 .ops = &clk_rcg_ops,
0314 .flags = CLK_SET_PARENT_GATE,
0315 },
0316 },
0317 };
0318
0319 static struct clk_branch gsbi3_uart_clk = {
0320 .halt_reg = 0x2fcc,
0321 .halt_bit = 2,
0322 .clkr = {
0323 .enable_reg = 0x2a14,
0324 .enable_mask = BIT(9),
0325 .hw.init = &(struct clk_init_data){
0326 .name = "gsbi3_uart_clk",
0327 .parent_names = (const char *[]){
0328 "gsbi3_uart_src",
0329 },
0330 .num_parents = 1,
0331 .ops = &clk_branch_ops,
0332 .flags = CLK_SET_RATE_PARENT,
0333 },
0334 },
0335 };
0336
0337 static struct clk_rcg gsbi4_uart_src = {
0338 .ns_reg = 0x2a34,
0339 .md_reg = 0x2a30,
0340 .mn = {
0341 .mnctr_en_bit = 8,
0342 .mnctr_reset_bit = 7,
0343 .mnctr_mode_shift = 5,
0344 .n_val_shift = 16,
0345 .m_val_shift = 16,
0346 .width = 16,
0347 },
0348 .p = {
0349 .pre_div_shift = 3,
0350 .pre_div_width = 2,
0351 },
0352 .s = {
0353 .src_sel_shift = 0,
0354 .parent_map = gcc_cxo_pll8_map,
0355 },
0356 .freq_tbl = clk_tbl_gsbi_uart,
0357 .clkr = {
0358 .enable_reg = 0x2a34,
0359 .enable_mask = BIT(11),
0360 .hw.init = &(struct clk_init_data){
0361 .name = "gsbi4_uart_src",
0362 .parent_names = gcc_cxo_pll8,
0363 .num_parents = 2,
0364 .ops = &clk_rcg_ops,
0365 .flags = CLK_SET_PARENT_GATE,
0366 },
0367 },
0368 };
0369
0370 static struct clk_branch gsbi4_uart_clk = {
0371 .halt_reg = 0x2fd0,
0372 .halt_bit = 26,
0373 .clkr = {
0374 .enable_reg = 0x2a34,
0375 .enable_mask = BIT(9),
0376 .hw.init = &(struct clk_init_data){
0377 .name = "gsbi4_uart_clk",
0378 .parent_names = (const char *[]){
0379 "gsbi4_uart_src",
0380 },
0381 .num_parents = 1,
0382 .ops = &clk_branch_ops,
0383 .flags = CLK_SET_RATE_PARENT,
0384 },
0385 },
0386 };
0387
0388 static struct clk_rcg gsbi5_uart_src = {
0389 .ns_reg = 0x2a54,
0390 .md_reg = 0x2a50,
0391 .mn = {
0392 .mnctr_en_bit = 8,
0393 .mnctr_reset_bit = 7,
0394 .mnctr_mode_shift = 5,
0395 .n_val_shift = 16,
0396 .m_val_shift = 16,
0397 .width = 16,
0398 },
0399 .p = {
0400 .pre_div_shift = 3,
0401 .pre_div_width = 2,
0402 },
0403 .s = {
0404 .src_sel_shift = 0,
0405 .parent_map = gcc_cxo_pll8_map,
0406 },
0407 .freq_tbl = clk_tbl_gsbi_uart,
0408 .clkr = {
0409 .enable_reg = 0x2a54,
0410 .enable_mask = BIT(11),
0411 .hw.init = &(struct clk_init_data){
0412 .name = "gsbi5_uart_src",
0413 .parent_names = gcc_cxo_pll8,
0414 .num_parents = 2,
0415 .ops = &clk_rcg_ops,
0416 .flags = CLK_SET_PARENT_GATE,
0417 },
0418 },
0419 };
0420
0421 static struct clk_branch gsbi5_uart_clk = {
0422 .halt_reg = 0x2fd0,
0423 .halt_bit = 22,
0424 .clkr = {
0425 .enable_reg = 0x2a54,
0426 .enable_mask = BIT(9),
0427 .hw.init = &(struct clk_init_data){
0428 .name = "gsbi5_uart_clk",
0429 .parent_names = (const char *[]){
0430 "gsbi5_uart_src",
0431 },
0432 .num_parents = 1,
0433 .ops = &clk_branch_ops,
0434 .flags = CLK_SET_RATE_PARENT,
0435 },
0436 },
0437 };
0438
0439 static struct freq_tbl clk_tbl_gsbi_qup[] = {
0440 { 960000, P_CXO, 4, 1, 5 },
0441 { 4800000, P_CXO, 4, 0, 1 },
0442 { 9600000, P_CXO, 2, 0, 1 },
0443 { 15060000, P_PLL8, 1, 2, 51 },
0444 { 24000000, P_PLL8, 4, 1, 4 },
0445 { 25600000, P_PLL8, 1, 1, 15 },
0446 { 48000000, P_PLL8, 4, 1, 2 },
0447 { 51200000, P_PLL8, 1, 2, 15 },
0448 { }
0449 };
0450
0451 static struct clk_rcg gsbi1_qup_src = {
0452 .ns_reg = 0x29cc,
0453 .md_reg = 0x29c8,
0454 .mn = {
0455 .mnctr_en_bit = 8,
0456 .mnctr_reset_bit = 7,
0457 .mnctr_mode_shift = 5,
0458 .n_val_shift = 16,
0459 .m_val_shift = 16,
0460 .width = 8,
0461 },
0462 .p = {
0463 .pre_div_shift = 3,
0464 .pre_div_width = 2,
0465 },
0466 .s = {
0467 .src_sel_shift = 0,
0468 .parent_map = gcc_cxo_pll8_map,
0469 },
0470 .freq_tbl = clk_tbl_gsbi_qup,
0471 .clkr = {
0472 .enable_reg = 0x29cc,
0473 .enable_mask = BIT(11),
0474 .hw.init = &(struct clk_init_data){
0475 .name = "gsbi1_qup_src",
0476 .parent_names = gcc_cxo_pll8,
0477 .num_parents = 2,
0478 .ops = &clk_rcg_ops,
0479 .flags = CLK_SET_PARENT_GATE,
0480 },
0481 },
0482 };
0483
0484 static struct clk_branch gsbi1_qup_clk = {
0485 .halt_reg = 0x2fcc,
0486 .halt_bit = 9,
0487 .clkr = {
0488 .enable_reg = 0x29cc,
0489 .enable_mask = BIT(9),
0490 .hw.init = &(struct clk_init_data){
0491 .name = "gsbi1_qup_clk",
0492 .parent_names = (const char *[]){ "gsbi1_qup_src" },
0493 .num_parents = 1,
0494 .ops = &clk_branch_ops,
0495 .flags = CLK_SET_RATE_PARENT,
0496 },
0497 },
0498 };
0499
0500 static struct clk_rcg gsbi2_qup_src = {
0501 .ns_reg = 0x29ec,
0502 .md_reg = 0x29e8,
0503 .mn = {
0504 .mnctr_en_bit = 8,
0505 .mnctr_reset_bit = 7,
0506 .mnctr_mode_shift = 5,
0507 .n_val_shift = 16,
0508 .m_val_shift = 16,
0509 .width = 8,
0510 },
0511 .p = {
0512 .pre_div_shift = 3,
0513 .pre_div_width = 2,
0514 },
0515 .s = {
0516 .src_sel_shift = 0,
0517 .parent_map = gcc_cxo_pll8_map,
0518 },
0519 .freq_tbl = clk_tbl_gsbi_qup,
0520 .clkr = {
0521 .enable_reg = 0x29ec,
0522 .enable_mask = BIT(11),
0523 .hw.init = &(struct clk_init_data){
0524 .name = "gsbi2_qup_src",
0525 .parent_names = gcc_cxo_pll8,
0526 .num_parents = 2,
0527 .ops = &clk_rcg_ops,
0528 .flags = CLK_SET_PARENT_GATE,
0529 },
0530 },
0531 };
0532
0533 static struct clk_branch gsbi2_qup_clk = {
0534 .halt_reg = 0x2fcc,
0535 .halt_bit = 4,
0536 .clkr = {
0537 .enable_reg = 0x29ec,
0538 .enable_mask = BIT(9),
0539 .hw.init = &(struct clk_init_data){
0540 .name = "gsbi2_qup_clk",
0541 .parent_names = (const char *[]){ "gsbi2_qup_src" },
0542 .num_parents = 1,
0543 .ops = &clk_branch_ops,
0544 .flags = CLK_SET_RATE_PARENT,
0545 },
0546 },
0547 };
0548
0549 static struct clk_rcg gsbi3_qup_src = {
0550 .ns_reg = 0x2a0c,
0551 .md_reg = 0x2a08,
0552 .mn = {
0553 .mnctr_en_bit = 8,
0554 .mnctr_reset_bit = 7,
0555 .mnctr_mode_shift = 5,
0556 .n_val_shift = 16,
0557 .m_val_shift = 16,
0558 .width = 8,
0559 },
0560 .p = {
0561 .pre_div_shift = 3,
0562 .pre_div_width = 2,
0563 },
0564 .s = {
0565 .src_sel_shift = 0,
0566 .parent_map = gcc_cxo_pll8_map,
0567 },
0568 .freq_tbl = clk_tbl_gsbi_qup,
0569 .clkr = {
0570 .enable_reg = 0x2a0c,
0571 .enable_mask = BIT(11),
0572 .hw.init = &(struct clk_init_data){
0573 .name = "gsbi3_qup_src",
0574 .parent_names = gcc_cxo_pll8,
0575 .num_parents = 2,
0576 .ops = &clk_rcg_ops,
0577 .flags = CLK_SET_PARENT_GATE,
0578 },
0579 },
0580 };
0581
0582 static struct clk_branch gsbi3_qup_clk = {
0583 .halt_reg = 0x2fcc,
0584 .halt_bit = 0,
0585 .clkr = {
0586 .enable_reg = 0x2a0c,
0587 .enable_mask = BIT(9),
0588 .hw.init = &(struct clk_init_data){
0589 .name = "gsbi3_qup_clk",
0590 .parent_names = (const char *[]){ "gsbi3_qup_src" },
0591 .num_parents = 1,
0592 .ops = &clk_branch_ops,
0593 .flags = CLK_SET_RATE_PARENT,
0594 },
0595 },
0596 };
0597
0598 static struct clk_rcg gsbi4_qup_src = {
0599 .ns_reg = 0x2a2c,
0600 .md_reg = 0x2a28,
0601 .mn = {
0602 .mnctr_en_bit = 8,
0603 .mnctr_reset_bit = 7,
0604 .mnctr_mode_shift = 5,
0605 .n_val_shift = 16,
0606 .m_val_shift = 16,
0607 .width = 8,
0608 },
0609 .p = {
0610 .pre_div_shift = 3,
0611 .pre_div_width = 2,
0612 },
0613 .s = {
0614 .src_sel_shift = 0,
0615 .parent_map = gcc_cxo_pll8_map,
0616 },
0617 .freq_tbl = clk_tbl_gsbi_qup,
0618 .clkr = {
0619 .enable_reg = 0x2a2c,
0620 .enable_mask = BIT(11),
0621 .hw.init = &(struct clk_init_data){
0622 .name = "gsbi4_qup_src",
0623 .parent_names = gcc_cxo_pll8,
0624 .num_parents = 2,
0625 .ops = &clk_rcg_ops,
0626 .flags = CLK_SET_PARENT_GATE,
0627 },
0628 },
0629 };
0630
0631 static struct clk_branch gsbi4_qup_clk = {
0632 .halt_reg = 0x2fd0,
0633 .halt_bit = 24,
0634 .clkr = {
0635 .enable_reg = 0x2a2c,
0636 .enable_mask = BIT(9),
0637 .hw.init = &(struct clk_init_data){
0638 .name = "gsbi4_qup_clk",
0639 .parent_names = (const char *[]){ "gsbi4_qup_src" },
0640 .num_parents = 1,
0641 .ops = &clk_branch_ops,
0642 .flags = CLK_SET_RATE_PARENT,
0643 },
0644 },
0645 };
0646
0647 static struct clk_rcg gsbi5_qup_src = {
0648 .ns_reg = 0x2a4c,
0649 .md_reg = 0x2a48,
0650 .mn = {
0651 .mnctr_en_bit = 8,
0652 .mnctr_reset_bit = 7,
0653 .mnctr_mode_shift = 5,
0654 .n_val_shift = 16,
0655 .m_val_shift = 16,
0656 .width = 8,
0657 },
0658 .p = {
0659 .pre_div_shift = 3,
0660 .pre_div_width = 2,
0661 },
0662 .s = {
0663 .src_sel_shift = 0,
0664 .parent_map = gcc_cxo_pll8_map,
0665 },
0666 .freq_tbl = clk_tbl_gsbi_qup,
0667 .clkr = {
0668 .enable_reg = 0x2a4c,
0669 .enable_mask = BIT(11),
0670 .hw.init = &(struct clk_init_data){
0671 .name = "gsbi5_qup_src",
0672 .parent_names = gcc_cxo_pll8,
0673 .num_parents = 2,
0674 .ops = &clk_rcg_ops,
0675 .flags = CLK_SET_PARENT_GATE,
0676 },
0677 },
0678 };
0679
0680 static struct clk_branch gsbi5_qup_clk = {
0681 .halt_reg = 0x2fd0,
0682 .halt_bit = 20,
0683 .clkr = {
0684 .enable_reg = 0x2a4c,
0685 .enable_mask = BIT(9),
0686 .hw.init = &(struct clk_init_data){
0687 .name = "gsbi5_qup_clk",
0688 .parent_names = (const char *[]){ "gsbi5_qup_src" },
0689 .num_parents = 1,
0690 .ops = &clk_branch_ops,
0691 .flags = CLK_SET_RATE_PARENT,
0692 },
0693 },
0694 };
0695
0696 static const struct freq_tbl clk_tbl_gp[] = {
0697 { 9600000, P_CXO, 2, 0, 0 },
0698 { 19200000, P_CXO, 1, 0, 0 },
0699 { }
0700 };
0701
0702 static struct clk_rcg gp0_src = {
0703 .ns_reg = 0x2d24,
0704 .md_reg = 0x2d00,
0705 .mn = {
0706 .mnctr_en_bit = 8,
0707 .mnctr_reset_bit = 7,
0708 .mnctr_mode_shift = 5,
0709 .n_val_shift = 16,
0710 .m_val_shift = 16,
0711 .width = 8,
0712 },
0713 .p = {
0714 .pre_div_shift = 3,
0715 .pre_div_width = 2,
0716 },
0717 .s = {
0718 .src_sel_shift = 0,
0719 .parent_map = gcc_cxo_map,
0720 },
0721 .freq_tbl = clk_tbl_gp,
0722 .clkr = {
0723 .enable_reg = 0x2d24,
0724 .enable_mask = BIT(11),
0725 .hw.init = &(struct clk_init_data){
0726 .name = "gp0_src",
0727 .parent_names = gcc_cxo,
0728 .num_parents = 1,
0729 .ops = &clk_rcg_ops,
0730 .flags = CLK_SET_PARENT_GATE,
0731 },
0732 }
0733 };
0734
0735 static struct clk_branch gp0_clk = {
0736 .halt_reg = 0x2fd8,
0737 .halt_bit = 7,
0738 .clkr = {
0739 .enable_reg = 0x2d24,
0740 .enable_mask = BIT(9),
0741 .hw.init = &(struct clk_init_data){
0742 .name = "gp0_clk",
0743 .parent_names = (const char *[]){ "gp0_src" },
0744 .num_parents = 1,
0745 .ops = &clk_branch_ops,
0746 .flags = CLK_SET_RATE_PARENT,
0747 },
0748 },
0749 };
0750
0751 static struct clk_rcg gp1_src = {
0752 .ns_reg = 0x2d44,
0753 .md_reg = 0x2d40,
0754 .mn = {
0755 .mnctr_en_bit = 8,
0756 .mnctr_reset_bit = 7,
0757 .mnctr_mode_shift = 5,
0758 .n_val_shift = 16,
0759 .m_val_shift = 16,
0760 .width = 8,
0761 },
0762 .p = {
0763 .pre_div_shift = 3,
0764 .pre_div_width = 2,
0765 },
0766 .s = {
0767 .src_sel_shift = 0,
0768 .parent_map = gcc_cxo_map,
0769 },
0770 .freq_tbl = clk_tbl_gp,
0771 .clkr = {
0772 .enable_reg = 0x2d44,
0773 .enable_mask = BIT(11),
0774 .hw.init = &(struct clk_init_data){
0775 .name = "gp1_src",
0776 .parent_names = gcc_cxo,
0777 .num_parents = 1,
0778 .ops = &clk_rcg_ops,
0779 .flags = CLK_SET_RATE_GATE,
0780 },
0781 }
0782 };
0783
0784 static struct clk_branch gp1_clk = {
0785 .halt_reg = 0x2fd8,
0786 .halt_bit = 6,
0787 .clkr = {
0788 .enable_reg = 0x2d44,
0789 .enable_mask = BIT(9),
0790 .hw.init = &(struct clk_init_data){
0791 .name = "gp1_clk",
0792 .parent_names = (const char *[]){ "gp1_src" },
0793 .num_parents = 1,
0794 .ops = &clk_branch_ops,
0795 .flags = CLK_SET_RATE_PARENT,
0796 },
0797 },
0798 };
0799
0800 static struct clk_rcg gp2_src = {
0801 .ns_reg = 0x2d64,
0802 .md_reg = 0x2d60,
0803 .mn = {
0804 .mnctr_en_bit = 8,
0805 .mnctr_reset_bit = 7,
0806 .mnctr_mode_shift = 5,
0807 .n_val_shift = 16,
0808 .m_val_shift = 16,
0809 .width = 8,
0810 },
0811 .p = {
0812 .pre_div_shift = 3,
0813 .pre_div_width = 2,
0814 },
0815 .s = {
0816 .src_sel_shift = 0,
0817 .parent_map = gcc_cxo_map,
0818 },
0819 .freq_tbl = clk_tbl_gp,
0820 .clkr = {
0821 .enable_reg = 0x2d64,
0822 .enable_mask = BIT(11),
0823 .hw.init = &(struct clk_init_data){
0824 .name = "gp2_src",
0825 .parent_names = gcc_cxo,
0826 .num_parents = 1,
0827 .ops = &clk_rcg_ops,
0828 .flags = CLK_SET_RATE_GATE,
0829 },
0830 }
0831 };
0832
0833 static struct clk_branch gp2_clk = {
0834 .halt_reg = 0x2fd8,
0835 .halt_bit = 5,
0836 .clkr = {
0837 .enable_reg = 0x2d64,
0838 .enable_mask = BIT(9),
0839 .hw.init = &(struct clk_init_data){
0840 .name = "gp2_clk",
0841 .parent_names = (const char *[]){ "gp2_src" },
0842 .num_parents = 1,
0843 .ops = &clk_branch_ops,
0844 .flags = CLK_SET_RATE_PARENT,
0845 },
0846 },
0847 };
0848
0849 static struct clk_branch pmem_clk = {
0850 .hwcg_reg = 0x25a0,
0851 .hwcg_bit = 6,
0852 .halt_reg = 0x2fc8,
0853 .halt_bit = 20,
0854 .clkr = {
0855 .enable_reg = 0x25a0,
0856 .enable_mask = BIT(4),
0857 .hw.init = &(struct clk_init_data){
0858 .name = "pmem_clk",
0859 .ops = &clk_branch_ops,
0860 },
0861 },
0862 };
0863
0864 static struct clk_rcg prng_src = {
0865 .ns_reg = 0x2e80,
0866 .p = {
0867 .pre_div_shift = 3,
0868 .pre_div_width = 4,
0869 },
0870 .s = {
0871 .src_sel_shift = 0,
0872 .parent_map = gcc_cxo_pll8_map,
0873 },
0874 .clkr = {
0875 .hw.init = &(struct clk_init_data){
0876 .name = "prng_src",
0877 .parent_names = gcc_cxo_pll8,
0878 .num_parents = 2,
0879 .ops = &clk_rcg_ops,
0880 },
0881 },
0882 };
0883
0884 static struct clk_branch prng_clk = {
0885 .halt_reg = 0x2fd8,
0886 .halt_check = BRANCH_HALT_VOTED,
0887 .halt_bit = 10,
0888 .clkr = {
0889 .enable_reg = 0x3080,
0890 .enable_mask = BIT(10),
0891 .hw.init = &(struct clk_init_data){
0892 .name = "prng_clk",
0893 .parent_names = (const char *[]){ "prng_src" },
0894 .num_parents = 1,
0895 .ops = &clk_branch_ops,
0896 },
0897 },
0898 };
0899
0900 static const struct freq_tbl clk_tbl_sdc[] = {
0901 { 144000, P_CXO, 1, 1, 133 },
0902 { 400000, P_PLL8, 4, 1, 240 },
0903 { 16000000, P_PLL8, 4, 1, 6 },
0904 { 17070000, P_PLL8, 1, 2, 45 },
0905 { 20210000, P_PLL8, 1, 1, 19 },
0906 { 24000000, P_PLL8, 4, 1, 4 },
0907 { 38400000, P_PLL8, 2, 1, 5 },
0908 { 48000000, P_PLL8, 4, 1, 2 },
0909 { 64000000, P_PLL8, 3, 1, 2 },
0910 { 76800000, P_PLL8, 1, 1, 5 },
0911 { }
0912 };
0913
0914 static struct clk_rcg sdc1_src = {
0915 .ns_reg = 0x282c,
0916 .md_reg = 0x2828,
0917 .mn = {
0918 .mnctr_en_bit = 8,
0919 .mnctr_reset_bit = 7,
0920 .mnctr_mode_shift = 5,
0921 .n_val_shift = 16,
0922 .m_val_shift = 16,
0923 .width = 8,
0924 },
0925 .p = {
0926 .pre_div_shift = 3,
0927 .pre_div_width = 2,
0928 },
0929 .s = {
0930 .src_sel_shift = 0,
0931 .parent_map = gcc_cxo_pll8_map,
0932 },
0933 .freq_tbl = clk_tbl_sdc,
0934 .clkr = {
0935 .enable_reg = 0x282c,
0936 .enable_mask = BIT(11),
0937 .hw.init = &(struct clk_init_data){
0938 .name = "sdc1_src",
0939 .parent_names = gcc_cxo_pll8,
0940 .num_parents = 2,
0941 .ops = &clk_rcg_ops,
0942 },
0943 }
0944 };
0945
0946 static struct clk_branch sdc1_clk = {
0947 .halt_reg = 0x2fc8,
0948 .halt_bit = 6,
0949 .clkr = {
0950 .enable_reg = 0x282c,
0951 .enable_mask = BIT(9),
0952 .hw.init = &(struct clk_init_data){
0953 .name = "sdc1_clk",
0954 .parent_names = (const char *[]){ "sdc1_src" },
0955 .num_parents = 1,
0956 .ops = &clk_branch_ops,
0957 .flags = CLK_SET_RATE_PARENT,
0958 },
0959 },
0960 };
0961
0962 static struct clk_rcg sdc2_src = {
0963 .ns_reg = 0x284c,
0964 .md_reg = 0x2848,
0965 .mn = {
0966 .mnctr_en_bit = 8,
0967 .mnctr_reset_bit = 7,
0968 .mnctr_mode_shift = 5,
0969 .n_val_shift = 16,
0970 .m_val_shift = 16,
0971 .width = 8,
0972 },
0973 .p = {
0974 .pre_div_shift = 3,
0975 .pre_div_width = 2,
0976 },
0977 .s = {
0978 .src_sel_shift = 0,
0979 .parent_map = gcc_cxo_pll8_map,
0980 },
0981 .freq_tbl = clk_tbl_sdc,
0982 .clkr = {
0983 .enable_reg = 0x284c,
0984 .enable_mask = BIT(11),
0985 .hw.init = &(struct clk_init_data){
0986 .name = "sdc2_src",
0987 .parent_names = gcc_cxo_pll8,
0988 .num_parents = 2,
0989 .ops = &clk_rcg_ops,
0990 },
0991 }
0992 };
0993
0994 static struct clk_branch sdc2_clk = {
0995 .halt_reg = 0x2fc8,
0996 .halt_bit = 5,
0997 .clkr = {
0998 .enable_reg = 0x284c,
0999 .enable_mask = BIT(9),
1000 .hw.init = &(struct clk_init_data){
1001 .name = "sdc2_clk",
1002 .parent_names = (const char *[]){ "sdc2_src" },
1003 .num_parents = 1,
1004 .ops = &clk_branch_ops,
1005 .flags = CLK_SET_RATE_PARENT,
1006 },
1007 },
1008 };
1009
1010 static const struct freq_tbl clk_tbl_usb[] = {
1011 { 60000000, P_PLL8, 1, 5, 32 },
1012 { }
1013 };
1014
1015 static struct clk_rcg usb_hs1_xcvr_src = {
1016 .ns_reg = 0x290c,
1017 .md_reg = 0x2908,
1018 .mn = {
1019 .mnctr_en_bit = 8,
1020 .mnctr_reset_bit = 7,
1021 .mnctr_mode_shift = 5,
1022 .n_val_shift = 16,
1023 .m_val_shift = 16,
1024 .width = 8,
1025 },
1026 .p = {
1027 .pre_div_shift = 3,
1028 .pre_div_width = 2,
1029 },
1030 .s = {
1031 .src_sel_shift = 0,
1032 .parent_map = gcc_cxo_pll8_map,
1033 },
1034 .freq_tbl = clk_tbl_usb,
1035 .clkr = {
1036 .enable_reg = 0x290c,
1037 .enable_mask = BIT(11),
1038 .hw.init = &(struct clk_init_data){
1039 .name = "usb_hs1_xcvr_src",
1040 .parent_names = gcc_cxo_pll8,
1041 .num_parents = 2,
1042 .ops = &clk_rcg_ops,
1043 .flags = CLK_SET_RATE_GATE,
1044 },
1045 }
1046 };
1047
1048 static struct clk_branch usb_hs1_xcvr_clk = {
1049 .halt_reg = 0x2fc8,
1050 .halt_bit = 0,
1051 .clkr = {
1052 .enable_reg = 0x290c,
1053 .enable_mask = BIT(9),
1054 .hw.init = &(struct clk_init_data){
1055 .name = "usb_hs1_xcvr_clk",
1056 .parent_names = (const char *[]){ "usb_hs1_xcvr_src" },
1057 .num_parents = 1,
1058 .ops = &clk_branch_ops,
1059 .flags = CLK_SET_RATE_PARENT,
1060 },
1061 },
1062 };
1063
1064 static struct clk_rcg usb_hsic_xcvr_fs_src = {
1065 .ns_reg = 0x2928,
1066 .md_reg = 0x2924,
1067 .mn = {
1068 .mnctr_en_bit = 8,
1069 .mnctr_reset_bit = 7,
1070 .mnctr_mode_shift = 5,
1071 .n_val_shift = 16,
1072 .m_val_shift = 16,
1073 .width = 8,
1074 },
1075 .p = {
1076 .pre_div_shift = 3,
1077 .pre_div_width = 2,
1078 },
1079 .s = {
1080 .src_sel_shift = 0,
1081 .parent_map = gcc_cxo_pll8_map,
1082 },
1083 .freq_tbl = clk_tbl_usb,
1084 .clkr = {
1085 .enable_reg = 0x2928,
1086 .enable_mask = BIT(11),
1087 .hw.init = &(struct clk_init_data){
1088 .name = "usb_hsic_xcvr_fs_src",
1089 .parent_names = gcc_cxo_pll8,
1090 .num_parents = 2,
1091 .ops = &clk_rcg_ops,
1092 .flags = CLK_SET_RATE_GATE,
1093 },
1094 }
1095 };
1096
1097 static struct clk_branch usb_hsic_xcvr_fs_clk = {
1098 .halt_reg = 0x2fc8,
1099 .halt_bit = 9,
1100 .clkr = {
1101 .enable_reg = 0x2928,
1102 .enable_mask = BIT(9),
1103 .hw.init = &(struct clk_init_data){
1104 .name = "usb_hsic_xcvr_fs_clk",
1105 .parent_names =
1106 (const char *[]){ "usb_hsic_xcvr_fs_src" },
1107 .num_parents = 1,
1108 .ops = &clk_branch_ops,
1109 .flags = CLK_SET_RATE_PARENT,
1110 },
1111 },
1112 };
1113
1114 static const struct freq_tbl clk_tbl_usb_hs1_system[] = {
1115 { 60000000, P_PLL8, 1, 5, 32 },
1116 { }
1117 };
1118
1119 static struct clk_rcg usb_hs1_system_src = {
1120 .ns_reg = 0x36a4,
1121 .md_reg = 0x36a0,
1122 .mn = {
1123 .mnctr_en_bit = 8,
1124 .mnctr_reset_bit = 7,
1125 .mnctr_mode_shift = 5,
1126 .n_val_shift = 16,
1127 .m_val_shift = 16,
1128 .width = 8,
1129 },
1130 .p = {
1131 .pre_div_shift = 3,
1132 .pre_div_width = 2,
1133 },
1134 .s = {
1135 .src_sel_shift = 0,
1136 .parent_map = gcc_cxo_pll8_map,
1137 },
1138 .freq_tbl = clk_tbl_usb_hs1_system,
1139 .clkr = {
1140 .enable_reg = 0x36a4,
1141 .enable_mask = BIT(11),
1142 .hw.init = &(struct clk_init_data){
1143 .name = "usb_hs1_system_src",
1144 .parent_names = gcc_cxo_pll8,
1145 .num_parents = 2,
1146 .ops = &clk_rcg_ops,
1147 .flags = CLK_SET_RATE_GATE,
1148 },
1149 }
1150 };
1151
1152 static struct clk_branch usb_hs1_system_clk = {
1153 .halt_reg = 0x2fc8,
1154 .halt_bit = 4,
1155 .clkr = {
1156 .enable_reg = 0x36a4,
1157 .enable_mask = BIT(9),
1158 .hw.init = &(struct clk_init_data){
1159 .parent_names =
1160 (const char *[]){ "usb_hs1_system_src" },
1161 .num_parents = 1,
1162 .name = "usb_hs1_system_clk",
1163 .ops = &clk_branch_ops,
1164 .flags = CLK_SET_RATE_PARENT | CLK_IGNORE_UNUSED,
1165 },
1166 },
1167 };
1168
1169 static const struct freq_tbl clk_tbl_usb_hsic_system[] = {
1170 { 64000000, P_PLL8, 1, 1, 6 },
1171 { }
1172 };
1173
1174 static struct clk_rcg usb_hsic_system_src = {
1175 .ns_reg = 0x2b58,
1176 .md_reg = 0x2b54,
1177 .mn = {
1178 .mnctr_en_bit = 8,
1179 .mnctr_reset_bit = 7,
1180 .mnctr_mode_shift = 5,
1181 .n_val_shift = 16,
1182 .m_val_shift = 16,
1183 .width = 8,
1184 },
1185 .p = {
1186 .pre_div_shift = 3,
1187 .pre_div_width = 2,
1188 },
1189 .s = {
1190 .src_sel_shift = 0,
1191 .parent_map = gcc_cxo_pll8_map,
1192 },
1193 .freq_tbl = clk_tbl_usb_hsic_system,
1194 .clkr = {
1195 .enable_reg = 0x2b58,
1196 .enable_mask = BIT(11),
1197 .hw.init = &(struct clk_init_data){
1198 .name = "usb_hsic_system_src",
1199 .parent_names = gcc_cxo_pll8,
1200 .num_parents = 2,
1201 .ops = &clk_rcg_ops,
1202 .flags = CLK_SET_RATE_GATE,
1203 },
1204 }
1205 };
1206
1207 static struct clk_branch usb_hsic_system_clk = {
1208 .halt_reg = 0x2fc8,
1209 .halt_bit = 7,
1210 .clkr = {
1211 .enable_reg = 0x2b58,
1212 .enable_mask = BIT(9),
1213 .hw.init = &(struct clk_init_data){
1214 .parent_names =
1215 (const char *[]){ "usb_hsic_system_src" },
1216 .num_parents = 1,
1217 .name = "usb_hsic_system_clk",
1218 .ops = &clk_branch_ops,
1219 .flags = CLK_SET_RATE_PARENT,
1220 },
1221 },
1222 };
1223
1224 static const struct freq_tbl clk_tbl_usb_hsic_hsic[] = {
1225 { 48000000, P_PLL14, 1, 0, 0 },
1226 { }
1227 };
1228
1229 static struct clk_rcg usb_hsic_hsic_src = {
1230 .ns_reg = 0x2b50,
1231 .md_reg = 0x2b4c,
1232 .mn = {
1233 .mnctr_en_bit = 8,
1234 .mnctr_reset_bit = 7,
1235 .mnctr_mode_shift = 5,
1236 .n_val_shift = 16,
1237 .m_val_shift = 16,
1238 .width = 8,
1239 },
1240 .p = {
1241 .pre_div_shift = 3,
1242 .pre_div_width = 2,
1243 },
1244 .s = {
1245 .src_sel_shift = 0,
1246 .parent_map = gcc_cxo_pll14_map,
1247 },
1248 .freq_tbl = clk_tbl_usb_hsic_hsic,
1249 .clkr = {
1250 .enable_reg = 0x2b50,
1251 .enable_mask = BIT(11),
1252 .hw.init = &(struct clk_init_data){
1253 .name = "usb_hsic_hsic_src",
1254 .parent_names = gcc_cxo_pll14,
1255 .num_parents = 2,
1256 .ops = &clk_rcg_ops,
1257 .flags = CLK_SET_RATE_GATE,
1258 },
1259 }
1260 };
1261
1262 static struct clk_branch usb_hsic_hsic_clk = {
1263 .halt_check = BRANCH_HALT_DELAY,
1264 .clkr = {
1265 .enable_reg = 0x2b50,
1266 .enable_mask = BIT(9),
1267 .hw.init = &(struct clk_init_data){
1268 .parent_names = (const char *[]){ "usb_hsic_hsic_src" },
1269 .num_parents = 1,
1270 .name = "usb_hsic_hsic_clk",
1271 .ops = &clk_branch_ops,
1272 .flags = CLK_SET_RATE_PARENT,
1273 },
1274 },
1275 };
1276
1277 static struct clk_branch usb_hsic_hsio_cal_clk = {
1278 .halt_reg = 0x2fc8,
1279 .halt_bit = 8,
1280 .clkr = {
1281 .enable_reg = 0x2b48,
1282 .enable_mask = BIT(0),
1283 .hw.init = &(struct clk_init_data){
1284 .parent_names = (const char *[]){ "cxo" },
1285 .num_parents = 1,
1286 .name = "usb_hsic_hsio_cal_clk",
1287 .ops = &clk_branch_ops,
1288 },
1289 },
1290 };
1291
1292 static struct clk_branch ce1_core_clk = {
1293 .hwcg_reg = 0x2724,
1294 .hwcg_bit = 6,
1295 .halt_reg = 0x2fd4,
1296 .halt_bit = 27,
1297 .clkr = {
1298 .enable_reg = 0x2724,
1299 .enable_mask = BIT(4),
1300 .hw.init = &(struct clk_init_data){
1301 .name = "ce1_core_clk",
1302 .ops = &clk_branch_ops,
1303 },
1304 },
1305 };
1306
1307 static struct clk_branch ce1_h_clk = {
1308 .halt_reg = 0x2fd4,
1309 .halt_bit = 1,
1310 .clkr = {
1311 .enable_reg = 0x2720,
1312 .enable_mask = BIT(4),
1313 .hw.init = &(struct clk_init_data){
1314 .name = "ce1_h_clk",
1315 .ops = &clk_branch_ops,
1316 },
1317 },
1318 };
1319
1320 static struct clk_branch dma_bam_h_clk = {
1321 .hwcg_reg = 0x25c0,
1322 .hwcg_bit = 6,
1323 .halt_reg = 0x2fc8,
1324 .halt_bit = 12,
1325 .clkr = {
1326 .enable_reg = 0x25c0,
1327 .enable_mask = BIT(4),
1328 .hw.init = &(struct clk_init_data){
1329 .name = "dma_bam_h_clk",
1330 .ops = &clk_branch_ops,
1331 },
1332 },
1333 };
1334
1335 static struct clk_branch gsbi1_h_clk = {
1336 .hwcg_reg = 0x29c0,
1337 .hwcg_bit = 6,
1338 .halt_reg = 0x2fcc,
1339 .halt_bit = 11,
1340 .clkr = {
1341 .enable_reg = 0x29c0,
1342 .enable_mask = BIT(4),
1343 .hw.init = &(struct clk_init_data){
1344 .name = "gsbi1_h_clk",
1345 .ops = &clk_branch_ops,
1346 },
1347 },
1348 };
1349
1350 static struct clk_branch gsbi2_h_clk = {
1351 .hwcg_reg = 0x29e0,
1352 .hwcg_bit = 6,
1353 .halt_reg = 0x2fcc,
1354 .halt_bit = 7,
1355 .clkr = {
1356 .enable_reg = 0x29e0,
1357 .enable_mask = BIT(4),
1358 .hw.init = &(struct clk_init_data){
1359 .name = "gsbi2_h_clk",
1360 .ops = &clk_branch_ops,
1361 },
1362 },
1363 };
1364
1365 static struct clk_branch gsbi3_h_clk = {
1366 .hwcg_reg = 0x2a00,
1367 .hwcg_bit = 6,
1368 .halt_reg = 0x2fcc,
1369 .halt_bit = 3,
1370 .clkr = {
1371 .enable_reg = 0x2a00,
1372 .enable_mask = BIT(4),
1373 .hw.init = &(struct clk_init_data){
1374 .name = "gsbi3_h_clk",
1375 .ops = &clk_branch_ops,
1376 },
1377 },
1378 };
1379
1380 static struct clk_branch gsbi4_h_clk = {
1381 .hwcg_reg = 0x2a20,
1382 .hwcg_bit = 6,
1383 .halt_reg = 0x2fd0,
1384 .halt_bit = 27,
1385 .clkr = {
1386 .enable_reg = 0x2a20,
1387 .enable_mask = BIT(4),
1388 .hw.init = &(struct clk_init_data){
1389 .name = "gsbi4_h_clk",
1390 .ops = &clk_branch_ops,
1391 },
1392 },
1393 };
1394
1395 static struct clk_branch gsbi5_h_clk = {
1396 .hwcg_reg = 0x2a40,
1397 .hwcg_bit = 6,
1398 .halt_reg = 0x2fd0,
1399 .halt_bit = 23,
1400 .clkr = {
1401 .enable_reg = 0x2a40,
1402 .enable_mask = BIT(4),
1403 .hw.init = &(struct clk_init_data){
1404 .name = "gsbi5_h_clk",
1405 .ops = &clk_branch_ops,
1406 },
1407 },
1408 };
1409
1410 static struct clk_branch usb_hs1_h_clk = {
1411 .hwcg_reg = 0x2900,
1412 .hwcg_bit = 6,
1413 .halt_reg = 0x2fc8,
1414 .halt_bit = 1,
1415 .clkr = {
1416 .enable_reg = 0x2900,
1417 .enable_mask = BIT(4),
1418 .hw.init = &(struct clk_init_data){
1419 .name = "usb_hs1_h_clk",
1420 .ops = &clk_branch_ops,
1421 },
1422 },
1423 };
1424
1425 static struct clk_branch usb_hsic_h_clk = {
1426 .halt_reg = 0x2fcc,
1427 .halt_bit = 28,
1428 .clkr = {
1429 .enable_reg = 0x2920,
1430 .enable_mask = BIT(4),
1431 .hw.init = &(struct clk_init_data){
1432 .name = "usb_hsic_h_clk",
1433 .ops = &clk_branch_ops,
1434 },
1435 },
1436 };
1437
1438 static struct clk_branch sdc1_h_clk = {
1439 .hwcg_reg = 0x2820,
1440 .hwcg_bit = 6,
1441 .halt_reg = 0x2fc8,
1442 .halt_bit = 11,
1443 .clkr = {
1444 .enable_reg = 0x2820,
1445 .enable_mask = BIT(4),
1446 .hw.init = &(struct clk_init_data){
1447 .name = "sdc1_h_clk",
1448 .ops = &clk_branch_ops,
1449 },
1450 },
1451 };
1452
1453 static struct clk_branch sdc2_h_clk = {
1454 .hwcg_reg = 0x2840,
1455 .hwcg_bit = 6,
1456 .halt_reg = 0x2fc8,
1457 .halt_bit = 10,
1458 .clkr = {
1459 .enable_reg = 0x2840,
1460 .enable_mask = BIT(4),
1461 .hw.init = &(struct clk_init_data){
1462 .name = "sdc2_h_clk",
1463 .ops = &clk_branch_ops,
1464 },
1465 },
1466 };
1467
1468 static struct clk_branch adm0_clk = {
1469 .halt_reg = 0x2fdc,
1470 .halt_check = BRANCH_HALT_VOTED,
1471 .halt_bit = 14,
1472 .clkr = {
1473 .enable_reg = 0x3080,
1474 .enable_mask = BIT(2),
1475 .hw.init = &(struct clk_init_data){
1476 .name = "adm0_clk",
1477 .ops = &clk_branch_ops,
1478 },
1479 },
1480 };
1481
1482 static struct clk_branch adm0_pbus_clk = {
1483 .hwcg_reg = 0x2208,
1484 .hwcg_bit = 6,
1485 .halt_reg = 0x2fdc,
1486 .halt_check = BRANCH_HALT_VOTED,
1487 .halt_bit = 13,
1488 .clkr = {
1489 .enable_reg = 0x3080,
1490 .enable_mask = BIT(3),
1491 .hw.init = &(struct clk_init_data){
1492 .name = "adm0_pbus_clk",
1493 .ops = &clk_branch_ops,
1494 },
1495 },
1496 };
1497
1498 static struct clk_branch pmic_arb0_h_clk = {
1499 .halt_reg = 0x2fd8,
1500 .halt_check = BRANCH_HALT_VOTED,
1501 .halt_bit = 22,
1502 .clkr = {
1503 .enable_reg = 0x3080,
1504 .enable_mask = BIT(8),
1505 .hw.init = &(struct clk_init_data){
1506 .name = "pmic_arb0_h_clk",
1507 .ops = &clk_branch_ops,
1508 },
1509 },
1510 };
1511
1512 static struct clk_branch pmic_arb1_h_clk = {
1513 .halt_reg = 0x2fd8,
1514 .halt_check = BRANCH_HALT_VOTED,
1515 .halt_bit = 21,
1516 .clkr = {
1517 .enable_reg = 0x3080,
1518 .enable_mask = BIT(9),
1519 .hw.init = &(struct clk_init_data){
1520 .name = "pmic_arb1_h_clk",
1521 .ops = &clk_branch_ops,
1522 },
1523 },
1524 };
1525
1526 static struct clk_branch pmic_ssbi2_clk = {
1527 .halt_reg = 0x2fd8,
1528 .halt_check = BRANCH_HALT_VOTED,
1529 .halt_bit = 23,
1530 .clkr = {
1531 .enable_reg = 0x3080,
1532 .enable_mask = BIT(7),
1533 .hw.init = &(struct clk_init_data){
1534 .name = "pmic_ssbi2_clk",
1535 .ops = &clk_branch_ops,
1536 },
1537 },
1538 };
1539
1540 static struct clk_branch rpm_msg_ram_h_clk = {
1541 .hwcg_reg = 0x27e0,
1542 .hwcg_bit = 6,
1543 .halt_reg = 0x2fd8,
1544 .halt_check = BRANCH_HALT_VOTED,
1545 .halt_bit = 12,
1546 .clkr = {
1547 .enable_reg = 0x3080,
1548 .enable_mask = BIT(6),
1549 .hw.init = &(struct clk_init_data){
1550 .name = "rpm_msg_ram_h_clk",
1551 .ops = &clk_branch_ops,
1552 },
1553 },
1554 };
1555
1556 static struct clk_branch ebi2_clk = {
1557 .hwcg_reg = 0x2664,
1558 .hwcg_bit = 6,
1559 .halt_reg = 0x2fcc,
1560 .halt_bit = 24,
1561 .clkr = {
1562 .enable_reg = 0x2664,
1563 .enable_mask = BIT(6) | BIT(4),
1564 .hw.init = &(struct clk_init_data){
1565 .name = "ebi2_clk",
1566 .ops = &clk_branch_ops,
1567 },
1568 },
1569 };
1570
1571 static struct clk_branch ebi2_aon_clk = {
1572 .halt_reg = 0x2fcc,
1573 .halt_bit = 23,
1574 .clkr = {
1575 .enable_reg = 0x2664,
1576 .enable_mask = BIT(8),
1577 .hw.init = &(struct clk_init_data){
1578 .name = "ebi2_aon_clk",
1579 .ops = &clk_branch_ops,
1580 },
1581 },
1582 };
1583
1584 static struct clk_hw *gcc_mdm9615_hws[] = {
1585 &cxo.hw,
1586 };
1587
1588 static struct clk_regmap *gcc_mdm9615_clks[] = {
1589 [PLL0] = &pll0.clkr,
1590 [PLL0_VOTE] = &pll0_vote,
1591 [PLL4_VOTE] = &pll4_vote,
1592 [PLL8] = &pll8.clkr,
1593 [PLL8_VOTE] = &pll8_vote,
1594 [PLL14] = &pll14.clkr,
1595 [PLL14_VOTE] = &pll14_vote,
1596 [GSBI1_UART_SRC] = &gsbi1_uart_src.clkr,
1597 [GSBI1_UART_CLK] = &gsbi1_uart_clk.clkr,
1598 [GSBI2_UART_SRC] = &gsbi2_uart_src.clkr,
1599 [GSBI2_UART_CLK] = &gsbi2_uart_clk.clkr,
1600 [GSBI3_UART_SRC] = &gsbi3_uart_src.clkr,
1601 [GSBI3_UART_CLK] = &gsbi3_uart_clk.clkr,
1602 [GSBI4_UART_SRC] = &gsbi4_uart_src.clkr,
1603 [GSBI4_UART_CLK] = &gsbi4_uart_clk.clkr,
1604 [GSBI5_UART_SRC] = &gsbi5_uart_src.clkr,
1605 [GSBI5_UART_CLK] = &gsbi5_uart_clk.clkr,
1606 [GSBI1_QUP_SRC] = &gsbi1_qup_src.clkr,
1607 [GSBI1_QUP_CLK] = &gsbi1_qup_clk.clkr,
1608 [GSBI2_QUP_SRC] = &gsbi2_qup_src.clkr,
1609 [GSBI2_QUP_CLK] = &gsbi2_qup_clk.clkr,
1610 [GSBI3_QUP_SRC] = &gsbi3_qup_src.clkr,
1611 [GSBI3_QUP_CLK] = &gsbi3_qup_clk.clkr,
1612 [GSBI4_QUP_SRC] = &gsbi4_qup_src.clkr,
1613 [GSBI4_QUP_CLK] = &gsbi4_qup_clk.clkr,
1614 [GSBI5_QUP_SRC] = &gsbi5_qup_src.clkr,
1615 [GSBI5_QUP_CLK] = &gsbi5_qup_clk.clkr,
1616 [GP0_SRC] = &gp0_src.clkr,
1617 [GP0_CLK] = &gp0_clk.clkr,
1618 [GP1_SRC] = &gp1_src.clkr,
1619 [GP1_CLK] = &gp1_clk.clkr,
1620 [GP2_SRC] = &gp2_src.clkr,
1621 [GP2_CLK] = &gp2_clk.clkr,
1622 [PMEM_A_CLK] = &pmem_clk.clkr,
1623 [PRNG_SRC] = &prng_src.clkr,
1624 [PRNG_CLK] = &prng_clk.clkr,
1625 [SDC1_SRC] = &sdc1_src.clkr,
1626 [SDC1_CLK] = &sdc1_clk.clkr,
1627 [SDC2_SRC] = &sdc2_src.clkr,
1628 [SDC2_CLK] = &sdc2_clk.clkr,
1629 [USB_HS1_XCVR_SRC] = &usb_hs1_xcvr_src.clkr,
1630 [USB_HS1_XCVR_CLK] = &usb_hs1_xcvr_clk.clkr,
1631 [USB_HS1_SYSTEM_CLK_SRC] = &usb_hs1_system_src.clkr,
1632 [USB_HS1_SYSTEM_CLK] = &usb_hs1_system_clk.clkr,
1633 [USB_HSIC_XCVR_FS_SRC] = &usb_hsic_xcvr_fs_src.clkr,
1634 [USB_HSIC_XCVR_FS_CLK] = &usb_hsic_xcvr_fs_clk.clkr,
1635 [USB_HSIC_SYSTEM_CLK_SRC] = &usb_hsic_system_src.clkr,
1636 [USB_HSIC_SYSTEM_CLK] = &usb_hsic_system_clk.clkr,
1637 [USB_HSIC_HSIC_CLK_SRC] = &usb_hsic_hsic_src.clkr,
1638 [USB_HSIC_HSIC_CLK] = &usb_hsic_hsic_clk.clkr,
1639 [USB_HSIC_HSIO_CAL_CLK] = &usb_hsic_hsio_cal_clk.clkr,
1640 [CE1_CORE_CLK] = &ce1_core_clk.clkr,
1641 [CE1_H_CLK] = &ce1_h_clk.clkr,
1642 [DMA_BAM_H_CLK] = &dma_bam_h_clk.clkr,
1643 [GSBI1_H_CLK] = &gsbi1_h_clk.clkr,
1644 [GSBI2_H_CLK] = &gsbi2_h_clk.clkr,
1645 [GSBI3_H_CLK] = &gsbi3_h_clk.clkr,
1646 [GSBI4_H_CLK] = &gsbi4_h_clk.clkr,
1647 [GSBI5_H_CLK] = &gsbi5_h_clk.clkr,
1648 [USB_HS1_H_CLK] = &usb_hs1_h_clk.clkr,
1649 [USB_HSIC_H_CLK] = &usb_hsic_h_clk.clkr,
1650 [SDC1_H_CLK] = &sdc1_h_clk.clkr,
1651 [SDC2_H_CLK] = &sdc2_h_clk.clkr,
1652 [ADM0_CLK] = &adm0_clk.clkr,
1653 [ADM0_PBUS_CLK] = &adm0_pbus_clk.clkr,
1654 [PMIC_ARB0_H_CLK] = &pmic_arb0_h_clk.clkr,
1655 [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr,
1656 [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr,
1657 [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr,
1658 [EBI2_CLK] = &ebi2_clk.clkr,
1659 [EBI2_AON_CLK] = &ebi2_aon_clk.clkr,
1660 };
1661
1662 static const struct qcom_reset_map gcc_mdm9615_resets[] = {
1663 [DMA_BAM_RESET] = { 0x25c0, 7 },
1664 [CE1_H_RESET] = { 0x2720, 7 },
1665 [CE1_CORE_RESET] = { 0x2724, 7 },
1666 [SDC1_RESET] = { 0x2830 },
1667 [SDC2_RESET] = { 0x2850 },
1668 [ADM0_C2_RESET] = { 0x220c, 4 },
1669 [ADM0_C1_RESET] = { 0x220c, 3 },
1670 [ADM0_C0_RESET] = { 0x220c, 2 },
1671 [ADM0_PBUS_RESET] = { 0x220c, 1 },
1672 [ADM0_RESET] = { 0x220c },
1673 [USB_HS1_RESET] = { 0x2910 },
1674 [USB_HSIC_RESET] = { 0x2934 },
1675 [GSBI1_RESET] = { 0x29dc },
1676 [GSBI2_RESET] = { 0x29fc },
1677 [GSBI3_RESET] = { 0x2a1c },
1678 [GSBI4_RESET] = { 0x2a3c },
1679 [GSBI5_RESET] = { 0x2a5c },
1680 [PDM_RESET] = { 0x2CC0, 12 },
1681 };
1682
1683 static const struct regmap_config gcc_mdm9615_regmap_config = {
1684 .reg_bits = 32,
1685 .reg_stride = 4,
1686 .val_bits = 32,
1687 .max_register = 0x3660,
1688 .fast_io = true,
1689 };
1690
1691 static const struct qcom_cc_desc gcc_mdm9615_desc = {
1692 .config = &gcc_mdm9615_regmap_config,
1693 .clks = gcc_mdm9615_clks,
1694 .num_clks = ARRAY_SIZE(gcc_mdm9615_clks),
1695 .resets = gcc_mdm9615_resets,
1696 .num_resets = ARRAY_SIZE(gcc_mdm9615_resets),
1697 .clk_hws = gcc_mdm9615_hws,
1698 .num_clk_hws = ARRAY_SIZE(gcc_mdm9615_hws),
1699 };
1700
1701 static const struct of_device_id gcc_mdm9615_match_table[] = {
1702 { .compatible = "qcom,gcc-mdm9615" },
1703 { }
1704 };
1705 MODULE_DEVICE_TABLE(of, gcc_mdm9615_match_table);
1706
1707 static int gcc_mdm9615_probe(struct platform_device *pdev)
1708 {
1709 struct regmap *regmap;
1710
1711 regmap = qcom_cc_map(pdev, &gcc_mdm9615_desc);
1712 if (IS_ERR(regmap))
1713 return PTR_ERR(regmap);
1714
1715 return qcom_cc_really_probe(pdev, &gcc_mdm9615_desc, regmap);
1716 }
1717
1718 static struct platform_driver gcc_mdm9615_driver = {
1719 .probe = gcc_mdm9615_probe,
1720 .driver = {
1721 .name = "gcc-mdm9615",
1722 .of_match_table = gcc_mdm9615_match_table,
1723 },
1724 };
1725
1726 static int __init gcc_mdm9615_init(void)
1727 {
1728 return platform_driver_register(&gcc_mdm9615_driver);
1729 }
1730 core_initcall(gcc_mdm9615_init);
1731
1732 static void __exit gcc_mdm9615_exit(void)
1733 {
1734 platform_driver_unregister(&gcc_mdm9615_driver);
1735 }
1736 module_exit(gcc_mdm9615_exit);
1737
1738 MODULE_DESCRIPTION("QCOM GCC MDM9615 Driver");
1739 MODULE_LICENSE("GPL v2");
1740 MODULE_ALIAS("platform:gcc-mdm9615");