Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017, The Linux Foundation. All rights reserved. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License version 2 and |
| 6 | * only version 2 as published by the Free Software Foundation. |
| 7 | * |
| 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. |
| 12 | */ |
| 13 | |
Deepak Katragadda | 9abd794 | 2017-06-13 14:20:09 -0700 | [diff] [blame] | 14 | #define pr_fmt(fmt) "clk: %s: " fmt, __func__ |
| 15 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 16 | #include <linux/kernel.h> |
| 17 | #include <linux/bitops.h> |
| 18 | #include <linux/err.h> |
| 19 | #include <linux/platform_device.h> |
| 20 | #include <linux/module.h> |
| 21 | #include <linux/of.h> |
| 22 | #include <linux/of_device.h> |
| 23 | #include <linux/clk-provider.h> |
| 24 | #include <linux/regmap.h> |
| 25 | #include <linux/reset-controller.h> |
| 26 | |
| 27 | #include <dt-bindings/clock/qcom,camcc-sdm845.h> |
| 28 | |
| 29 | #include "common.h" |
| 30 | #include "clk-regmap.h" |
| 31 | #include "clk-pll.h" |
| 32 | #include "clk-rcg.h" |
| 33 | #include "clk-branch.h" |
| 34 | #include "reset.h" |
| 35 | #include "clk-alpha-pll.h" |
| 36 | #include "vdd-level-sdm845.h" |
| 37 | |
| 38 | #define F(f, s, h, m, n) { (f), (s), (2 * (h) - 1), (m), (n) } |
| 39 | |
| 40 | static DEFINE_VDD_REGULATORS(vdd_cx, VDD_CX_NUM, 1, vdd_corner); |
| 41 | static DEFINE_VDD_REGULATORS(vdd_mx, VDD_CX_NUM, 1, vdd_corner); |
| 42 | |
| 43 | enum { |
| 44 | P_BI_TCXO, |
| 45 | P_CAM_CC_PLL0_OUT_EVEN, |
| 46 | P_CAM_CC_PLL1_OUT_EVEN, |
| 47 | P_CAM_CC_PLL2_OUT_EVEN, |
| 48 | P_CAM_CC_PLL2_OUT_ODD, |
| 49 | P_CAM_CC_PLL3_OUT_EVEN, |
| 50 | P_CORE_BI_PLL_TEST_SE, |
| 51 | }; |
| 52 | |
| 53 | static const struct parent_map cam_cc_parent_map_0[] = { |
| 54 | { P_BI_TCXO, 0 }, |
| 55 | { P_CAM_CC_PLL2_OUT_EVEN, 1 }, |
| 56 | { P_CAM_CC_PLL1_OUT_EVEN, 2 }, |
| 57 | { P_CAM_CC_PLL3_OUT_EVEN, 5 }, |
| 58 | { P_CAM_CC_PLL0_OUT_EVEN, 6 }, |
| 59 | { P_CORE_BI_PLL_TEST_SE, 7 }, |
| 60 | }; |
| 61 | |
| 62 | static const char * const cam_cc_parent_names_0[] = { |
| 63 | "bi_tcxo", |
| 64 | "cam_cc_pll2_out_even", |
| 65 | "cam_cc_pll1_out_even", |
| 66 | "cam_cc_pll3_out_even", |
| 67 | "cam_cc_pll0_out_even", |
| 68 | "core_bi_pll_test_se", |
| 69 | }; |
| 70 | |
| 71 | static const struct parent_map cam_cc_parent_map_1[] = { |
| 72 | { P_BI_TCXO, 0 }, |
| 73 | { P_CAM_CC_PLL2_OUT_EVEN, 1 }, |
| 74 | { P_CAM_CC_PLL1_OUT_EVEN, 2 }, |
| 75 | { P_CAM_CC_PLL2_OUT_ODD, 4 }, |
| 76 | { P_CAM_CC_PLL3_OUT_EVEN, 5 }, |
| 77 | { P_CAM_CC_PLL0_OUT_EVEN, 6 }, |
| 78 | { P_CORE_BI_PLL_TEST_SE, 7 }, |
| 79 | }; |
| 80 | |
| 81 | static const char * const cam_cc_parent_names_1[] = { |
| 82 | "bi_tcxo", |
| 83 | "cam_cc_pll2_out_even", |
| 84 | "cam_cc_pll1_out_even", |
| 85 | "cam_cc_pll2_out_odd", |
| 86 | "cam_cc_pll3_out_even", |
| 87 | "cam_cc_pll0_out_even", |
| 88 | "core_bi_pll_test_se", |
| 89 | }; |
| 90 | |
| 91 | static struct pll_vco fabia_vco[] = { |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 92 | { 249600000, 2000000000, 0 }, |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 93 | { 125000000, 1000000000, 1 }, |
| 94 | }; |
| 95 | |
| 96 | static const struct pll_config cam_cc_pll0_config = { |
| 97 | .l = 0x1f, |
| 98 | .frac = 0x4000, |
| 99 | }; |
| 100 | |
| 101 | static struct clk_alpha_pll cam_cc_pll0 = { |
| 102 | .offset = 0x0, |
| 103 | .vco_table = fabia_vco, |
| 104 | .num_vco = ARRAY_SIZE(fabia_vco), |
| 105 | .type = FABIA_PLL, |
| 106 | .clkr = { |
| 107 | .hw.init = &(struct clk_init_data){ |
| 108 | .name = "cam_cc_pll0", |
| 109 | .parent_names = (const char *[]){ "bi_tcxo" }, |
| 110 | .num_parents = 1, |
| 111 | .ops = &clk_fabia_pll_ops, |
Deepak Katragadda | d04d2ca | 2017-03-30 11:03:20 -0700 | [diff] [blame] | 112 | VDD_CX_FMAX_MAP4( |
| 113 | MIN, 615000000, |
| 114 | LOW, 1066000000, |
| 115 | LOW_L1, 1600000000, |
| 116 | NOMINAL, 2000000000), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 117 | }, |
| 118 | }, |
| 119 | }; |
| 120 | |
| 121 | static const struct clk_div_table post_div_table_fabia_even[] = { |
| 122 | { 0x0, 1 }, |
| 123 | { 0x1, 2 }, |
| 124 | { 0x3, 4 }, |
| 125 | { 0x7, 8 }, |
| 126 | { } |
| 127 | }; |
| 128 | |
| 129 | static struct clk_alpha_pll_postdiv cam_cc_pll0_out_even = { |
| 130 | .offset = 0x0, |
| 131 | .post_div_shift = 8, |
| 132 | .post_div_table = post_div_table_fabia_even, |
| 133 | .num_post_div = ARRAY_SIZE(post_div_table_fabia_even), |
| 134 | .width = 4, |
| 135 | .clkr.hw.init = &(struct clk_init_data){ |
| 136 | .name = "cam_cc_pll0_out_even", |
| 137 | .parent_names = (const char *[]){ "cam_cc_pll0" }, |
| 138 | .num_parents = 1, |
| 139 | .ops = &clk_generic_pll_postdiv_ops, |
| 140 | }, |
| 141 | }; |
| 142 | |
| 143 | static const struct pll_config cam_cc_pll1_config = { |
| 144 | .l = 0x2a, |
| 145 | .frac = 0x1556, |
| 146 | }; |
| 147 | |
| 148 | static struct clk_alpha_pll cam_cc_pll1 = { |
| 149 | .offset = 0x1000, |
| 150 | .vco_table = fabia_vco, |
| 151 | .num_vco = ARRAY_SIZE(fabia_vco), |
| 152 | .type = FABIA_PLL, |
| 153 | .clkr = { |
| 154 | .hw.init = &(struct clk_init_data){ |
| 155 | .name = "cam_cc_pll1", |
| 156 | .parent_names = (const char *[]){ "bi_tcxo" }, |
| 157 | .num_parents = 1, |
| 158 | .ops = &clk_fabia_pll_ops, |
Deepak Katragadda | d04d2ca | 2017-03-30 11:03:20 -0700 | [diff] [blame] | 159 | VDD_CX_FMAX_MAP4( |
| 160 | MIN, 615000000, |
| 161 | LOW, 1066000000, |
| 162 | LOW_L1, 1600000000, |
| 163 | NOMINAL, 2000000000), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 164 | }, |
| 165 | }, |
| 166 | }; |
| 167 | |
| 168 | static struct clk_alpha_pll_postdiv cam_cc_pll1_out_even = { |
| 169 | .offset = 0x1000, |
| 170 | .post_div_shift = 8, |
| 171 | .post_div_table = post_div_table_fabia_even, |
| 172 | .num_post_div = ARRAY_SIZE(post_div_table_fabia_even), |
| 173 | .width = 4, |
| 174 | .clkr.hw.init = &(struct clk_init_data){ |
| 175 | .name = "cam_cc_pll1_out_even", |
| 176 | .parent_names = (const char *[]){ "cam_cc_pll1" }, |
| 177 | .num_parents = 1, |
| 178 | .ops = &clk_generic_pll_postdiv_ops, |
| 179 | }, |
| 180 | }; |
| 181 | |
| 182 | static const struct pll_config cam_cc_pll2_config = { |
| 183 | .l = 0x32, |
| 184 | .frac = 0x0, |
| 185 | }; |
| 186 | |
| 187 | static struct clk_alpha_pll cam_cc_pll2 = { |
| 188 | .offset = 0x2000, |
| 189 | .vco_table = fabia_vco, |
| 190 | .num_vco = ARRAY_SIZE(fabia_vco), |
| 191 | .type = FABIA_PLL, |
| 192 | .clkr = { |
| 193 | .hw.init = &(struct clk_init_data){ |
| 194 | .name = "cam_cc_pll2", |
| 195 | .parent_names = (const char *[]){ "bi_tcxo" }, |
| 196 | .num_parents = 1, |
| 197 | .ops = &clk_fabia_pll_ops, |
Deepak Katragadda | d04d2ca | 2017-03-30 11:03:20 -0700 | [diff] [blame] | 198 | VDD_MX_FMAX_MAP4( |
| 199 | MIN, 615000000, |
| 200 | LOW, 1066000000, |
| 201 | LOW_L1, 1600000000, |
| 202 | NOMINAL, 2000000000), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 203 | }, |
| 204 | }, |
| 205 | }; |
| 206 | |
| 207 | static struct clk_alpha_pll_postdiv cam_cc_pll2_out_even = { |
| 208 | .offset = 0x2000, |
| 209 | .post_div_shift = 8, |
| 210 | .post_div_table = post_div_table_fabia_even, |
| 211 | .num_post_div = ARRAY_SIZE(post_div_table_fabia_even), |
| 212 | .width = 4, |
| 213 | .clkr.hw.init = &(struct clk_init_data){ |
| 214 | .name = "cam_cc_pll2_out_even", |
| 215 | .parent_names = (const char *[]){ "cam_cc_pll2" }, |
| 216 | .num_parents = 1, |
| 217 | .ops = &clk_generic_pll_postdiv_ops, |
| 218 | }, |
| 219 | }; |
| 220 | |
| 221 | static const struct clk_div_table post_div_table_fabia_odd[] = { |
| 222 | { 0x0, 1 }, |
| 223 | { 0x3, 3 }, |
| 224 | { 0x5, 5 }, |
| 225 | { 0x7, 7 }, |
| 226 | { } |
| 227 | }; |
| 228 | |
| 229 | static struct clk_alpha_pll_postdiv cam_cc_pll2_out_odd = { |
| 230 | .offset = 0x2000, |
| 231 | .post_div_shift = 12, |
| 232 | .post_div_table = post_div_table_fabia_odd, |
| 233 | .num_post_div = ARRAY_SIZE(post_div_table_fabia_odd), |
| 234 | .width = 4, |
| 235 | .clkr.hw.init = &(struct clk_init_data){ |
| 236 | .name = "cam_cc_pll2_out_odd", |
| 237 | .parent_names = (const char *[]){ "cam_cc_pll2" }, |
| 238 | .num_parents = 1, |
| 239 | .ops = &clk_generic_pll_postdiv_ops, |
| 240 | }, |
| 241 | }; |
| 242 | |
| 243 | static const struct pll_config cam_cc_pll3_config = { |
| 244 | .l = 0x14, |
| 245 | .frac = 0x0, |
| 246 | }; |
| 247 | |
| 248 | static struct clk_alpha_pll cam_cc_pll3 = { |
| 249 | .offset = 0x3000, |
| 250 | .vco_table = fabia_vco, |
| 251 | .num_vco = ARRAY_SIZE(fabia_vco), |
| 252 | .type = FABIA_PLL, |
| 253 | .clkr = { |
| 254 | .hw.init = &(struct clk_init_data){ |
| 255 | .name = "cam_cc_pll3", |
| 256 | .parent_names = (const char *[]){ "bi_tcxo" }, |
| 257 | .num_parents = 1, |
| 258 | .ops = &clk_fabia_pll_ops, |
Deepak Katragadda | d04d2ca | 2017-03-30 11:03:20 -0700 | [diff] [blame] | 259 | VDD_CX_FMAX_MAP4( |
| 260 | MIN, 615000000, |
| 261 | LOW, 1066000000, |
| 262 | LOW_L1, 1600000000, |
| 263 | NOMINAL, 2000000000), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 264 | }, |
| 265 | }, |
| 266 | }; |
| 267 | |
| 268 | static struct clk_alpha_pll_postdiv cam_cc_pll3_out_even = { |
| 269 | .offset = 0x3000, |
| 270 | .post_div_shift = 8, |
| 271 | .post_div_table = post_div_table_fabia_even, |
| 272 | .num_post_div = ARRAY_SIZE(post_div_table_fabia_even), |
| 273 | .width = 4, |
| 274 | .clkr.hw.init = &(struct clk_init_data){ |
| 275 | .name = "cam_cc_pll3_out_even", |
| 276 | .parent_names = (const char *[]){ "cam_cc_pll3" }, |
| 277 | .num_parents = 1, |
| 278 | .ops = &clk_generic_pll_postdiv_ops, |
| 279 | }, |
| 280 | }; |
| 281 | |
| 282 | static const struct freq_tbl ftbl_cam_cc_bps_clk_src[] = { |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 283 | F(19200000, P_BI_TCXO, 1, 0, 0), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 284 | F(100000000, P_CAM_CC_PLL0_OUT_EVEN, 6, 0, 0), |
| 285 | F(200000000, P_CAM_CC_PLL0_OUT_EVEN, 3, 0, 0), |
| 286 | F(404000000, P_CAM_CC_PLL1_OUT_EVEN, 2, 0, 0), |
| 287 | F(480000000, P_CAM_CC_PLL2_OUT_EVEN, 1, 0, 0), |
| 288 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 289 | { } |
| 290 | }; |
| 291 | |
| 292 | static struct clk_rcg2 cam_cc_bps_clk_src = { |
| 293 | .cmd_rcgr = 0x600c, |
| 294 | .mnd_width = 0, |
| 295 | .hid_width = 5, |
| 296 | .enable_safe_config = true, |
| 297 | .parent_map = cam_cc_parent_map_0, |
| 298 | .freq_tbl = ftbl_cam_cc_bps_clk_src, |
| 299 | .clkr.hw.init = &(struct clk_init_data){ |
| 300 | .name = "cam_cc_bps_clk_src", |
| 301 | .parent_names = cam_cc_parent_names_0, |
| 302 | .num_parents = 6, |
| 303 | .flags = CLK_SET_RATE_PARENT, |
| 304 | .ops = &clk_rcg2_ops, |
| 305 | VDD_CX_FMAX_MAP5( |
| 306 | MIN, 19200000, |
| 307 | LOWER, 200000000, |
| 308 | LOW, 404000000, |
| 309 | LOW_L1, 480000000, |
| 310 | NOMINAL, 600000000), |
| 311 | }, |
| 312 | }; |
| 313 | |
| 314 | static const struct freq_tbl ftbl_cam_cc_cci_clk_src[] = { |
| 315 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 316 | F(37500000, P_CAM_CC_PLL0_OUT_EVEN, 16, 0, 0), |
| 317 | F(50000000, P_CAM_CC_PLL0_OUT_EVEN, 12, 0, 0), |
| 318 | F(100000000, P_CAM_CC_PLL0_OUT_EVEN, 6, 0, 0), |
| 319 | { } |
| 320 | }; |
| 321 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 322 | static struct clk_rcg2 cam_cc_cci_clk_src = { |
| 323 | .cmd_rcgr = 0xb0d8, |
| 324 | .mnd_width = 8, |
| 325 | .hid_width = 5, |
| 326 | .parent_map = cam_cc_parent_map_0, |
| 327 | .freq_tbl = ftbl_cam_cc_cci_clk_src, |
| 328 | .clkr.hw.init = &(struct clk_init_data){ |
| 329 | .name = "cam_cc_cci_clk_src", |
| 330 | .parent_names = cam_cc_parent_names_0, |
| 331 | .num_parents = 6, |
| 332 | .flags = CLK_SET_RATE_PARENT, |
| 333 | .ops = &clk_rcg2_ops, |
| 334 | VDD_CX_FMAX_MAP4( |
| 335 | MIN, 19200000, |
| 336 | LOWER, 37500000, |
| 337 | LOW, 50000000, |
| 338 | NOMINAL, 100000000), |
| 339 | }, |
| 340 | }; |
| 341 | |
| 342 | static const struct freq_tbl ftbl_cam_cc_cphy_rx_clk_src[] = { |
| 343 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 344 | F(300000000, P_CAM_CC_PLL0_OUT_EVEN, 2, 0, 0), |
| 345 | F(320000000, P_CAM_CC_PLL2_OUT_ODD, 3, 0, 0), |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 346 | F(384000000, P_CAM_CC_PLL3_OUT_EVEN, 1, 0, 0), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 347 | { } |
| 348 | }; |
| 349 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 350 | static const struct freq_tbl ftbl_cam_cc_cphy_rx_clk_src_sdm845_v2[] = { |
| 351 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 352 | F(384000000, P_CAM_CC_PLL3_OUT_EVEN, 1, 0, 0), |
| 353 | { } |
| 354 | }; |
| 355 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 356 | static struct clk_rcg2 cam_cc_cphy_rx_clk_src = { |
| 357 | .cmd_rcgr = 0x9060, |
| 358 | .mnd_width = 0, |
| 359 | .hid_width = 5, |
| 360 | .parent_map = cam_cc_parent_map_1, |
| 361 | .freq_tbl = ftbl_cam_cc_cphy_rx_clk_src, |
| 362 | .clkr.hw.init = &(struct clk_init_data){ |
| 363 | .name = "cam_cc_cphy_rx_clk_src", |
| 364 | .parent_names = cam_cc_parent_names_1, |
| 365 | .num_parents = 7, |
| 366 | .flags = CLK_SET_RATE_PARENT, |
| 367 | .ops = &clk_rcg2_ops, |
| 368 | VDD_CX_FMAX_MAP4( |
| 369 | MIN, 19200000, |
| 370 | LOWER, 300000000, |
| 371 | LOW, 320000000, |
| 372 | HIGH, 384000000), |
| 373 | }, |
| 374 | }; |
| 375 | |
| 376 | static const struct freq_tbl ftbl_cam_cc_csi0phytimer_clk_src[] = { |
| 377 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 378 | F(240000000, P_CAM_CC_PLL2_OUT_EVEN, 2, 0, 0), |
| 379 | F(269333333, P_CAM_CC_PLL1_OUT_EVEN, 3, 0, 0), |
| 380 | { } |
| 381 | }; |
| 382 | |
| 383 | static struct clk_rcg2 cam_cc_csi0phytimer_clk_src = { |
| 384 | .cmd_rcgr = 0x5004, |
| 385 | .mnd_width = 0, |
| 386 | .hid_width = 5, |
| 387 | .parent_map = cam_cc_parent_map_0, |
| 388 | .freq_tbl = ftbl_cam_cc_csi0phytimer_clk_src, |
| 389 | .clkr.hw.init = &(struct clk_init_data){ |
| 390 | .name = "cam_cc_csi0phytimer_clk_src", |
| 391 | .parent_names = cam_cc_parent_names_0, |
| 392 | .num_parents = 6, |
| 393 | .flags = CLK_SET_RATE_PARENT, |
| 394 | .ops = &clk_rcg2_ops, |
| 395 | VDD_CX_FMAX_MAP3( |
| 396 | MIN, 19200000, |
| 397 | LOWER, 240000000, |
| 398 | LOW, 269333333), |
| 399 | }, |
| 400 | }; |
| 401 | |
| 402 | static struct clk_rcg2 cam_cc_csi1phytimer_clk_src = { |
| 403 | .cmd_rcgr = 0x5028, |
| 404 | .mnd_width = 0, |
| 405 | .hid_width = 5, |
| 406 | .parent_map = cam_cc_parent_map_0, |
| 407 | .freq_tbl = ftbl_cam_cc_csi0phytimer_clk_src, |
| 408 | .clkr.hw.init = &(struct clk_init_data){ |
| 409 | .name = "cam_cc_csi1phytimer_clk_src", |
| 410 | .parent_names = cam_cc_parent_names_0, |
| 411 | .num_parents = 6, |
| 412 | .flags = CLK_SET_RATE_PARENT, |
| 413 | .ops = &clk_rcg2_ops, |
| 414 | VDD_CX_FMAX_MAP3( |
| 415 | MIN, 19200000, |
| 416 | LOWER, 240000000, |
| 417 | LOW, 269333333), |
| 418 | }, |
| 419 | }; |
| 420 | |
| 421 | static struct clk_rcg2 cam_cc_csi2phytimer_clk_src = { |
| 422 | .cmd_rcgr = 0x504c, |
| 423 | .mnd_width = 0, |
| 424 | .hid_width = 5, |
| 425 | .parent_map = cam_cc_parent_map_0, |
| 426 | .freq_tbl = ftbl_cam_cc_csi0phytimer_clk_src, |
| 427 | .clkr.hw.init = &(struct clk_init_data){ |
| 428 | .name = "cam_cc_csi2phytimer_clk_src", |
| 429 | .parent_names = cam_cc_parent_names_0, |
| 430 | .num_parents = 6, |
| 431 | .flags = CLK_SET_RATE_PARENT, |
| 432 | .ops = &clk_rcg2_ops, |
| 433 | VDD_CX_FMAX_MAP3( |
| 434 | MIN, 19200000, |
| 435 | LOWER, 240000000, |
| 436 | LOW, 269333333), |
| 437 | }, |
| 438 | }; |
| 439 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 440 | static struct clk_rcg2 cam_cc_csi3phytimer_clk_src = { |
| 441 | .cmd_rcgr = 0x5070, |
| 442 | .mnd_width = 0, |
| 443 | .hid_width = 5, |
| 444 | .parent_map = cam_cc_parent_map_0, |
| 445 | .freq_tbl = NULL, |
| 446 | .clkr.hw.init = &(struct clk_init_data){ |
| 447 | .name = "cam_cc_csi3phytimer_clk_src", |
| 448 | .parent_names = cam_cc_parent_names_0, |
| 449 | .num_parents = 6, |
| 450 | .flags = CLK_SET_RATE_PARENT, |
| 451 | .ops = &clk_rcg2_ops, |
| 452 | VDD_CX_FMAX_MAP3( |
| 453 | MIN, 19200000, |
| 454 | LOWER, 240000000, |
| 455 | LOW, 269333333), |
| 456 | }, |
| 457 | }; |
| 458 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 459 | static const struct freq_tbl ftbl_cam_cc_fast_ahb_clk_src[] = { |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 460 | F(19200000, P_BI_TCXO, 1, 0, 0), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 461 | F(50000000, P_CAM_CC_PLL0_OUT_EVEN, 12, 0, 0), |
| 462 | F(100000000, P_CAM_CC_PLL0_OUT_EVEN, 6, 0, 0), |
| 463 | F(200000000, P_CAM_CC_PLL0_OUT_EVEN, 3, 0, 0), |
| 464 | F(300000000, P_CAM_CC_PLL0_OUT_EVEN, 2, 0, 0), |
| 465 | F(400000000, P_CAM_CC_PLL0_OUT_EVEN, 1.5, 0, 0), |
| 466 | { } |
| 467 | }; |
| 468 | |
| 469 | static struct clk_rcg2 cam_cc_fast_ahb_clk_src = { |
| 470 | .cmd_rcgr = 0x6038, |
| 471 | .mnd_width = 0, |
| 472 | .hid_width = 5, |
| 473 | .parent_map = cam_cc_parent_map_0, |
| 474 | .freq_tbl = ftbl_cam_cc_fast_ahb_clk_src, |
| 475 | .clkr.hw.init = &(struct clk_init_data){ |
| 476 | .name = "cam_cc_fast_ahb_clk_src", |
| 477 | .parent_names = cam_cc_parent_names_0, |
| 478 | .num_parents = 6, |
| 479 | .flags = CLK_SET_RATE_PARENT, |
| 480 | .ops = &clk_rcg2_ops, |
| 481 | VDD_CX_FMAX_MAP5( |
| 482 | MIN, 19200000, |
| 483 | LOWER, 100000000, |
| 484 | LOW, 200000000, |
| 485 | LOW_L1, 300000000, |
| 486 | NOMINAL, 400000000), |
| 487 | }, |
| 488 | }; |
| 489 | |
| 490 | static const struct freq_tbl ftbl_cam_cc_fd_core_clk_src[] = { |
| 491 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 492 | F(320000000, P_CAM_CC_PLL2_OUT_EVEN, 1.5, 0, 0), |
| 493 | F(400000000, P_CAM_CC_PLL0_OUT_EVEN, 1.5, 0, 0), |
| 494 | F(538666667, P_CAM_CC_PLL1_OUT_EVEN, 1.5, 0, 0), |
| 495 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 496 | { } |
| 497 | }; |
| 498 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 499 | static const struct freq_tbl ftbl_cam_cc_fd_core_clk_src_sdm845_v2[] = { |
| 500 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 501 | F(384000000, P_CAM_CC_PLL3_OUT_EVEN, 1, 0, 0), |
| 502 | F(400000000, P_CAM_CC_PLL0_OUT_EVEN, 1.5, 0, 0), |
| 503 | F(538666667, P_CAM_CC_PLL1_OUT_EVEN, 1.5, 0, 0), |
| 504 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 505 | { } |
| 506 | }; |
| 507 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 508 | static struct clk_rcg2 cam_cc_fd_core_clk_src = { |
| 509 | .cmd_rcgr = 0xb0b0, |
| 510 | .mnd_width = 0, |
| 511 | .hid_width = 5, |
| 512 | .enable_safe_config = true, |
| 513 | .parent_map = cam_cc_parent_map_0, |
| 514 | .freq_tbl = ftbl_cam_cc_fd_core_clk_src, |
| 515 | .clkr.hw.init = &(struct clk_init_data){ |
| 516 | .name = "cam_cc_fd_core_clk_src", |
| 517 | .parent_names = cam_cc_parent_names_0, |
| 518 | .num_parents = 6, |
| 519 | .flags = CLK_SET_RATE_PARENT, |
| 520 | .ops = &clk_rcg2_ops, |
| 521 | VDD_CX_FMAX_MAP5( |
| 522 | MIN, 19200000, |
| 523 | LOWER, 320000000, |
| 524 | LOW, 400000000, |
| 525 | LOW_L1, 538666667, |
| 526 | NOMINAL, 600000000), |
| 527 | }, |
| 528 | }; |
| 529 | |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 530 | static const struct freq_tbl ftbl_cam_cc_icp_clk_src[] = { |
| 531 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 532 | F(320000000, P_CAM_CC_PLL2_OUT_EVEN, 1.5, 0, 0), |
| 533 | F(400000000, P_CAM_CC_PLL0_OUT_EVEN, 1.5, 0, 0), |
| 534 | F(538666667, P_CAM_CC_PLL1_OUT_EVEN, 1.5, 0, 0), |
| 535 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 536 | { } |
| 537 | }; |
| 538 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 539 | static const struct freq_tbl ftbl_cam_cc_icp_clk_src_sdm845_v2[] = { |
| 540 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 541 | F(384000000, P_CAM_CC_PLL3_OUT_EVEN, 1, 0, 0), |
| 542 | F(400000000, P_CAM_CC_PLL0_OUT_EVEN, 1.5, 0, 0), |
| 543 | F(538666667, P_CAM_CC_PLL1_OUT_EVEN, 1.5, 0, 0), |
| 544 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 545 | { } |
| 546 | }; |
| 547 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 548 | static struct clk_rcg2 cam_cc_icp_clk_src = { |
| 549 | .cmd_rcgr = 0xb088, |
| 550 | .mnd_width = 0, |
| 551 | .hid_width = 5, |
| 552 | .enable_safe_config = true, |
| 553 | .parent_map = cam_cc_parent_map_0, |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 554 | .freq_tbl = ftbl_cam_cc_icp_clk_src, |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 555 | .clkr.hw.init = &(struct clk_init_data){ |
| 556 | .name = "cam_cc_icp_clk_src", |
| 557 | .parent_names = cam_cc_parent_names_0, |
| 558 | .num_parents = 6, |
| 559 | .flags = CLK_SET_RATE_PARENT, |
| 560 | .ops = &clk_rcg2_ops, |
| 561 | VDD_CX_FMAX_MAP5( |
| 562 | MIN, 19200000, |
| 563 | LOWER, 320000000, |
| 564 | LOW, 400000000, |
| 565 | LOW_L1, 538666667, |
| 566 | NOMINAL, 600000000), |
| 567 | }, |
| 568 | }; |
| 569 | |
| 570 | static const struct freq_tbl ftbl_cam_cc_ife_0_clk_src[] = { |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 571 | F(19200000, P_BI_TCXO, 1, 0, 0), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 572 | F(100000000, P_CAM_CC_PLL0_OUT_EVEN, 6, 0, 0), |
| 573 | F(320000000, P_CAM_CC_PLL2_OUT_EVEN, 1.5, 0, 0), |
| 574 | F(404000000, P_CAM_CC_PLL1_OUT_EVEN, 2, 0, 0), |
| 575 | F(480000000, P_CAM_CC_PLL2_OUT_EVEN, 1, 0, 0), |
| 576 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 577 | { } |
| 578 | }; |
| 579 | |
| 580 | static struct clk_rcg2 cam_cc_ife_0_clk_src = { |
| 581 | .cmd_rcgr = 0x900c, |
| 582 | .mnd_width = 0, |
| 583 | .hid_width = 5, |
| 584 | .enable_safe_config = true, |
| 585 | .parent_map = cam_cc_parent_map_0, |
| 586 | .freq_tbl = ftbl_cam_cc_ife_0_clk_src, |
| 587 | .clkr.hw.init = &(struct clk_init_data){ |
| 588 | .name = "cam_cc_ife_0_clk_src", |
| 589 | .parent_names = cam_cc_parent_names_0, |
| 590 | .num_parents = 6, |
| 591 | .flags = CLK_SET_RATE_PARENT, |
| 592 | .ops = &clk_rcg2_ops, |
| 593 | VDD_CX_FMAX_MAP5( |
| 594 | MIN, 19200000, |
| 595 | LOWER, 320000000, |
| 596 | LOW, 404000000, |
| 597 | LOW_L1, 480000000, |
| 598 | NOMINAL, 600000000), |
| 599 | }, |
| 600 | }; |
| 601 | |
| 602 | static const struct freq_tbl ftbl_cam_cc_ife_0_csid_clk_src[] = { |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 603 | F(19200000, P_BI_TCXO, 1, 0, 0), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 604 | F(75000000, P_CAM_CC_PLL0_OUT_EVEN, 8, 0, 0), |
| 605 | F(384000000, P_CAM_CC_PLL3_OUT_EVEN, 1, 0, 0), |
| 606 | F(538666667, P_CAM_CC_PLL1_OUT_EVEN, 1.5, 0, 0), |
| 607 | { } |
| 608 | }; |
| 609 | |
| 610 | static struct clk_rcg2 cam_cc_ife_0_csid_clk_src = { |
| 611 | .cmd_rcgr = 0x9038, |
| 612 | .mnd_width = 0, |
| 613 | .hid_width = 5, |
| 614 | .enable_safe_config = true, |
| 615 | .parent_map = cam_cc_parent_map_1, |
| 616 | .freq_tbl = ftbl_cam_cc_ife_0_csid_clk_src, |
| 617 | .clkr.hw.init = &(struct clk_init_data){ |
| 618 | .name = "cam_cc_ife_0_csid_clk_src", |
| 619 | .parent_names = cam_cc_parent_names_1, |
| 620 | .num_parents = 7, |
| 621 | .flags = CLK_SET_RATE_PARENT, |
| 622 | .ops = &clk_rcg2_ops, |
| 623 | VDD_CX_FMAX_MAP3( |
| 624 | MIN, 19200000, |
| 625 | LOWER, 384000000, |
| 626 | NOMINAL, 538666667), |
| 627 | }, |
| 628 | }; |
| 629 | |
| 630 | static struct clk_rcg2 cam_cc_ife_1_clk_src = { |
| 631 | .cmd_rcgr = 0xa00c, |
| 632 | .mnd_width = 0, |
| 633 | .hid_width = 5, |
| 634 | .enable_safe_config = true, |
| 635 | .parent_map = cam_cc_parent_map_0, |
| 636 | .freq_tbl = ftbl_cam_cc_ife_0_clk_src, |
| 637 | .clkr.hw.init = &(struct clk_init_data){ |
| 638 | .name = "cam_cc_ife_1_clk_src", |
| 639 | .parent_names = cam_cc_parent_names_0, |
| 640 | .num_parents = 6, |
| 641 | .flags = CLK_SET_RATE_PARENT, |
| 642 | .ops = &clk_rcg2_ops, |
| 643 | VDD_CX_FMAX_MAP5( |
| 644 | MIN, 19200000, |
| 645 | LOWER, 320000000, |
| 646 | LOW, 404000000, |
| 647 | LOW_L1, 480000000, |
| 648 | NOMINAL, 600000000), |
| 649 | }, |
| 650 | }; |
| 651 | |
| 652 | static struct clk_rcg2 cam_cc_ife_1_csid_clk_src = { |
| 653 | .cmd_rcgr = 0xa030, |
| 654 | .mnd_width = 0, |
| 655 | .hid_width = 5, |
| 656 | .enable_safe_config = true, |
| 657 | .parent_map = cam_cc_parent_map_1, |
| 658 | .freq_tbl = ftbl_cam_cc_ife_0_csid_clk_src, |
| 659 | .clkr.hw.init = &(struct clk_init_data){ |
| 660 | .name = "cam_cc_ife_1_csid_clk_src", |
| 661 | .parent_names = cam_cc_parent_names_1, |
| 662 | .num_parents = 7, |
| 663 | .flags = CLK_SET_RATE_PARENT, |
| 664 | .ops = &clk_rcg2_ops, |
| 665 | VDD_CX_FMAX_MAP3( |
| 666 | MIN, 19200000, |
| 667 | LOWER, 384000000, |
| 668 | NOMINAL, 538666667), |
| 669 | }, |
| 670 | }; |
| 671 | |
| 672 | static struct clk_rcg2 cam_cc_ife_lite_clk_src = { |
| 673 | .cmd_rcgr = 0xb004, |
| 674 | .mnd_width = 0, |
| 675 | .hid_width = 5, |
| 676 | .enable_safe_config = true, |
| 677 | .parent_map = cam_cc_parent_map_0, |
| 678 | .freq_tbl = ftbl_cam_cc_ife_0_clk_src, |
| 679 | .clkr.hw.init = &(struct clk_init_data){ |
| 680 | .name = "cam_cc_ife_lite_clk_src", |
| 681 | .parent_names = cam_cc_parent_names_0, |
| 682 | .num_parents = 6, |
| 683 | .flags = CLK_SET_RATE_PARENT, |
| 684 | .ops = &clk_rcg2_ops, |
| 685 | VDD_CX_FMAX_MAP5( |
| 686 | MIN, 19200000, |
| 687 | LOWER, 320000000, |
| 688 | LOW, 404000000, |
| 689 | LOW_L1, 480000000, |
| 690 | NOMINAL, 600000000), |
| 691 | }, |
| 692 | }; |
| 693 | |
| 694 | static struct clk_rcg2 cam_cc_ife_lite_csid_clk_src = { |
| 695 | .cmd_rcgr = 0xb024, |
| 696 | .mnd_width = 0, |
| 697 | .hid_width = 5, |
| 698 | .enable_safe_config = true, |
| 699 | .parent_map = cam_cc_parent_map_1, |
| 700 | .freq_tbl = ftbl_cam_cc_ife_0_csid_clk_src, |
| 701 | .clkr.hw.init = &(struct clk_init_data){ |
| 702 | .name = "cam_cc_ife_lite_csid_clk_src", |
| 703 | .parent_names = cam_cc_parent_names_1, |
| 704 | .num_parents = 7, |
| 705 | .flags = CLK_SET_RATE_PARENT, |
| 706 | .ops = &clk_rcg2_ops, |
| 707 | VDD_CX_FMAX_MAP3( |
| 708 | MIN, 19200000, |
| 709 | LOWER, 384000000, |
| 710 | NOMINAL, 538666667), |
| 711 | }, |
| 712 | }; |
| 713 | |
| 714 | static const struct freq_tbl ftbl_cam_cc_ipe_0_clk_src[] = { |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 715 | F(19200000, P_BI_TCXO, 1, 0, 0), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 716 | F(100000000, P_CAM_CC_PLL0_OUT_EVEN, 6, 0, 0), |
| 717 | F(240000000, P_CAM_CC_PLL0_OUT_EVEN, 2.5, 0, 0), |
| 718 | F(404000000, P_CAM_CC_PLL1_OUT_EVEN, 2, 0, 0), |
| 719 | F(480000000, P_CAM_CC_PLL2_OUT_EVEN, 1, 0, 0), |
| 720 | F(538666667, P_CAM_CC_PLL1_OUT_EVEN, 1.5, 0, 0), |
| 721 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 722 | { } |
| 723 | }; |
| 724 | |
| 725 | static struct clk_rcg2 cam_cc_ipe_0_clk_src = { |
| 726 | .cmd_rcgr = 0x700c, |
| 727 | .mnd_width = 0, |
| 728 | .hid_width = 5, |
| 729 | .enable_safe_config = true, |
| 730 | .parent_map = cam_cc_parent_map_0, |
| 731 | .freq_tbl = ftbl_cam_cc_ipe_0_clk_src, |
| 732 | .clkr.hw.init = &(struct clk_init_data){ |
| 733 | .name = "cam_cc_ipe_0_clk_src", |
| 734 | .parent_names = cam_cc_parent_names_0, |
| 735 | .num_parents = 6, |
| 736 | .flags = CLK_SET_RATE_PARENT, |
| 737 | .ops = &clk_rcg2_ops, |
| 738 | VDD_CX_FMAX_MAP6( |
| 739 | MIN, 19200000, |
| 740 | LOWER, 240000000, |
| 741 | LOW, 404000000, |
| 742 | LOW_L1, 480000000, |
| 743 | NOMINAL, 538666667, |
| 744 | HIGH, 600000000), |
| 745 | }, |
| 746 | }; |
| 747 | |
| 748 | static struct clk_rcg2 cam_cc_ipe_1_clk_src = { |
| 749 | .cmd_rcgr = 0x800c, |
| 750 | .mnd_width = 0, |
| 751 | .hid_width = 5, |
| 752 | .enable_safe_config = true, |
| 753 | .parent_map = cam_cc_parent_map_0, |
| 754 | .freq_tbl = ftbl_cam_cc_ipe_0_clk_src, |
| 755 | .clkr.hw.init = &(struct clk_init_data){ |
| 756 | .name = "cam_cc_ipe_1_clk_src", |
| 757 | .parent_names = cam_cc_parent_names_0, |
| 758 | .num_parents = 6, |
| 759 | .flags = CLK_SET_RATE_PARENT, |
| 760 | .ops = &clk_rcg2_ops, |
| 761 | VDD_CX_FMAX_MAP6( |
| 762 | MIN, 19200000, |
| 763 | LOWER, 240000000, |
| 764 | LOW, 404000000, |
| 765 | LOW_L1, 480000000, |
| 766 | NOMINAL, 538666667, |
| 767 | HIGH, 600000000), |
| 768 | }, |
| 769 | }; |
| 770 | |
| 771 | static struct clk_rcg2 cam_cc_jpeg_clk_src = { |
| 772 | .cmd_rcgr = 0xb04c, |
| 773 | .mnd_width = 0, |
| 774 | .hid_width = 5, |
| 775 | .enable_safe_config = true, |
| 776 | .parent_map = cam_cc_parent_map_0, |
| 777 | .freq_tbl = ftbl_cam_cc_bps_clk_src, |
| 778 | .clkr.hw.init = &(struct clk_init_data){ |
| 779 | .name = "cam_cc_jpeg_clk_src", |
| 780 | .parent_names = cam_cc_parent_names_0, |
| 781 | .num_parents = 6, |
| 782 | .flags = CLK_SET_RATE_PARENT, |
| 783 | .ops = &clk_rcg2_ops, |
| 784 | VDD_CX_FMAX_MAP5( |
| 785 | MIN, 19200000, |
| 786 | LOWER, 200000000, |
| 787 | LOW, 404000000, |
| 788 | LOW_L1, 480000000, |
| 789 | NOMINAL, 600000000), |
| 790 | }, |
| 791 | }; |
| 792 | |
| 793 | static const struct freq_tbl ftbl_cam_cc_lrme_clk_src[] = { |
Deepak Katragadda | 47e084f | 2017-06-06 15:08:26 -0700 | [diff] [blame] | 794 | F(19200000, P_BI_TCXO, 1, 0, 0), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 795 | F(100000000, P_CAM_CC_PLL0_OUT_EVEN, 6, 0, 0), |
| 796 | F(200000000, P_CAM_CC_PLL0_OUT_EVEN, 3, 0, 0), |
| 797 | F(384000000, P_CAM_CC_PLL2_OUT_ODD, 2.5, 0, 0), |
| 798 | F(480000000, P_CAM_CC_PLL2_OUT_EVEN, 1, 0, 0), |
| 799 | F(600000000, P_CAM_CC_PLL0_OUT_EVEN, 1, 0, 0), |
| 800 | { } |
| 801 | }; |
| 802 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 803 | static const struct freq_tbl ftbl_cam_cc_lrme_clk_src_sdm845_v2[] = { |
| 804 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 805 | F(100000000, P_CAM_CC_PLL0_OUT_EVEN, 6, 0, 0), |
| 806 | F(200000000, P_CAM_CC_PLL0_OUT_EVEN, 3, 0, 0), |
| 807 | F(269333333, P_CAM_CC_PLL1_OUT_EVEN, 3, 0, 0), |
| 808 | F(320000000, P_CAM_CC_PLL2_OUT_EVEN, 1.5, 0, 0), |
| 809 | F(400000000, P_CAM_CC_PLL0_OUT_EVEN, 1.5, 0, 0), |
| 810 | { } |
| 811 | }; |
| 812 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 813 | static struct clk_rcg2 cam_cc_lrme_clk_src = { |
| 814 | .cmd_rcgr = 0xb0f8, |
| 815 | .mnd_width = 0, |
| 816 | .hid_width = 5, |
| 817 | .parent_map = cam_cc_parent_map_1, |
| 818 | .enable_safe_config = true, |
| 819 | .freq_tbl = ftbl_cam_cc_lrme_clk_src, |
| 820 | .clkr.hw.init = &(struct clk_init_data){ |
| 821 | .name = "cam_cc_lrme_clk_src", |
| 822 | .parent_names = cam_cc_parent_names_1, |
| 823 | .num_parents = 7, |
| 824 | .flags = CLK_SET_RATE_PARENT, |
| 825 | .ops = &clk_rcg2_ops, |
| 826 | VDD_CX_FMAX_MAP5( |
| 827 | MIN, 19200000, |
| 828 | LOWER, 200000000, |
| 829 | LOW, 384000000, |
| 830 | LOW_L1, 480000000, |
| 831 | NOMINAL, 600000000), |
| 832 | }, |
| 833 | }; |
| 834 | |
| 835 | static const struct freq_tbl ftbl_cam_cc_mclk0_clk_src[] = { |
Deepak Katragadda | b2db18f | 2017-05-10 14:57:23 -0700 | [diff] [blame] | 836 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 837 | F(24000000, P_CAM_CC_PLL2_OUT_EVEN, 10, 1, 2), |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 838 | F(33333333, P_CAM_CC_PLL0_OUT_EVEN, 2, 1, 9), |
| 839 | F(34285714, P_CAM_CC_PLL2_OUT_EVEN, 14, 0, 0), |
| 840 | { } |
| 841 | }; |
| 842 | |
| 843 | static struct clk_rcg2 cam_cc_mclk0_clk_src = { |
| 844 | .cmd_rcgr = 0x4004, |
| 845 | .mnd_width = 8, |
| 846 | .hid_width = 5, |
| 847 | .parent_map = cam_cc_parent_map_0, |
| 848 | .freq_tbl = ftbl_cam_cc_mclk0_clk_src, |
| 849 | .clkr.hw.init = &(struct clk_init_data){ |
| 850 | .name = "cam_cc_mclk0_clk_src", |
| 851 | .parent_names = cam_cc_parent_names_0, |
| 852 | .num_parents = 6, |
| 853 | .flags = CLK_SET_RATE_PARENT, |
| 854 | .ops = &clk_rcg2_ops, |
| 855 | VDD_CX_FMAX_MAP2( |
| 856 | MIN, 19200000, |
| 857 | LOWER, 34285714), |
| 858 | }, |
| 859 | }; |
| 860 | |
| 861 | static struct clk_rcg2 cam_cc_mclk1_clk_src = { |
| 862 | .cmd_rcgr = 0x4024, |
| 863 | .mnd_width = 8, |
| 864 | .hid_width = 5, |
| 865 | .parent_map = cam_cc_parent_map_0, |
| 866 | .freq_tbl = ftbl_cam_cc_mclk0_clk_src, |
| 867 | .clkr.hw.init = &(struct clk_init_data){ |
| 868 | .name = "cam_cc_mclk1_clk_src", |
| 869 | .parent_names = cam_cc_parent_names_0, |
| 870 | .num_parents = 6, |
| 871 | .flags = CLK_SET_RATE_PARENT, |
| 872 | .ops = &clk_rcg2_ops, |
| 873 | VDD_CX_FMAX_MAP2( |
| 874 | MIN, 19200000, |
| 875 | LOWER, 34285714), |
| 876 | }, |
| 877 | }; |
| 878 | |
| 879 | static struct clk_rcg2 cam_cc_mclk2_clk_src = { |
| 880 | .cmd_rcgr = 0x4044, |
| 881 | .mnd_width = 8, |
| 882 | .hid_width = 5, |
| 883 | .parent_map = cam_cc_parent_map_0, |
| 884 | .freq_tbl = ftbl_cam_cc_mclk0_clk_src, |
| 885 | .clkr.hw.init = &(struct clk_init_data){ |
| 886 | .name = "cam_cc_mclk2_clk_src", |
| 887 | .parent_names = cam_cc_parent_names_0, |
| 888 | .num_parents = 6, |
| 889 | .flags = CLK_SET_RATE_PARENT, |
| 890 | .ops = &clk_rcg2_ops, |
| 891 | VDD_CX_FMAX_MAP2( |
| 892 | MIN, 19200000, |
| 893 | LOWER, 34285714), |
| 894 | }, |
| 895 | }; |
| 896 | |
| 897 | static struct clk_rcg2 cam_cc_mclk3_clk_src = { |
| 898 | .cmd_rcgr = 0x4064, |
| 899 | .mnd_width = 8, |
| 900 | .hid_width = 5, |
| 901 | .parent_map = cam_cc_parent_map_0, |
| 902 | .freq_tbl = ftbl_cam_cc_mclk0_clk_src, |
| 903 | .clkr.hw.init = &(struct clk_init_data){ |
| 904 | .name = "cam_cc_mclk3_clk_src", |
| 905 | .parent_names = cam_cc_parent_names_0, |
| 906 | .num_parents = 6, |
| 907 | .flags = CLK_SET_RATE_PARENT, |
| 908 | .ops = &clk_rcg2_ops, |
| 909 | VDD_CX_FMAX_MAP2( |
| 910 | MIN, 19200000, |
| 911 | LOWER, 34285714), |
| 912 | }, |
| 913 | }; |
| 914 | |
| 915 | static const struct freq_tbl ftbl_cam_cc_slow_ahb_clk_src[] = { |
| 916 | F(19200000, P_BI_TCXO, 1, 0, 0), |
| 917 | F(60000000, P_CAM_CC_PLL0_OUT_EVEN, 10, 0, 0), |
| 918 | F(66666667, P_CAM_CC_PLL0_OUT_EVEN, 9, 0, 0), |
| 919 | F(73846154, P_CAM_CC_PLL2_OUT_EVEN, 6.5, 0, 0), |
| 920 | F(80000000, P_CAM_CC_PLL2_OUT_EVEN, 6, 0, 0), |
| 921 | { } |
| 922 | }; |
| 923 | |
| 924 | static struct clk_rcg2 cam_cc_slow_ahb_clk_src = { |
| 925 | .cmd_rcgr = 0x6054, |
| 926 | .mnd_width = 0, |
| 927 | .hid_width = 5, |
| 928 | .parent_map = cam_cc_parent_map_0, |
| 929 | .freq_tbl = ftbl_cam_cc_slow_ahb_clk_src, |
| 930 | .clkr.hw.init = &(struct clk_init_data){ |
| 931 | .name = "cam_cc_slow_ahb_clk_src", |
| 932 | .parent_names = cam_cc_parent_names_0, |
| 933 | .num_parents = 6, |
| 934 | .flags = CLK_SET_RATE_PARENT, |
| 935 | .ops = &clk_rcg2_ops, |
| 936 | VDD_CX_FMAX_MAP5( |
| 937 | MIN, 19200000, |
| 938 | LOWER, 60000000, |
| 939 | LOW, 66666667, |
| 940 | LOW_L1, 73846154, |
| 941 | NOMINAL, 80000000), |
| 942 | }, |
| 943 | }; |
| 944 | |
| 945 | static struct clk_branch cam_cc_bps_ahb_clk = { |
| 946 | .halt_reg = 0x606c, |
| 947 | .halt_check = BRANCH_HALT, |
| 948 | .aggr_sibling_rates = true, |
| 949 | .clkr = { |
| 950 | .enable_reg = 0x606c, |
| 951 | .enable_mask = BIT(0), |
| 952 | .hw.init = &(struct clk_init_data){ |
| 953 | .name = "cam_cc_bps_ahb_clk", |
| 954 | .parent_names = (const char *[]){ |
| 955 | "cam_cc_slow_ahb_clk_src", |
| 956 | }, |
| 957 | .num_parents = 1, |
| 958 | .flags = CLK_SET_RATE_PARENT, |
| 959 | .ops = &clk_branch2_ops, |
| 960 | }, |
| 961 | }, |
| 962 | }; |
| 963 | |
| 964 | static struct clk_branch cam_cc_bps_areg_clk = { |
| 965 | .halt_reg = 0x6050, |
| 966 | .halt_check = BRANCH_HALT, |
| 967 | .aggr_sibling_rates = true, |
| 968 | .clkr = { |
| 969 | .enable_reg = 0x6050, |
| 970 | .enable_mask = BIT(0), |
| 971 | .hw.init = &(struct clk_init_data){ |
| 972 | .name = "cam_cc_bps_areg_clk", |
| 973 | .parent_names = (const char *[]){ |
| 974 | "cam_cc_fast_ahb_clk_src", |
| 975 | }, |
| 976 | .num_parents = 1, |
| 977 | .flags = CLK_SET_RATE_PARENT, |
| 978 | .ops = &clk_branch2_ops, |
| 979 | }, |
| 980 | }, |
| 981 | }; |
| 982 | |
| 983 | static struct clk_branch cam_cc_bps_axi_clk = { |
| 984 | .halt_reg = 0x6034, |
| 985 | .halt_check = BRANCH_HALT, |
| 986 | .clkr = { |
| 987 | .enable_reg = 0x6034, |
| 988 | .enable_mask = BIT(0), |
| 989 | .hw.init = &(struct clk_init_data){ |
| 990 | .name = "cam_cc_bps_axi_clk", |
| 991 | .ops = &clk_branch2_ops, |
| 992 | }, |
| 993 | }, |
| 994 | }; |
| 995 | |
| 996 | static struct clk_branch cam_cc_bps_clk = { |
| 997 | .halt_reg = 0x6024, |
| 998 | .halt_check = BRANCH_HALT, |
| 999 | .clkr = { |
| 1000 | .enable_reg = 0x6024, |
| 1001 | .enable_mask = BIT(0), |
| 1002 | .hw.init = &(struct clk_init_data){ |
| 1003 | .name = "cam_cc_bps_clk", |
| 1004 | .parent_names = (const char *[]){ |
| 1005 | "cam_cc_bps_clk_src", |
| 1006 | }, |
| 1007 | .num_parents = 1, |
| 1008 | .flags = CLK_SET_RATE_PARENT, |
| 1009 | .ops = &clk_branch2_ops, |
| 1010 | }, |
| 1011 | }, |
| 1012 | }; |
| 1013 | |
| 1014 | static struct clk_branch cam_cc_camnoc_atb_clk = { |
| 1015 | .halt_reg = 0xb12c, |
| 1016 | .halt_check = BRANCH_HALT, |
| 1017 | .clkr = { |
| 1018 | .enable_reg = 0xb12c, |
| 1019 | .enable_mask = BIT(0), |
| 1020 | .hw.init = &(struct clk_init_data){ |
| 1021 | .name = "cam_cc_camnoc_atb_clk", |
| 1022 | .ops = &clk_branch2_ops, |
| 1023 | }, |
| 1024 | }, |
| 1025 | }; |
| 1026 | |
| 1027 | static struct clk_branch cam_cc_camnoc_axi_clk = { |
| 1028 | .halt_reg = 0xb124, |
| 1029 | .halt_check = BRANCH_HALT, |
| 1030 | .clkr = { |
| 1031 | .enable_reg = 0xb124, |
| 1032 | .enable_mask = BIT(0), |
| 1033 | .hw.init = &(struct clk_init_data){ |
| 1034 | .name = "cam_cc_camnoc_axi_clk", |
| 1035 | .ops = &clk_branch2_ops, |
| 1036 | }, |
| 1037 | }, |
| 1038 | }; |
| 1039 | |
| 1040 | static struct clk_branch cam_cc_cci_clk = { |
| 1041 | .halt_reg = 0xb0f0, |
| 1042 | .halt_check = BRANCH_HALT, |
| 1043 | .clkr = { |
| 1044 | .enable_reg = 0xb0f0, |
| 1045 | .enable_mask = BIT(0), |
| 1046 | .hw.init = &(struct clk_init_data){ |
| 1047 | .name = "cam_cc_cci_clk", |
| 1048 | .parent_names = (const char *[]){ |
| 1049 | "cam_cc_cci_clk_src", |
| 1050 | }, |
| 1051 | .num_parents = 1, |
| 1052 | .flags = CLK_SET_RATE_PARENT, |
| 1053 | .ops = &clk_branch2_ops, |
| 1054 | }, |
| 1055 | }, |
| 1056 | }; |
| 1057 | |
| 1058 | static struct clk_branch cam_cc_cpas_ahb_clk = { |
| 1059 | .halt_reg = 0xb11c, |
| 1060 | .halt_check = BRANCH_HALT, |
| 1061 | .aggr_sibling_rates = true, |
| 1062 | .clkr = { |
| 1063 | .enable_reg = 0xb11c, |
| 1064 | .enable_mask = BIT(0), |
| 1065 | .hw.init = &(struct clk_init_data){ |
| 1066 | .name = "cam_cc_cpas_ahb_clk", |
| 1067 | .parent_names = (const char *[]){ |
| 1068 | "cam_cc_slow_ahb_clk_src", |
| 1069 | }, |
| 1070 | .num_parents = 1, |
| 1071 | .flags = CLK_SET_RATE_PARENT, |
| 1072 | .ops = &clk_branch2_ops, |
| 1073 | }, |
| 1074 | }, |
| 1075 | }; |
| 1076 | |
| 1077 | static struct clk_branch cam_cc_csi0phytimer_clk = { |
| 1078 | .halt_reg = 0x501c, |
| 1079 | .halt_check = BRANCH_HALT, |
| 1080 | .clkr = { |
| 1081 | .enable_reg = 0x501c, |
| 1082 | .enable_mask = BIT(0), |
| 1083 | .hw.init = &(struct clk_init_data){ |
| 1084 | .name = "cam_cc_csi0phytimer_clk", |
| 1085 | .parent_names = (const char *[]){ |
| 1086 | "cam_cc_csi0phytimer_clk_src", |
| 1087 | }, |
| 1088 | .num_parents = 1, |
| 1089 | .flags = CLK_SET_RATE_PARENT, |
| 1090 | .ops = &clk_branch2_ops, |
| 1091 | }, |
| 1092 | }, |
| 1093 | }; |
| 1094 | |
| 1095 | static struct clk_branch cam_cc_csi1phytimer_clk = { |
| 1096 | .halt_reg = 0x5040, |
| 1097 | .halt_check = BRANCH_HALT, |
| 1098 | .clkr = { |
| 1099 | .enable_reg = 0x5040, |
| 1100 | .enable_mask = BIT(0), |
| 1101 | .hw.init = &(struct clk_init_data){ |
| 1102 | .name = "cam_cc_csi1phytimer_clk", |
| 1103 | .parent_names = (const char *[]){ |
| 1104 | "cam_cc_csi1phytimer_clk_src", |
| 1105 | }, |
| 1106 | .num_parents = 1, |
| 1107 | .flags = CLK_SET_RATE_PARENT, |
| 1108 | .ops = &clk_branch2_ops, |
| 1109 | }, |
| 1110 | }, |
| 1111 | }; |
| 1112 | |
| 1113 | static struct clk_branch cam_cc_csi2phytimer_clk = { |
| 1114 | .halt_reg = 0x5064, |
| 1115 | .halt_check = BRANCH_HALT, |
| 1116 | .clkr = { |
| 1117 | .enable_reg = 0x5064, |
| 1118 | .enable_mask = BIT(0), |
| 1119 | .hw.init = &(struct clk_init_data){ |
| 1120 | .name = "cam_cc_csi2phytimer_clk", |
| 1121 | .parent_names = (const char *[]){ |
| 1122 | "cam_cc_csi2phytimer_clk_src", |
| 1123 | }, |
| 1124 | .num_parents = 1, |
| 1125 | .flags = CLK_SET_RATE_PARENT, |
| 1126 | .ops = &clk_branch2_ops, |
| 1127 | }, |
| 1128 | }, |
| 1129 | }; |
| 1130 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 1131 | static struct clk_branch cam_cc_csi3phytimer_clk = { |
| 1132 | .halt_reg = 0x5088, |
| 1133 | .halt_check = BRANCH_HALT, |
| 1134 | .clkr = { |
| 1135 | .enable_reg = 0x5088, |
| 1136 | .enable_mask = BIT(0), |
| 1137 | .hw.init = &(struct clk_init_data){ |
| 1138 | .name = "cam_cc_csi3phytimer_clk", |
| 1139 | .parent_names = (const char *[]){ |
| 1140 | "cam_cc_csi3phytimer_clk_src", |
| 1141 | }, |
| 1142 | .num_parents = 1, |
| 1143 | .flags = CLK_SET_RATE_PARENT, |
| 1144 | .ops = &clk_branch2_ops, |
| 1145 | }, |
| 1146 | }, |
| 1147 | }; |
| 1148 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1149 | static struct clk_branch cam_cc_csiphy0_clk = { |
| 1150 | .halt_reg = 0x5020, |
| 1151 | .halt_check = BRANCH_HALT, |
| 1152 | .aggr_sibling_rates = true, |
| 1153 | .clkr = { |
| 1154 | .enable_reg = 0x5020, |
| 1155 | .enable_mask = BIT(0), |
| 1156 | .hw.init = &(struct clk_init_data){ |
| 1157 | .name = "cam_cc_csiphy0_clk", |
| 1158 | .parent_names = (const char *[]){ |
| 1159 | "cam_cc_cphy_rx_clk_src", |
| 1160 | }, |
| 1161 | .num_parents = 1, |
| 1162 | .flags = CLK_SET_RATE_PARENT, |
| 1163 | .ops = &clk_branch2_ops, |
| 1164 | }, |
| 1165 | }, |
| 1166 | }; |
| 1167 | |
| 1168 | static struct clk_branch cam_cc_csiphy1_clk = { |
| 1169 | .halt_reg = 0x5044, |
| 1170 | .halt_check = BRANCH_HALT, |
| 1171 | .aggr_sibling_rates = true, |
| 1172 | .clkr = { |
| 1173 | .enable_reg = 0x5044, |
| 1174 | .enable_mask = BIT(0), |
| 1175 | .hw.init = &(struct clk_init_data){ |
| 1176 | .name = "cam_cc_csiphy1_clk", |
| 1177 | .parent_names = (const char *[]){ |
| 1178 | "cam_cc_cphy_rx_clk_src", |
| 1179 | }, |
| 1180 | .num_parents = 1, |
| 1181 | .flags = CLK_SET_RATE_PARENT, |
| 1182 | .ops = &clk_branch2_ops, |
| 1183 | }, |
| 1184 | }, |
| 1185 | }; |
| 1186 | |
| 1187 | static struct clk_branch cam_cc_csiphy2_clk = { |
| 1188 | .halt_reg = 0x5068, |
| 1189 | .halt_check = BRANCH_HALT, |
| 1190 | .aggr_sibling_rates = true, |
| 1191 | .clkr = { |
| 1192 | .enable_reg = 0x5068, |
| 1193 | .enable_mask = BIT(0), |
| 1194 | .hw.init = &(struct clk_init_data){ |
| 1195 | .name = "cam_cc_csiphy2_clk", |
| 1196 | .parent_names = (const char *[]){ |
| 1197 | "cam_cc_cphy_rx_clk_src", |
| 1198 | }, |
| 1199 | .num_parents = 1, |
| 1200 | .flags = CLK_SET_RATE_PARENT, |
| 1201 | .ops = &clk_branch2_ops, |
| 1202 | }, |
| 1203 | }, |
| 1204 | }; |
| 1205 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 1206 | static struct clk_branch cam_cc_csiphy3_clk = { |
| 1207 | .halt_reg = 0x508c, |
| 1208 | .halt_check = BRANCH_HALT, |
| 1209 | .aggr_sibling_rates = true, |
| 1210 | .clkr = { |
| 1211 | .enable_reg = 0x508c, |
| 1212 | .enable_mask = BIT(0), |
| 1213 | .hw.init = &(struct clk_init_data){ |
| 1214 | .name = "cam_cc_csiphy3_clk", |
| 1215 | .parent_names = (const char *[]){ |
| 1216 | "cam_cc_cphy_rx_clk_src", |
| 1217 | }, |
| 1218 | .num_parents = 1, |
| 1219 | .flags = CLK_SET_RATE_PARENT, |
| 1220 | .ops = &clk_branch2_ops, |
| 1221 | }, |
| 1222 | }, |
| 1223 | }; |
| 1224 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1225 | static struct clk_branch cam_cc_fd_core_clk = { |
| 1226 | .halt_reg = 0xb0c8, |
| 1227 | .halt_check = BRANCH_HALT, |
| 1228 | .clkr = { |
| 1229 | .enable_reg = 0xb0c8, |
| 1230 | .enable_mask = BIT(0), |
| 1231 | .hw.init = &(struct clk_init_data){ |
| 1232 | .name = "cam_cc_fd_core_clk", |
| 1233 | .parent_names = (const char *[]){ |
| 1234 | "cam_cc_fd_core_clk_src", |
| 1235 | }, |
| 1236 | .num_parents = 1, |
| 1237 | .flags = CLK_SET_RATE_PARENT, |
| 1238 | .ops = &clk_branch2_ops, |
| 1239 | }, |
| 1240 | }, |
| 1241 | }; |
| 1242 | |
| 1243 | static struct clk_branch cam_cc_fd_core_uar_clk = { |
| 1244 | .halt_reg = 0xb0d0, |
| 1245 | .halt_check = BRANCH_HALT, |
| 1246 | .clkr = { |
| 1247 | .enable_reg = 0xb0d0, |
| 1248 | .enable_mask = BIT(0), |
| 1249 | .hw.init = &(struct clk_init_data){ |
| 1250 | .name = "cam_cc_fd_core_uar_clk", |
| 1251 | .parent_names = (const char *[]){ |
| 1252 | "cam_cc_fd_core_clk_src", |
| 1253 | }, |
| 1254 | .num_parents = 1, |
| 1255 | .ops = &clk_branch2_ops, |
| 1256 | }, |
| 1257 | }, |
| 1258 | }; |
| 1259 | |
| 1260 | static struct clk_branch cam_cc_icp_apb_clk = { |
| 1261 | .halt_reg = 0xb084, |
| 1262 | .halt_check = BRANCH_HALT, |
| 1263 | .clkr = { |
| 1264 | .enable_reg = 0xb084, |
| 1265 | .enable_mask = BIT(0), |
| 1266 | .hw.init = &(struct clk_init_data){ |
| 1267 | .name = "cam_cc_icp_apb_clk", |
| 1268 | .ops = &clk_branch2_ops, |
| 1269 | }, |
| 1270 | }, |
| 1271 | }; |
| 1272 | |
| 1273 | static struct clk_branch cam_cc_icp_atb_clk = { |
| 1274 | .halt_reg = 0xb078, |
| 1275 | .halt_check = BRANCH_HALT, |
| 1276 | .clkr = { |
| 1277 | .enable_reg = 0xb078, |
| 1278 | .enable_mask = BIT(0), |
| 1279 | .hw.init = &(struct clk_init_data){ |
| 1280 | .name = "cam_cc_icp_atb_clk", |
| 1281 | .ops = &clk_branch2_ops, |
| 1282 | }, |
| 1283 | }, |
| 1284 | }; |
| 1285 | |
| 1286 | static struct clk_branch cam_cc_icp_clk = { |
| 1287 | .halt_reg = 0xb0a0, |
| 1288 | .halt_check = BRANCH_HALT, |
| 1289 | .clkr = { |
| 1290 | .enable_reg = 0xb0a0, |
| 1291 | .enable_mask = BIT(0), |
| 1292 | .hw.init = &(struct clk_init_data){ |
| 1293 | .name = "cam_cc_icp_clk", |
| 1294 | .parent_names = (const char *[]){ |
| 1295 | "cam_cc_icp_clk_src", |
| 1296 | }, |
| 1297 | .num_parents = 1, |
| 1298 | .flags = CLK_SET_RATE_PARENT, |
| 1299 | .ops = &clk_branch2_ops, |
| 1300 | }, |
| 1301 | }, |
| 1302 | }; |
| 1303 | |
| 1304 | static struct clk_branch cam_cc_icp_cti_clk = { |
| 1305 | .halt_reg = 0xb07c, |
| 1306 | .halt_check = BRANCH_HALT, |
| 1307 | .clkr = { |
| 1308 | .enable_reg = 0xb07c, |
| 1309 | .enable_mask = BIT(0), |
| 1310 | .hw.init = &(struct clk_init_data){ |
| 1311 | .name = "cam_cc_icp_cti_clk", |
| 1312 | .ops = &clk_branch2_ops, |
| 1313 | }, |
| 1314 | }, |
| 1315 | }; |
| 1316 | |
| 1317 | static struct clk_branch cam_cc_icp_ts_clk = { |
| 1318 | .halt_reg = 0xb080, |
| 1319 | .halt_check = BRANCH_HALT, |
| 1320 | .clkr = { |
| 1321 | .enable_reg = 0xb080, |
| 1322 | .enable_mask = BIT(0), |
| 1323 | .hw.init = &(struct clk_init_data){ |
| 1324 | .name = "cam_cc_icp_ts_clk", |
| 1325 | .ops = &clk_branch2_ops, |
| 1326 | }, |
| 1327 | }, |
| 1328 | }; |
| 1329 | |
| 1330 | static struct clk_branch cam_cc_ife_0_axi_clk = { |
| 1331 | .halt_reg = 0x907c, |
| 1332 | .halt_check = BRANCH_HALT, |
| 1333 | .clkr = { |
| 1334 | .enable_reg = 0x907c, |
| 1335 | .enable_mask = BIT(0), |
| 1336 | .hw.init = &(struct clk_init_data){ |
| 1337 | .name = "cam_cc_ife_0_axi_clk", |
| 1338 | .ops = &clk_branch2_ops, |
| 1339 | }, |
| 1340 | }, |
| 1341 | }; |
| 1342 | |
| 1343 | static struct clk_branch cam_cc_ife_0_clk = { |
| 1344 | .halt_reg = 0x9024, |
| 1345 | .halt_check = BRANCH_HALT, |
| 1346 | .clkr = { |
| 1347 | .enable_reg = 0x9024, |
| 1348 | .enable_mask = BIT(0), |
| 1349 | .hw.init = &(struct clk_init_data){ |
| 1350 | .name = "cam_cc_ife_0_clk", |
| 1351 | .parent_names = (const char *[]){ |
| 1352 | "cam_cc_ife_0_clk_src", |
| 1353 | }, |
| 1354 | .num_parents = 1, |
| 1355 | .flags = CLK_SET_RATE_PARENT, |
| 1356 | .ops = &clk_branch2_ops, |
| 1357 | }, |
| 1358 | }, |
| 1359 | }; |
| 1360 | |
| 1361 | static struct clk_branch cam_cc_ife_0_cphy_rx_clk = { |
| 1362 | .halt_reg = 0x9078, |
| 1363 | .halt_check = BRANCH_HALT, |
| 1364 | .aggr_sibling_rates = true, |
| 1365 | .clkr = { |
| 1366 | .enable_reg = 0x9078, |
| 1367 | .enable_mask = BIT(0), |
| 1368 | .hw.init = &(struct clk_init_data){ |
| 1369 | .name = "cam_cc_ife_0_cphy_rx_clk", |
| 1370 | .parent_names = (const char *[]){ |
| 1371 | "cam_cc_cphy_rx_clk_src", |
| 1372 | }, |
| 1373 | .num_parents = 1, |
| 1374 | .flags = CLK_SET_RATE_PARENT, |
| 1375 | .ops = &clk_branch2_ops, |
| 1376 | }, |
| 1377 | }, |
| 1378 | }; |
| 1379 | |
| 1380 | static struct clk_branch cam_cc_ife_0_csid_clk = { |
| 1381 | .halt_reg = 0x9050, |
| 1382 | .halt_check = BRANCH_HALT, |
| 1383 | .clkr = { |
| 1384 | .enable_reg = 0x9050, |
| 1385 | .enable_mask = BIT(0), |
| 1386 | .hw.init = &(struct clk_init_data){ |
| 1387 | .name = "cam_cc_ife_0_csid_clk", |
| 1388 | .parent_names = (const char *[]){ |
| 1389 | "cam_cc_ife_0_csid_clk_src", |
| 1390 | }, |
| 1391 | .num_parents = 1, |
| 1392 | .flags = CLK_SET_RATE_PARENT, |
| 1393 | .ops = &clk_branch2_ops, |
| 1394 | }, |
| 1395 | }, |
| 1396 | }; |
| 1397 | |
| 1398 | static struct clk_branch cam_cc_ife_0_dsp_clk = { |
| 1399 | .halt_reg = 0x9034, |
| 1400 | .halt_check = BRANCH_HALT, |
| 1401 | .clkr = { |
| 1402 | .enable_reg = 0x9034, |
| 1403 | .enable_mask = BIT(0), |
| 1404 | .hw.init = &(struct clk_init_data){ |
| 1405 | .name = "cam_cc_ife_0_dsp_clk", |
| 1406 | .parent_names = (const char *[]){ |
| 1407 | "cam_cc_ife_0_clk_src", |
| 1408 | }, |
| 1409 | .num_parents = 1, |
| 1410 | .ops = &clk_branch2_ops, |
| 1411 | }, |
| 1412 | }, |
| 1413 | }; |
| 1414 | |
| 1415 | static struct clk_branch cam_cc_ife_1_axi_clk = { |
| 1416 | .halt_reg = 0xa054, |
| 1417 | .halt_check = BRANCH_HALT, |
| 1418 | .clkr = { |
| 1419 | .enable_reg = 0xa054, |
| 1420 | .enable_mask = BIT(0), |
| 1421 | .hw.init = &(struct clk_init_data){ |
| 1422 | .name = "cam_cc_ife_1_axi_clk", |
| 1423 | .ops = &clk_branch2_ops, |
| 1424 | }, |
| 1425 | }, |
| 1426 | }; |
| 1427 | |
| 1428 | static struct clk_branch cam_cc_ife_1_clk = { |
| 1429 | .halt_reg = 0xa024, |
| 1430 | .halt_check = BRANCH_HALT, |
| 1431 | .clkr = { |
| 1432 | .enable_reg = 0xa024, |
| 1433 | .enable_mask = BIT(0), |
| 1434 | .hw.init = &(struct clk_init_data){ |
| 1435 | .name = "cam_cc_ife_1_clk", |
| 1436 | .parent_names = (const char *[]){ |
| 1437 | "cam_cc_ife_1_clk_src", |
| 1438 | }, |
| 1439 | .num_parents = 1, |
| 1440 | .flags = CLK_SET_RATE_PARENT, |
| 1441 | .ops = &clk_branch2_ops, |
| 1442 | }, |
| 1443 | }, |
| 1444 | }; |
| 1445 | |
| 1446 | static struct clk_branch cam_cc_ife_1_cphy_rx_clk = { |
| 1447 | .halt_reg = 0xa050, |
| 1448 | .halt_check = BRANCH_HALT, |
| 1449 | .aggr_sibling_rates = true, |
| 1450 | .clkr = { |
| 1451 | .enable_reg = 0xa050, |
| 1452 | .enable_mask = BIT(0), |
| 1453 | .hw.init = &(struct clk_init_data){ |
| 1454 | .name = "cam_cc_ife_1_cphy_rx_clk", |
| 1455 | .parent_names = (const char *[]){ |
| 1456 | "cam_cc_cphy_rx_clk_src", |
| 1457 | }, |
| 1458 | .num_parents = 1, |
| 1459 | .flags = CLK_SET_RATE_PARENT, |
| 1460 | .ops = &clk_branch2_ops, |
| 1461 | }, |
| 1462 | }, |
| 1463 | }; |
| 1464 | |
| 1465 | static struct clk_branch cam_cc_ife_1_csid_clk = { |
| 1466 | .halt_reg = 0xa048, |
| 1467 | .halt_check = BRANCH_HALT, |
| 1468 | .clkr = { |
| 1469 | .enable_reg = 0xa048, |
| 1470 | .enable_mask = BIT(0), |
| 1471 | .hw.init = &(struct clk_init_data){ |
| 1472 | .name = "cam_cc_ife_1_csid_clk", |
| 1473 | .parent_names = (const char *[]){ |
| 1474 | "cam_cc_ife_1_csid_clk_src", |
| 1475 | }, |
| 1476 | .num_parents = 1, |
| 1477 | .flags = CLK_SET_RATE_PARENT, |
| 1478 | .ops = &clk_branch2_ops, |
| 1479 | }, |
| 1480 | }, |
| 1481 | }; |
| 1482 | |
| 1483 | static struct clk_branch cam_cc_ife_1_dsp_clk = { |
| 1484 | .halt_reg = 0xa02c, |
| 1485 | .halt_check = BRANCH_HALT, |
| 1486 | .clkr = { |
| 1487 | .enable_reg = 0xa02c, |
| 1488 | .enable_mask = BIT(0), |
| 1489 | .hw.init = &(struct clk_init_data){ |
| 1490 | .name = "cam_cc_ife_1_dsp_clk", |
| 1491 | .parent_names = (const char *[]){ |
| 1492 | "cam_cc_ife_1_clk_src", |
| 1493 | }, |
| 1494 | .num_parents = 1, |
| 1495 | .ops = &clk_branch2_ops, |
| 1496 | }, |
| 1497 | }, |
| 1498 | }; |
| 1499 | |
| 1500 | static struct clk_branch cam_cc_ife_lite_clk = { |
| 1501 | .halt_reg = 0xb01c, |
| 1502 | .halt_check = BRANCH_HALT, |
| 1503 | .clkr = { |
| 1504 | .enable_reg = 0xb01c, |
| 1505 | .enable_mask = BIT(0), |
| 1506 | .hw.init = &(struct clk_init_data){ |
| 1507 | .name = "cam_cc_ife_lite_clk", |
| 1508 | .parent_names = (const char *[]){ |
| 1509 | "cam_cc_ife_lite_clk_src", |
| 1510 | }, |
| 1511 | .num_parents = 1, |
| 1512 | .flags = CLK_SET_RATE_PARENT, |
| 1513 | .ops = &clk_branch2_ops, |
| 1514 | }, |
| 1515 | }, |
| 1516 | }; |
| 1517 | |
| 1518 | static struct clk_branch cam_cc_ife_lite_cphy_rx_clk = { |
| 1519 | .halt_reg = 0xb044, |
| 1520 | .halt_check = BRANCH_HALT, |
| 1521 | .aggr_sibling_rates = true, |
| 1522 | .clkr = { |
| 1523 | .enable_reg = 0xb044, |
| 1524 | .enable_mask = BIT(0), |
| 1525 | .hw.init = &(struct clk_init_data){ |
| 1526 | .name = "cam_cc_ife_lite_cphy_rx_clk", |
| 1527 | .parent_names = (const char *[]){ |
| 1528 | "cam_cc_cphy_rx_clk_src", |
| 1529 | }, |
| 1530 | .num_parents = 1, |
| 1531 | .flags = CLK_SET_RATE_PARENT, |
| 1532 | .ops = &clk_branch2_ops, |
| 1533 | }, |
| 1534 | }, |
| 1535 | }; |
| 1536 | |
| 1537 | static struct clk_branch cam_cc_ife_lite_csid_clk = { |
| 1538 | .halt_reg = 0xb03c, |
| 1539 | .halt_check = BRANCH_HALT, |
| 1540 | .clkr = { |
| 1541 | .enable_reg = 0xb03c, |
| 1542 | .enable_mask = BIT(0), |
| 1543 | .hw.init = &(struct clk_init_data){ |
| 1544 | .name = "cam_cc_ife_lite_csid_clk", |
| 1545 | .parent_names = (const char *[]){ |
| 1546 | "cam_cc_ife_lite_csid_clk_src", |
| 1547 | }, |
| 1548 | .num_parents = 1, |
| 1549 | .flags = CLK_SET_RATE_PARENT, |
| 1550 | .ops = &clk_branch2_ops, |
| 1551 | }, |
| 1552 | }, |
| 1553 | }; |
| 1554 | |
| 1555 | static struct clk_branch cam_cc_ipe_0_ahb_clk = { |
| 1556 | .halt_reg = 0x703c, |
| 1557 | .halt_check = BRANCH_HALT, |
| 1558 | .aggr_sibling_rates = true, |
| 1559 | .clkr = { |
| 1560 | .enable_reg = 0x703c, |
| 1561 | .enable_mask = BIT(0), |
| 1562 | .hw.init = &(struct clk_init_data){ |
| 1563 | .name = "cam_cc_ipe_0_ahb_clk", |
| 1564 | .parent_names = (const char *[]){ |
| 1565 | "cam_cc_slow_ahb_clk_src", |
| 1566 | }, |
| 1567 | .num_parents = 1, |
| 1568 | .flags = CLK_SET_RATE_PARENT, |
| 1569 | .ops = &clk_branch2_ops, |
| 1570 | }, |
| 1571 | }, |
| 1572 | }; |
| 1573 | |
| 1574 | static struct clk_branch cam_cc_ipe_0_areg_clk = { |
| 1575 | .halt_reg = 0x7038, |
| 1576 | .halt_check = BRANCH_HALT, |
| 1577 | .aggr_sibling_rates = true, |
| 1578 | .clkr = { |
| 1579 | .enable_reg = 0x7038, |
| 1580 | .enable_mask = BIT(0), |
| 1581 | .hw.init = &(struct clk_init_data){ |
| 1582 | .name = "cam_cc_ipe_0_areg_clk", |
| 1583 | .parent_names = (const char *[]){ |
| 1584 | "cam_cc_fast_ahb_clk_src", |
| 1585 | }, |
| 1586 | .num_parents = 1, |
| 1587 | .flags = CLK_SET_RATE_PARENT, |
| 1588 | .ops = &clk_branch2_ops, |
| 1589 | }, |
| 1590 | }, |
| 1591 | }; |
| 1592 | |
| 1593 | static struct clk_branch cam_cc_ipe_0_axi_clk = { |
| 1594 | .halt_reg = 0x7034, |
| 1595 | .halt_check = BRANCH_HALT, |
| 1596 | .clkr = { |
| 1597 | .enable_reg = 0x7034, |
| 1598 | .enable_mask = BIT(0), |
| 1599 | .hw.init = &(struct clk_init_data){ |
| 1600 | .name = "cam_cc_ipe_0_axi_clk", |
| 1601 | .ops = &clk_branch2_ops, |
| 1602 | }, |
| 1603 | }, |
| 1604 | }; |
| 1605 | |
| 1606 | static struct clk_branch cam_cc_ipe_0_clk = { |
| 1607 | .halt_reg = 0x7024, |
| 1608 | .halt_check = BRANCH_HALT, |
| 1609 | .clkr = { |
| 1610 | .enable_reg = 0x7024, |
| 1611 | .enable_mask = BIT(0), |
| 1612 | .hw.init = &(struct clk_init_data){ |
| 1613 | .name = "cam_cc_ipe_0_clk", |
| 1614 | .parent_names = (const char *[]){ |
| 1615 | "cam_cc_ipe_0_clk_src", |
| 1616 | }, |
| 1617 | .num_parents = 1, |
| 1618 | .flags = CLK_SET_RATE_PARENT, |
| 1619 | .ops = &clk_branch2_ops, |
| 1620 | }, |
| 1621 | }, |
| 1622 | }; |
| 1623 | |
| 1624 | static struct clk_branch cam_cc_ipe_1_ahb_clk = { |
| 1625 | .halt_reg = 0x803c, |
| 1626 | .halt_check = BRANCH_HALT, |
| 1627 | .aggr_sibling_rates = true, |
| 1628 | .clkr = { |
| 1629 | .enable_reg = 0x803c, |
| 1630 | .enable_mask = BIT(0), |
| 1631 | .hw.init = &(struct clk_init_data){ |
| 1632 | .name = "cam_cc_ipe_1_ahb_clk", |
| 1633 | .parent_names = (const char *[]){ |
| 1634 | "cam_cc_slow_ahb_clk_src", |
| 1635 | }, |
| 1636 | .num_parents = 1, |
| 1637 | .flags = CLK_SET_RATE_PARENT, |
| 1638 | .ops = &clk_branch2_ops, |
| 1639 | }, |
| 1640 | }, |
| 1641 | }; |
| 1642 | |
| 1643 | static struct clk_branch cam_cc_ipe_1_areg_clk = { |
| 1644 | .halt_reg = 0x8038, |
| 1645 | .halt_check = BRANCH_HALT, |
| 1646 | .aggr_sibling_rates = true, |
| 1647 | .clkr = { |
| 1648 | .enable_reg = 0x8038, |
| 1649 | .enable_mask = BIT(0), |
| 1650 | .hw.init = &(struct clk_init_data){ |
| 1651 | .name = "cam_cc_ipe_1_areg_clk", |
| 1652 | .parent_names = (const char *[]){ |
| 1653 | "cam_cc_fast_ahb_clk_src", |
| 1654 | }, |
| 1655 | .num_parents = 1, |
| 1656 | .flags = CLK_SET_RATE_PARENT, |
| 1657 | .ops = &clk_branch2_ops, |
| 1658 | }, |
| 1659 | }, |
| 1660 | }; |
| 1661 | |
| 1662 | static struct clk_branch cam_cc_ipe_1_axi_clk = { |
| 1663 | .halt_reg = 0x8034, |
| 1664 | .halt_check = BRANCH_HALT, |
| 1665 | .clkr = { |
| 1666 | .enable_reg = 0x8034, |
| 1667 | .enable_mask = BIT(0), |
| 1668 | .hw.init = &(struct clk_init_data){ |
| 1669 | .name = "cam_cc_ipe_1_axi_clk", |
| 1670 | .ops = &clk_branch2_ops, |
| 1671 | }, |
| 1672 | }, |
| 1673 | }; |
| 1674 | |
| 1675 | static struct clk_branch cam_cc_ipe_1_clk = { |
| 1676 | .halt_reg = 0x8024, |
| 1677 | .halt_check = BRANCH_HALT, |
| 1678 | .clkr = { |
| 1679 | .enable_reg = 0x8024, |
| 1680 | .enable_mask = BIT(0), |
| 1681 | .hw.init = &(struct clk_init_data){ |
| 1682 | .name = "cam_cc_ipe_1_clk", |
| 1683 | .parent_names = (const char *[]){ |
| 1684 | "cam_cc_ipe_1_clk_src", |
| 1685 | }, |
| 1686 | .num_parents = 1, |
| 1687 | .flags = CLK_SET_RATE_PARENT, |
| 1688 | .ops = &clk_branch2_ops, |
| 1689 | }, |
| 1690 | }, |
| 1691 | }; |
| 1692 | |
| 1693 | static struct clk_branch cam_cc_jpeg_clk = { |
| 1694 | .halt_reg = 0xb064, |
| 1695 | .halt_check = BRANCH_HALT, |
| 1696 | .clkr = { |
| 1697 | .enable_reg = 0xb064, |
| 1698 | .enable_mask = BIT(0), |
| 1699 | .hw.init = &(struct clk_init_data){ |
| 1700 | .name = "cam_cc_jpeg_clk", |
| 1701 | .parent_names = (const char *[]){ |
| 1702 | "cam_cc_jpeg_clk_src", |
| 1703 | }, |
| 1704 | .num_parents = 1, |
| 1705 | .flags = CLK_SET_RATE_PARENT, |
| 1706 | .ops = &clk_branch2_ops, |
| 1707 | }, |
| 1708 | }, |
| 1709 | }; |
| 1710 | |
| 1711 | static struct clk_branch cam_cc_lrme_clk = { |
| 1712 | .halt_reg = 0xb110, |
| 1713 | .halt_check = BRANCH_HALT, |
| 1714 | .clkr = { |
| 1715 | .enable_reg = 0xb110, |
| 1716 | .enable_mask = BIT(0), |
| 1717 | .hw.init = &(struct clk_init_data){ |
| 1718 | .name = "cam_cc_lrme_clk", |
| 1719 | .parent_names = (const char *[]){ |
| 1720 | "cam_cc_lrme_clk_src", |
| 1721 | }, |
| 1722 | .num_parents = 1, |
| 1723 | .flags = CLK_SET_RATE_PARENT, |
| 1724 | .ops = &clk_branch2_ops, |
| 1725 | }, |
| 1726 | }, |
| 1727 | }; |
| 1728 | |
| 1729 | static struct clk_branch cam_cc_mclk0_clk = { |
| 1730 | .halt_reg = 0x401c, |
| 1731 | .halt_check = BRANCH_HALT, |
| 1732 | .clkr = { |
| 1733 | .enable_reg = 0x401c, |
| 1734 | .enable_mask = BIT(0), |
| 1735 | .hw.init = &(struct clk_init_data){ |
| 1736 | .name = "cam_cc_mclk0_clk", |
| 1737 | .parent_names = (const char *[]){ |
| 1738 | "cam_cc_mclk0_clk_src", |
| 1739 | }, |
| 1740 | .num_parents = 1, |
| 1741 | .flags = CLK_SET_RATE_PARENT, |
| 1742 | .ops = &clk_branch2_ops, |
| 1743 | }, |
| 1744 | }, |
| 1745 | }; |
| 1746 | |
| 1747 | static struct clk_branch cam_cc_mclk1_clk = { |
| 1748 | .halt_reg = 0x403c, |
| 1749 | .halt_check = BRANCH_HALT, |
| 1750 | .clkr = { |
| 1751 | .enable_reg = 0x403c, |
| 1752 | .enable_mask = BIT(0), |
| 1753 | .hw.init = &(struct clk_init_data){ |
| 1754 | .name = "cam_cc_mclk1_clk", |
| 1755 | .parent_names = (const char *[]){ |
| 1756 | "cam_cc_mclk1_clk_src", |
| 1757 | }, |
| 1758 | .num_parents = 1, |
| 1759 | .flags = CLK_SET_RATE_PARENT, |
| 1760 | .ops = &clk_branch2_ops, |
| 1761 | }, |
| 1762 | }, |
| 1763 | }; |
| 1764 | |
| 1765 | static struct clk_branch cam_cc_mclk2_clk = { |
| 1766 | .halt_reg = 0x405c, |
| 1767 | .halt_check = BRANCH_HALT, |
| 1768 | .clkr = { |
| 1769 | .enable_reg = 0x405c, |
| 1770 | .enable_mask = BIT(0), |
| 1771 | .hw.init = &(struct clk_init_data){ |
| 1772 | .name = "cam_cc_mclk2_clk", |
| 1773 | .parent_names = (const char *[]){ |
| 1774 | "cam_cc_mclk2_clk_src", |
| 1775 | }, |
| 1776 | .num_parents = 1, |
| 1777 | .flags = CLK_SET_RATE_PARENT, |
| 1778 | .ops = &clk_branch2_ops, |
| 1779 | }, |
| 1780 | }, |
| 1781 | }; |
| 1782 | |
| 1783 | static struct clk_branch cam_cc_mclk3_clk = { |
| 1784 | .halt_reg = 0x407c, |
| 1785 | .halt_check = BRANCH_HALT, |
| 1786 | .clkr = { |
| 1787 | .enable_reg = 0x407c, |
| 1788 | .enable_mask = BIT(0), |
| 1789 | .hw.init = &(struct clk_init_data){ |
| 1790 | .name = "cam_cc_mclk3_clk", |
| 1791 | .parent_names = (const char *[]){ |
| 1792 | "cam_cc_mclk3_clk_src", |
| 1793 | }, |
| 1794 | .num_parents = 1, |
| 1795 | .flags = CLK_SET_RATE_PARENT, |
| 1796 | .ops = &clk_branch2_ops, |
| 1797 | }, |
| 1798 | }, |
| 1799 | }; |
| 1800 | |
| 1801 | static struct clk_branch cam_cc_pll_test_clk = { |
| 1802 | .halt_reg = 0xc014, |
| 1803 | .halt_check = BRANCH_HALT, |
| 1804 | .clkr = { |
| 1805 | .enable_reg = 0xc014, |
| 1806 | .enable_mask = BIT(0), |
| 1807 | .hw.init = &(struct clk_init_data){ |
| 1808 | .name = "cam_cc_pll_test_clk", |
| 1809 | .ops = &clk_branch2_ops, |
| 1810 | }, |
| 1811 | }, |
| 1812 | }; |
| 1813 | |
| 1814 | static struct clk_branch cam_cc_soc_ahb_clk = { |
| 1815 | .halt_reg = 0xb13c, |
| 1816 | .halt_check = BRANCH_HALT, |
| 1817 | .clkr = { |
| 1818 | .enable_reg = 0xb13c, |
| 1819 | .enable_mask = BIT(0), |
| 1820 | .hw.init = &(struct clk_init_data){ |
| 1821 | .name = "cam_cc_soc_ahb_clk", |
| 1822 | .ops = &clk_branch2_ops, |
| 1823 | }, |
| 1824 | }, |
| 1825 | }; |
| 1826 | |
| 1827 | static struct clk_branch cam_cc_sys_tmr_clk = { |
| 1828 | .halt_reg = 0xb0a8, |
| 1829 | .halt_check = BRANCH_HALT, |
| 1830 | .clkr = { |
| 1831 | .enable_reg = 0xb0a8, |
| 1832 | .enable_mask = BIT(0), |
| 1833 | .hw.init = &(struct clk_init_data){ |
| 1834 | .name = "cam_cc_sys_tmr_clk", |
| 1835 | .ops = &clk_branch2_ops, |
| 1836 | }, |
| 1837 | }, |
| 1838 | }; |
| 1839 | |
| 1840 | static struct clk_regmap *cam_cc_sdm845_clocks[] = { |
| 1841 | [CAM_CC_BPS_AHB_CLK] = &cam_cc_bps_ahb_clk.clkr, |
| 1842 | [CAM_CC_BPS_AREG_CLK] = &cam_cc_bps_areg_clk.clkr, |
| 1843 | [CAM_CC_BPS_AXI_CLK] = &cam_cc_bps_axi_clk.clkr, |
| 1844 | [CAM_CC_BPS_CLK] = &cam_cc_bps_clk.clkr, |
| 1845 | [CAM_CC_BPS_CLK_SRC] = &cam_cc_bps_clk_src.clkr, |
| 1846 | [CAM_CC_CAMNOC_ATB_CLK] = &cam_cc_camnoc_atb_clk.clkr, |
| 1847 | [CAM_CC_CAMNOC_AXI_CLK] = &cam_cc_camnoc_axi_clk.clkr, |
| 1848 | [CAM_CC_CCI_CLK] = &cam_cc_cci_clk.clkr, |
| 1849 | [CAM_CC_CCI_CLK_SRC] = &cam_cc_cci_clk_src.clkr, |
| 1850 | [CAM_CC_CPAS_AHB_CLK] = &cam_cc_cpas_ahb_clk.clkr, |
| 1851 | [CAM_CC_CPHY_RX_CLK_SRC] = &cam_cc_cphy_rx_clk_src.clkr, |
| 1852 | [CAM_CC_CSI0PHYTIMER_CLK] = &cam_cc_csi0phytimer_clk.clkr, |
| 1853 | [CAM_CC_CSI0PHYTIMER_CLK_SRC] = &cam_cc_csi0phytimer_clk_src.clkr, |
| 1854 | [CAM_CC_CSI1PHYTIMER_CLK] = &cam_cc_csi1phytimer_clk.clkr, |
| 1855 | [CAM_CC_CSI1PHYTIMER_CLK_SRC] = &cam_cc_csi1phytimer_clk_src.clkr, |
| 1856 | [CAM_CC_CSI2PHYTIMER_CLK] = &cam_cc_csi2phytimer_clk.clkr, |
| 1857 | [CAM_CC_CSI2PHYTIMER_CLK_SRC] = &cam_cc_csi2phytimer_clk_src.clkr, |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 1858 | [CAM_CC_CSI3PHYTIMER_CLK] = NULL, |
| 1859 | [CAM_CC_CSI3PHYTIMER_CLK_SRC] = NULL, |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1860 | [CAM_CC_CSIPHY0_CLK] = &cam_cc_csiphy0_clk.clkr, |
| 1861 | [CAM_CC_CSIPHY1_CLK] = &cam_cc_csiphy1_clk.clkr, |
| 1862 | [CAM_CC_CSIPHY2_CLK] = &cam_cc_csiphy2_clk.clkr, |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 1863 | [CAM_CC_CSIPHY3_CLK] = NULL, |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1864 | [CAM_CC_FAST_AHB_CLK_SRC] = &cam_cc_fast_ahb_clk_src.clkr, |
| 1865 | [CAM_CC_FD_CORE_CLK] = &cam_cc_fd_core_clk.clkr, |
| 1866 | [CAM_CC_FD_CORE_CLK_SRC] = &cam_cc_fd_core_clk_src.clkr, |
| 1867 | [CAM_CC_FD_CORE_UAR_CLK] = &cam_cc_fd_core_uar_clk.clkr, |
| 1868 | [CAM_CC_ICP_APB_CLK] = &cam_cc_icp_apb_clk.clkr, |
| 1869 | [CAM_CC_ICP_ATB_CLK] = &cam_cc_icp_atb_clk.clkr, |
| 1870 | [CAM_CC_ICP_CLK] = &cam_cc_icp_clk.clkr, |
| 1871 | [CAM_CC_ICP_CLK_SRC] = &cam_cc_icp_clk_src.clkr, |
| 1872 | [CAM_CC_ICP_CTI_CLK] = &cam_cc_icp_cti_clk.clkr, |
| 1873 | [CAM_CC_ICP_TS_CLK] = &cam_cc_icp_ts_clk.clkr, |
| 1874 | [CAM_CC_IFE_0_AXI_CLK] = &cam_cc_ife_0_axi_clk.clkr, |
| 1875 | [CAM_CC_IFE_0_CLK] = &cam_cc_ife_0_clk.clkr, |
| 1876 | [CAM_CC_IFE_0_CLK_SRC] = &cam_cc_ife_0_clk_src.clkr, |
| 1877 | [CAM_CC_IFE_0_CPHY_RX_CLK] = &cam_cc_ife_0_cphy_rx_clk.clkr, |
| 1878 | [CAM_CC_IFE_0_CSID_CLK] = &cam_cc_ife_0_csid_clk.clkr, |
| 1879 | [CAM_CC_IFE_0_CSID_CLK_SRC] = &cam_cc_ife_0_csid_clk_src.clkr, |
| 1880 | [CAM_CC_IFE_0_DSP_CLK] = &cam_cc_ife_0_dsp_clk.clkr, |
| 1881 | [CAM_CC_IFE_1_AXI_CLK] = &cam_cc_ife_1_axi_clk.clkr, |
| 1882 | [CAM_CC_IFE_1_CLK] = &cam_cc_ife_1_clk.clkr, |
| 1883 | [CAM_CC_IFE_1_CLK_SRC] = &cam_cc_ife_1_clk_src.clkr, |
| 1884 | [CAM_CC_IFE_1_CPHY_RX_CLK] = &cam_cc_ife_1_cphy_rx_clk.clkr, |
| 1885 | [CAM_CC_IFE_1_CSID_CLK] = &cam_cc_ife_1_csid_clk.clkr, |
| 1886 | [CAM_CC_IFE_1_CSID_CLK_SRC] = &cam_cc_ife_1_csid_clk_src.clkr, |
| 1887 | [CAM_CC_IFE_1_DSP_CLK] = &cam_cc_ife_1_dsp_clk.clkr, |
| 1888 | [CAM_CC_IFE_LITE_CLK] = &cam_cc_ife_lite_clk.clkr, |
| 1889 | [CAM_CC_IFE_LITE_CLK_SRC] = &cam_cc_ife_lite_clk_src.clkr, |
| 1890 | [CAM_CC_IFE_LITE_CPHY_RX_CLK] = &cam_cc_ife_lite_cphy_rx_clk.clkr, |
| 1891 | [CAM_CC_IFE_LITE_CSID_CLK] = &cam_cc_ife_lite_csid_clk.clkr, |
| 1892 | [CAM_CC_IFE_LITE_CSID_CLK_SRC] = &cam_cc_ife_lite_csid_clk_src.clkr, |
| 1893 | [CAM_CC_IPE_0_AHB_CLK] = &cam_cc_ipe_0_ahb_clk.clkr, |
| 1894 | [CAM_CC_IPE_0_AREG_CLK] = &cam_cc_ipe_0_areg_clk.clkr, |
| 1895 | [CAM_CC_IPE_0_AXI_CLK] = &cam_cc_ipe_0_axi_clk.clkr, |
| 1896 | [CAM_CC_IPE_0_CLK] = &cam_cc_ipe_0_clk.clkr, |
| 1897 | [CAM_CC_IPE_0_CLK_SRC] = &cam_cc_ipe_0_clk_src.clkr, |
| 1898 | [CAM_CC_IPE_1_AHB_CLK] = &cam_cc_ipe_1_ahb_clk.clkr, |
| 1899 | [CAM_CC_IPE_1_AREG_CLK] = &cam_cc_ipe_1_areg_clk.clkr, |
| 1900 | [CAM_CC_IPE_1_AXI_CLK] = &cam_cc_ipe_1_axi_clk.clkr, |
| 1901 | [CAM_CC_IPE_1_CLK] = &cam_cc_ipe_1_clk.clkr, |
| 1902 | [CAM_CC_IPE_1_CLK_SRC] = &cam_cc_ipe_1_clk_src.clkr, |
| 1903 | [CAM_CC_JPEG_CLK] = &cam_cc_jpeg_clk.clkr, |
| 1904 | [CAM_CC_JPEG_CLK_SRC] = &cam_cc_jpeg_clk_src.clkr, |
| 1905 | [CAM_CC_LRME_CLK] = &cam_cc_lrme_clk.clkr, |
| 1906 | [CAM_CC_LRME_CLK_SRC] = &cam_cc_lrme_clk_src.clkr, |
| 1907 | [CAM_CC_MCLK0_CLK] = &cam_cc_mclk0_clk.clkr, |
| 1908 | [CAM_CC_MCLK0_CLK_SRC] = &cam_cc_mclk0_clk_src.clkr, |
| 1909 | [CAM_CC_MCLK1_CLK] = &cam_cc_mclk1_clk.clkr, |
| 1910 | [CAM_CC_MCLK1_CLK_SRC] = &cam_cc_mclk1_clk_src.clkr, |
| 1911 | [CAM_CC_MCLK2_CLK] = &cam_cc_mclk2_clk.clkr, |
| 1912 | [CAM_CC_MCLK2_CLK_SRC] = &cam_cc_mclk2_clk_src.clkr, |
| 1913 | [CAM_CC_MCLK3_CLK] = &cam_cc_mclk3_clk.clkr, |
| 1914 | [CAM_CC_MCLK3_CLK_SRC] = &cam_cc_mclk3_clk_src.clkr, |
| 1915 | [CAM_CC_PLL0] = &cam_cc_pll0.clkr, |
| 1916 | [CAM_CC_PLL0_OUT_EVEN] = &cam_cc_pll0_out_even.clkr, |
| 1917 | [CAM_CC_PLL1] = &cam_cc_pll1.clkr, |
| 1918 | [CAM_CC_PLL1_OUT_EVEN] = &cam_cc_pll1_out_even.clkr, |
| 1919 | [CAM_CC_PLL2] = &cam_cc_pll2.clkr, |
| 1920 | [CAM_CC_PLL2_OUT_EVEN] = &cam_cc_pll2_out_even.clkr, |
| 1921 | [CAM_CC_PLL2_OUT_ODD] = &cam_cc_pll2_out_odd.clkr, |
| 1922 | [CAM_CC_PLL3] = &cam_cc_pll3.clkr, |
| 1923 | [CAM_CC_PLL3_OUT_EVEN] = &cam_cc_pll3_out_even.clkr, |
| 1924 | [CAM_CC_PLL_TEST_CLK] = &cam_cc_pll_test_clk.clkr, |
| 1925 | [CAM_CC_SLOW_AHB_CLK_SRC] = &cam_cc_slow_ahb_clk_src.clkr, |
| 1926 | [CAM_CC_SOC_AHB_CLK] = &cam_cc_soc_ahb_clk.clkr, |
| 1927 | [CAM_CC_SYS_TMR_CLK] = &cam_cc_sys_tmr_clk.clkr, |
| 1928 | }; |
| 1929 | |
| 1930 | static const struct qcom_reset_map cam_cc_sdm845_resets[] = { |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1931 | [TITAN_CAM_CC_CCI_BCR] = { 0xb0d4 }, |
| 1932 | [TITAN_CAM_CC_CPAS_BCR] = { 0xb118 }, |
| 1933 | [TITAN_CAM_CC_CSI0PHY_BCR] = { 0x5000 }, |
| 1934 | [TITAN_CAM_CC_CSI1PHY_BCR] = { 0x5024 }, |
| 1935 | [TITAN_CAM_CC_CSI2PHY_BCR] = { 0x5048 }, |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1936 | [TITAN_CAM_CC_MCLK0_BCR] = { 0x4000 }, |
| 1937 | [TITAN_CAM_CC_MCLK1_BCR] = { 0x4020 }, |
| 1938 | [TITAN_CAM_CC_MCLK2_BCR] = { 0x4040 }, |
| 1939 | [TITAN_CAM_CC_MCLK3_BCR] = { 0x4060 }, |
| 1940 | [TITAN_CAM_CC_TITAN_TOP_BCR] = { 0xb130 }, |
| 1941 | }; |
| 1942 | |
| 1943 | static const struct regmap_config cam_cc_sdm845_regmap_config = { |
| 1944 | .reg_bits = 32, |
| 1945 | .reg_stride = 4, |
| 1946 | .val_bits = 32, |
| 1947 | .max_register = 0xd004, |
| 1948 | .fast_io = true, |
| 1949 | }; |
| 1950 | |
| 1951 | static const struct qcom_cc_desc cam_cc_sdm845_desc = { |
| 1952 | .config = &cam_cc_sdm845_regmap_config, |
| 1953 | .clks = cam_cc_sdm845_clocks, |
| 1954 | .num_clks = ARRAY_SIZE(cam_cc_sdm845_clocks), |
| 1955 | .resets = cam_cc_sdm845_resets, |
| 1956 | .num_resets = ARRAY_SIZE(cam_cc_sdm845_resets), |
| 1957 | }; |
| 1958 | |
| 1959 | static const struct of_device_id cam_cc_sdm845_match_table[] = { |
| 1960 | { .compatible = "qcom,cam_cc-sdm845" }, |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 1961 | { .compatible = "qcom,cam_cc-sdm845-v2" }, |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 1962 | { } |
| 1963 | }; |
| 1964 | MODULE_DEVICE_TABLE(of, cam_cc_sdm845_match_table); |
| 1965 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 1966 | static void cam_cc_sdm845_fixup_sdm845v2(void) |
| 1967 | { |
| 1968 | cam_cc_sdm845_clocks[CAM_CC_CSI3PHYTIMER_CLK] = |
| 1969 | &cam_cc_csi3phytimer_clk.clkr; |
| 1970 | cam_cc_sdm845_clocks[CAM_CC_CSIPHY3_CLK] = &cam_cc_csiphy3_clk.clkr; |
| 1971 | cam_cc_sdm845_clocks[CAM_CC_CSI3PHYTIMER_CLK_SRC] = |
| 1972 | &cam_cc_csi3phytimer_clk_src.clkr; |
| 1973 | cam_cc_cphy_rx_clk_src.freq_tbl = ftbl_cam_cc_cphy_rx_clk_src_sdm845_v2; |
| 1974 | cam_cc_cphy_rx_clk_src.clkr.hw.init->rate_max[VDD_CX_LOWER] = 384000000; |
| 1975 | cam_cc_fd_core_clk_src.freq_tbl = ftbl_cam_cc_fd_core_clk_src_sdm845_v2; |
| 1976 | cam_cc_fd_core_clk_src.clkr.hw.init->rate_max[VDD_CX_LOWER] = 384000000; |
| 1977 | cam_cc_icp_clk_src.freq_tbl = ftbl_cam_cc_icp_clk_src_sdm845_v2; |
| 1978 | cam_cc_icp_clk_src.clkr.hw.init->rate_max[VDD_CX_LOWER] = 384000000; |
| 1979 | cam_cc_icp_clk_src.clkr.hw.init->rate_max[VDD_CX_LOW_L1] = 600000000; |
| 1980 | cam_cc_ipe_0_clk_src.clkr.hw.init->rate_max[VDD_CX_NOMINAL] = 600000000; |
| 1981 | cam_cc_ipe_1_clk_src.clkr.hw.init->rate_max[VDD_CX_NOMINAL] = 600000000; |
| 1982 | cam_cc_lrme_clk_src.freq_tbl = ftbl_cam_cc_lrme_clk_src_sdm845_v2; |
| 1983 | cam_cc_lrme_clk_src.clkr.hw.init->rate_max[VDD_CX_LOW] = 269333333; |
| 1984 | cam_cc_lrme_clk_src.clkr.hw.init->rate_max[VDD_CX_LOW_L1] = 320000000; |
| 1985 | cam_cc_lrme_clk_src.clkr.hw.init->rate_max[VDD_CX_NOMINAL] = 400000000; |
| 1986 | cam_cc_slow_ahb_clk_src.clkr.hw.init->rate_max[VDD_CX_LOWER] = 80000000; |
| 1987 | } |
| 1988 | |
| 1989 | static int cam_cc_sdm845_fixup(struct platform_device *pdev) |
| 1990 | { |
| 1991 | const char *compat = NULL; |
| 1992 | int compatlen = 0; |
| 1993 | |
| 1994 | compat = of_get_property(pdev->dev.of_node, "compatible", &compatlen); |
| 1995 | if (!compat || (compatlen <= 0)) |
| 1996 | return -EINVAL; |
| 1997 | |
| 1998 | if (!strcmp(compat, "qcom,cam_cc-sdm845-v2")) |
| 1999 | cam_cc_sdm845_fixup_sdm845v2(); |
| 2000 | |
| 2001 | return 0; |
| 2002 | } |
| 2003 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 2004 | static int cam_cc_sdm845_probe(struct platform_device *pdev) |
| 2005 | { |
| 2006 | struct regmap *regmap; |
| 2007 | int ret = 0; |
| 2008 | |
| 2009 | regmap = qcom_cc_map(pdev, &cam_cc_sdm845_desc); |
| 2010 | if (IS_ERR(regmap)) { |
| 2011 | pr_err("Failed to map the Camera CC registers\n"); |
| 2012 | return PTR_ERR(regmap); |
| 2013 | } |
| 2014 | |
| 2015 | vdd_cx.regulator[0] = devm_regulator_get(&pdev->dev, "vdd_cx"); |
| 2016 | if (IS_ERR(vdd_cx.regulator[0])) { |
| 2017 | if (!(PTR_ERR(vdd_cx.regulator[0]) == -EPROBE_DEFER)) |
| 2018 | dev_err(&pdev->dev, |
| 2019 | "Unable to get vdd_cx regulator\n"); |
| 2020 | return PTR_ERR(vdd_cx.regulator[0]); |
| 2021 | } |
| 2022 | |
| 2023 | vdd_mx.regulator[0] = devm_regulator_get(&pdev->dev, "vdd_mx"); |
| 2024 | if (IS_ERR(vdd_mx.regulator[0])) { |
| 2025 | if (!(PTR_ERR(vdd_mx.regulator[0]) == -EPROBE_DEFER)) |
| 2026 | dev_err(&pdev->dev, |
| 2027 | "Unable to get vdd_mx regulator\n"); |
| 2028 | return PTR_ERR(vdd_mx.regulator[0]); |
| 2029 | } |
| 2030 | |
Deepak Katragadda | 6c846e3 | 2017-06-07 14:09:49 -0700 | [diff] [blame] | 2031 | ret = cam_cc_sdm845_fixup(pdev); |
| 2032 | if (ret) |
| 2033 | return ret; |
| 2034 | |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 2035 | clk_fabia_pll_configure(&cam_cc_pll0, regmap, &cam_cc_pll0_config); |
| 2036 | clk_fabia_pll_configure(&cam_cc_pll1, regmap, &cam_cc_pll1_config); |
| 2037 | clk_fabia_pll_configure(&cam_cc_pll2, regmap, &cam_cc_pll2_config); |
| 2038 | clk_fabia_pll_configure(&cam_cc_pll3, regmap, &cam_cc_pll3_config); |
| 2039 | |
| 2040 | ret = qcom_cc_really_probe(pdev, &cam_cc_sdm845_desc, regmap); |
| 2041 | if (ret) { |
| 2042 | dev_err(&pdev->dev, "Failed to register Camera CC clocks\n"); |
| 2043 | return ret; |
| 2044 | } |
| 2045 | |
| 2046 | dev_info(&pdev->dev, "Registered Camera CC clocks\n"); |
| 2047 | return ret; |
| 2048 | } |
| 2049 | |
| 2050 | static struct platform_driver cam_cc_sdm845_driver = { |
| 2051 | .probe = cam_cc_sdm845_probe, |
| 2052 | .driver = { |
| 2053 | .name = "cam_cc-sdm845", |
| 2054 | .of_match_table = cam_cc_sdm845_match_table, |
| 2055 | }, |
| 2056 | }; |
| 2057 | |
| 2058 | static int __init cam_cc_sdm845_init(void) |
| 2059 | { |
| 2060 | return platform_driver_register(&cam_cc_sdm845_driver); |
| 2061 | } |
Deepak Katragadda | ef44e10 | 2017-06-21 10:30:46 -0700 | [diff] [blame] | 2062 | subsys_initcall(cam_cc_sdm845_init); |
Deepak Katragadda | 7843b10 | 2016-12-15 14:12:40 -0800 | [diff] [blame] | 2063 | |
| 2064 | static void __exit cam_cc_sdm845_exit(void) |
| 2065 | { |
| 2066 | platform_driver_unregister(&cam_cc_sdm845_driver); |
| 2067 | } |
| 2068 | module_exit(cam_cc_sdm845_exit); |
| 2069 | |
| 2070 | MODULE_DESCRIPTION("QTI CAM_CC SDM845 Driver"); |
| 2071 | MODULE_LICENSE("GPL v2"); |
| 2072 | MODULE_ALIAS("platform:cam_cc-sdm845"); |