18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2015 The Linux Foundation. All rights reserved. 48c2ecf20Sopenharmony_ci */ 58c2ecf20Sopenharmony_ci 68c2ecf20Sopenharmony_ci#include <linux/kernel.h> 78c2ecf20Sopenharmony_ci#include <linux/err.h> 88c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 98c2ecf20Sopenharmony_ci#include <linux/module.h> 108c2ecf20Sopenharmony_ci#include <linux/of.h> 118c2ecf20Sopenharmony_ci#include <linux/of_device.h> 128c2ecf20Sopenharmony_ci#include <linux/clk-provider.h> 138c2ecf20Sopenharmony_ci#include <linux/regmap.h> 148c2ecf20Sopenharmony_ci#include <linux/reset-controller.h> 158c2ecf20Sopenharmony_ci#include <linux/math64.h> 168c2ecf20Sopenharmony_ci#include <linux/delay.h> 178c2ecf20Sopenharmony_ci#include <linux/clk.h> 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ci#include <dt-bindings/clock/qcom,gcc-ipq4019.h> 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#include "common.h" 228c2ecf20Sopenharmony_ci#include "clk-regmap.h" 238c2ecf20Sopenharmony_ci#include "clk-rcg.h" 248c2ecf20Sopenharmony_ci#include "clk-branch.h" 258c2ecf20Sopenharmony_ci#include "reset.h" 268c2ecf20Sopenharmony_ci#include "clk-regmap-divider.h" 278c2ecf20Sopenharmony_ci 288c2ecf20Sopenharmony_ci#define to_clk_regmap_div(_hw) container_of(to_clk_regmap(_hw),\ 298c2ecf20Sopenharmony_ci struct clk_regmap_div, clkr) 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ci#define to_clk_fepll(_hw) container_of(to_clk_regmap_div(_hw),\ 328c2ecf20Sopenharmony_ci struct clk_fepll, cdiv) 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_cienum { 358c2ecf20Sopenharmony_ci P_XO, 368c2ecf20Sopenharmony_ci P_FEPLL200, 378c2ecf20Sopenharmony_ci P_FEPLL500, 388c2ecf20Sopenharmony_ci P_DDRPLL, 398c2ecf20Sopenharmony_ci P_FEPLLWCSS2G, 408c2ecf20Sopenharmony_ci P_FEPLLWCSS5G, 418c2ecf20Sopenharmony_ci P_FEPLL125DLY, 428c2ecf20Sopenharmony_ci P_DDRPLLAPSS, 438c2ecf20Sopenharmony_ci}; 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* 468c2ecf20Sopenharmony_ci * struct clk_fepll_vco - vco feedback divider corresponds for FEPLL clocks 478c2ecf20Sopenharmony_ci * @fdbkdiv_shift: lowest bit for FDBKDIV 488c2ecf20Sopenharmony_ci * @fdbkdiv_width: number of bits in FDBKDIV 498c2ecf20Sopenharmony_ci * @refclkdiv_shift: lowest bit for REFCLKDIV 508c2ecf20Sopenharmony_ci * @refclkdiv_width: number of bits in REFCLKDIV 518c2ecf20Sopenharmony_ci * @reg: PLL_DIV register address 528c2ecf20Sopenharmony_ci */ 538c2ecf20Sopenharmony_cistruct clk_fepll_vco { 548c2ecf20Sopenharmony_ci u32 fdbkdiv_shift; 558c2ecf20Sopenharmony_ci u32 fdbkdiv_width; 568c2ecf20Sopenharmony_ci u32 refclkdiv_shift; 578c2ecf20Sopenharmony_ci u32 refclkdiv_width; 588c2ecf20Sopenharmony_ci u32 reg; 598c2ecf20Sopenharmony_ci}; 608c2ecf20Sopenharmony_ci 618c2ecf20Sopenharmony_ci/* 628c2ecf20Sopenharmony_ci * struct clk_fepll - clk divider corresponds to FEPLL clocks 638c2ecf20Sopenharmony_ci * @fixed_div: fixed divider value if divider is fixed 648c2ecf20Sopenharmony_ci * @parent_map: map from software's parent index to hardware's src_sel field 658c2ecf20Sopenharmony_ci * @cdiv: divider values for PLL_DIV 668c2ecf20Sopenharmony_ci * @pll_vco: vco feedback divider 678c2ecf20Sopenharmony_ci * @div_table: mapping for actual divider value to register divider value 688c2ecf20Sopenharmony_ci * in case of non fixed divider 698c2ecf20Sopenharmony_ci * @freq_tbl: frequency table 708c2ecf20Sopenharmony_ci */ 718c2ecf20Sopenharmony_cistruct clk_fepll { 728c2ecf20Sopenharmony_ci u32 fixed_div; 738c2ecf20Sopenharmony_ci const u8 *parent_map; 748c2ecf20Sopenharmony_ci struct clk_regmap_div cdiv; 758c2ecf20Sopenharmony_ci const struct clk_fepll_vco *pll_vco; 768c2ecf20Sopenharmony_ci const struct clk_div_table *div_table; 778c2ecf20Sopenharmony_ci const struct freq_tbl *freq_tbl; 788c2ecf20Sopenharmony_ci}; 798c2ecf20Sopenharmony_ci 808c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_200_500_map[] = { 818c2ecf20Sopenharmony_ci { P_XO, 0 }, 828c2ecf20Sopenharmony_ci { P_FEPLL200, 1 }, 838c2ecf20Sopenharmony_ci { P_FEPLL500, 2 }, 848c2ecf20Sopenharmony_ci}; 858c2ecf20Sopenharmony_ci 868c2ecf20Sopenharmony_cistatic const char * const gcc_xo_200_500[] = { 878c2ecf20Sopenharmony_ci "xo", 888c2ecf20Sopenharmony_ci "fepll200", 898c2ecf20Sopenharmony_ci "fepll500", 908c2ecf20Sopenharmony_ci}; 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_200_map[] = { 938c2ecf20Sopenharmony_ci { P_XO, 0 }, 948c2ecf20Sopenharmony_ci { P_FEPLL200, 1 }, 958c2ecf20Sopenharmony_ci}; 968c2ecf20Sopenharmony_ci 978c2ecf20Sopenharmony_cistatic const char * const gcc_xo_200[] = { 988c2ecf20Sopenharmony_ci "xo", 998c2ecf20Sopenharmony_ci "fepll200", 1008c2ecf20Sopenharmony_ci}; 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_200_spi_map[] = { 1038c2ecf20Sopenharmony_ci { P_XO, 0 }, 1048c2ecf20Sopenharmony_ci { P_FEPLL200, 2 }, 1058c2ecf20Sopenharmony_ci}; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_cistatic const char * const gcc_xo_200_spi[] = { 1088c2ecf20Sopenharmony_ci "xo", 1098c2ecf20Sopenharmony_ci "fepll200", 1108c2ecf20Sopenharmony_ci}; 1118c2ecf20Sopenharmony_ci 1128c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_sdcc1_500_map[] = { 1138c2ecf20Sopenharmony_ci { P_XO, 0 }, 1148c2ecf20Sopenharmony_ci { P_DDRPLL, 1 }, 1158c2ecf20Sopenharmony_ci { P_FEPLL500, 2 }, 1168c2ecf20Sopenharmony_ci}; 1178c2ecf20Sopenharmony_ci 1188c2ecf20Sopenharmony_cistatic const char * const gcc_xo_sdcc1_500[] = { 1198c2ecf20Sopenharmony_ci "xo", 1208c2ecf20Sopenharmony_ci "ddrpllsdcc", 1218c2ecf20Sopenharmony_ci "fepll500", 1228c2ecf20Sopenharmony_ci}; 1238c2ecf20Sopenharmony_ci 1248c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_wcss2g_map[] = { 1258c2ecf20Sopenharmony_ci { P_XO, 0 }, 1268c2ecf20Sopenharmony_ci { P_FEPLLWCSS2G, 1 }, 1278c2ecf20Sopenharmony_ci}; 1288c2ecf20Sopenharmony_ci 1298c2ecf20Sopenharmony_cistatic const char * const gcc_xo_wcss2g[] = { 1308c2ecf20Sopenharmony_ci "xo", 1318c2ecf20Sopenharmony_ci "fepllwcss2g", 1328c2ecf20Sopenharmony_ci}; 1338c2ecf20Sopenharmony_ci 1348c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_wcss5g_map[] = { 1358c2ecf20Sopenharmony_ci { P_XO, 0 }, 1368c2ecf20Sopenharmony_ci { P_FEPLLWCSS5G, 1 }, 1378c2ecf20Sopenharmony_ci}; 1388c2ecf20Sopenharmony_ci 1398c2ecf20Sopenharmony_cistatic const char * const gcc_xo_wcss5g[] = { 1408c2ecf20Sopenharmony_ci "xo", 1418c2ecf20Sopenharmony_ci "fepllwcss5g", 1428c2ecf20Sopenharmony_ci}; 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_125_dly_map[] = { 1458c2ecf20Sopenharmony_ci { P_XO, 0 }, 1468c2ecf20Sopenharmony_ci { P_FEPLL125DLY, 1 }, 1478c2ecf20Sopenharmony_ci}; 1488c2ecf20Sopenharmony_ci 1498c2ecf20Sopenharmony_cistatic const char * const gcc_xo_125_dly[] = { 1508c2ecf20Sopenharmony_ci "xo", 1518c2ecf20Sopenharmony_ci "fepll125dly", 1528c2ecf20Sopenharmony_ci}; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_cistatic struct parent_map gcc_xo_ddr_500_200_map[] = { 1558c2ecf20Sopenharmony_ci { P_XO, 0 }, 1568c2ecf20Sopenharmony_ci { P_FEPLL200, 3 }, 1578c2ecf20Sopenharmony_ci { P_FEPLL500, 2 }, 1588c2ecf20Sopenharmony_ci { P_DDRPLLAPSS, 1 }, 1598c2ecf20Sopenharmony_ci}; 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci/* 1628c2ecf20Sopenharmony_ci * Contains index for safe clock during APSS freq change. 1638c2ecf20Sopenharmony_ci * fepll500 is being used as safe clock so initialize it 1648c2ecf20Sopenharmony_ci * with its index in parents list gcc_xo_ddr_500_200. 1658c2ecf20Sopenharmony_ci */ 1668c2ecf20Sopenharmony_cistatic const int gcc_ipq4019_cpu_safe_parent = 2; 1678c2ecf20Sopenharmony_cistatic const char * const gcc_xo_ddr_500_200[] = { 1688c2ecf20Sopenharmony_ci "xo", 1698c2ecf20Sopenharmony_ci "fepll200", 1708c2ecf20Sopenharmony_ci "fepll500", 1718c2ecf20Sopenharmony_ci "ddrpllapss", 1728c2ecf20Sopenharmony_ci}; 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_audio_pwm_clk[] = { 1758c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 1768c2ecf20Sopenharmony_ci F(200000000, P_FEPLL200, 1, 0, 0), 1778c2ecf20Sopenharmony_ci { } 1788c2ecf20Sopenharmony_ci}; 1798c2ecf20Sopenharmony_ci 1808c2ecf20Sopenharmony_cistatic struct clk_rcg2 audio_clk_src = { 1818c2ecf20Sopenharmony_ci .cmd_rcgr = 0x1b000, 1828c2ecf20Sopenharmony_ci .hid_width = 5, 1838c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_map, 1848c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_audio_pwm_clk, 1858c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 1868c2ecf20Sopenharmony_ci .name = "audio_clk_src", 1878c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200, 1888c2ecf20Sopenharmony_ci .num_parents = 2, 1898c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci }, 1928c2ecf20Sopenharmony_ci}; 1938c2ecf20Sopenharmony_ci 1948c2ecf20Sopenharmony_cistatic struct clk_branch gcc_audio_ahb_clk = { 1958c2ecf20Sopenharmony_ci .halt_reg = 0x1b010, 1968c2ecf20Sopenharmony_ci .clkr = { 1978c2ecf20Sopenharmony_ci .enable_reg = 0x1b010, 1988c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 1998c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 2008c2ecf20Sopenharmony_ci .name = "gcc_audio_ahb_clk", 2018c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 2028c2ecf20Sopenharmony_ci "pcnoc_clk_src", 2038c2ecf20Sopenharmony_ci }, 2048c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 2058c2ecf20Sopenharmony_ci .num_parents = 1, 2068c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 2078c2ecf20Sopenharmony_ci }, 2088c2ecf20Sopenharmony_ci }, 2098c2ecf20Sopenharmony_ci}; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_cistatic struct clk_branch gcc_audio_pwm_clk = { 2128c2ecf20Sopenharmony_ci .halt_reg = 0x1b00C, 2138c2ecf20Sopenharmony_ci .clkr = { 2148c2ecf20Sopenharmony_ci .enable_reg = 0x1b00C, 2158c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 2168c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 2178c2ecf20Sopenharmony_ci .name = "gcc_audio_pwm_clk", 2188c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 2198c2ecf20Sopenharmony_ci "audio_clk_src", 2208c2ecf20Sopenharmony_ci }, 2218c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 2228c2ecf20Sopenharmony_ci .num_parents = 1, 2238c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 2248c2ecf20Sopenharmony_ci }, 2258c2ecf20Sopenharmony_ci }, 2268c2ecf20Sopenharmony_ci}; 2278c2ecf20Sopenharmony_ci 2288c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_blsp1_qup1_2_i2c_apps_clk[] = { 2298c2ecf20Sopenharmony_ci F(19050000, P_FEPLL200, 10.5, 1, 1), 2308c2ecf20Sopenharmony_ci { } 2318c2ecf20Sopenharmony_ci}; 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_cistatic struct clk_rcg2 blsp1_qup1_i2c_apps_clk_src = { 2348c2ecf20Sopenharmony_ci .cmd_rcgr = 0x200c, 2358c2ecf20Sopenharmony_ci .hid_width = 5, 2368c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_map, 2378c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_blsp1_qup1_2_i2c_apps_clk, 2388c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 2398c2ecf20Sopenharmony_ci .name = "blsp1_qup1_i2c_apps_clk_src", 2408c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200, 2418c2ecf20Sopenharmony_ci .num_parents = 2, 2428c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 2438c2ecf20Sopenharmony_ci }, 2448c2ecf20Sopenharmony_ci}; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_cistatic struct clk_branch gcc_blsp1_qup1_i2c_apps_clk = { 2478c2ecf20Sopenharmony_ci .halt_reg = 0x2008, 2488c2ecf20Sopenharmony_ci .clkr = { 2498c2ecf20Sopenharmony_ci .enable_reg = 0x2008, 2508c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 2518c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 2528c2ecf20Sopenharmony_ci .name = "gcc_blsp1_qup1_i2c_apps_clk", 2538c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 2548c2ecf20Sopenharmony_ci "blsp1_qup1_i2c_apps_clk_src", 2558c2ecf20Sopenharmony_ci }, 2568c2ecf20Sopenharmony_ci .num_parents = 1, 2578c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 2588c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 2598c2ecf20Sopenharmony_ci }, 2608c2ecf20Sopenharmony_ci }, 2618c2ecf20Sopenharmony_ci}; 2628c2ecf20Sopenharmony_ci 2638c2ecf20Sopenharmony_cistatic struct clk_rcg2 blsp1_qup2_i2c_apps_clk_src = { 2648c2ecf20Sopenharmony_ci .cmd_rcgr = 0x3000, 2658c2ecf20Sopenharmony_ci .hid_width = 5, 2668c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_map, 2678c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_blsp1_qup1_2_i2c_apps_clk, 2688c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 2698c2ecf20Sopenharmony_ci .name = "blsp1_qup2_i2c_apps_clk_src", 2708c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200, 2718c2ecf20Sopenharmony_ci .num_parents = 2, 2728c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 2738c2ecf20Sopenharmony_ci }, 2748c2ecf20Sopenharmony_ci}; 2758c2ecf20Sopenharmony_ci 2768c2ecf20Sopenharmony_cistatic struct clk_branch gcc_blsp1_qup2_i2c_apps_clk = { 2778c2ecf20Sopenharmony_ci .halt_reg = 0x3010, 2788c2ecf20Sopenharmony_ci .clkr = { 2798c2ecf20Sopenharmony_ci .enable_reg = 0x3010, 2808c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 2818c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 2828c2ecf20Sopenharmony_ci .name = "gcc_blsp1_qup2_i2c_apps_clk", 2838c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 2848c2ecf20Sopenharmony_ci "blsp1_qup2_i2c_apps_clk_src", 2858c2ecf20Sopenharmony_ci }, 2868c2ecf20Sopenharmony_ci .num_parents = 1, 2878c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 2888c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 2898c2ecf20Sopenharmony_ci }, 2908c2ecf20Sopenharmony_ci }, 2918c2ecf20Sopenharmony_ci}; 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_blsp1_qup1_2_spi_apps_clk[] = { 2948c2ecf20Sopenharmony_ci F(960000, P_XO, 12, 1, 4), 2958c2ecf20Sopenharmony_ci F(4800000, P_XO, 1, 1, 10), 2968c2ecf20Sopenharmony_ci F(9600000, P_XO, 1, 1, 5), 2978c2ecf20Sopenharmony_ci F(15000000, P_XO, 1, 1, 3), 2988c2ecf20Sopenharmony_ci F(19200000, P_XO, 1, 2, 5), 2998c2ecf20Sopenharmony_ci F(24000000, P_XO, 1, 1, 2), 3008c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 3018c2ecf20Sopenharmony_ci { } 3028c2ecf20Sopenharmony_ci}; 3038c2ecf20Sopenharmony_ci 3048c2ecf20Sopenharmony_cistatic struct clk_rcg2 blsp1_qup1_spi_apps_clk_src = { 3058c2ecf20Sopenharmony_ci .cmd_rcgr = 0x2024, 3068c2ecf20Sopenharmony_ci .mnd_width = 8, 3078c2ecf20Sopenharmony_ci .hid_width = 5, 3088c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_spi_map, 3098c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_blsp1_qup1_2_spi_apps_clk, 3108c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 3118c2ecf20Sopenharmony_ci .name = "blsp1_qup1_spi_apps_clk_src", 3128c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200_spi, 3138c2ecf20Sopenharmony_ci .num_parents = 2, 3148c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 3158c2ecf20Sopenharmony_ci }, 3168c2ecf20Sopenharmony_ci}; 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_cistatic struct clk_branch gcc_blsp1_qup1_spi_apps_clk = { 3198c2ecf20Sopenharmony_ci .halt_reg = 0x2004, 3208c2ecf20Sopenharmony_ci .clkr = { 3218c2ecf20Sopenharmony_ci .enable_reg = 0x2004, 3228c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 3238c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 3248c2ecf20Sopenharmony_ci .name = "gcc_blsp1_qup1_spi_apps_clk", 3258c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 3268c2ecf20Sopenharmony_ci "blsp1_qup1_spi_apps_clk_src", 3278c2ecf20Sopenharmony_ci }, 3288c2ecf20Sopenharmony_ci .num_parents = 1, 3298c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 3308c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 3318c2ecf20Sopenharmony_ci }, 3328c2ecf20Sopenharmony_ci }, 3338c2ecf20Sopenharmony_ci}; 3348c2ecf20Sopenharmony_ci 3358c2ecf20Sopenharmony_cistatic struct clk_rcg2 blsp1_qup2_spi_apps_clk_src = { 3368c2ecf20Sopenharmony_ci .cmd_rcgr = 0x3014, 3378c2ecf20Sopenharmony_ci .mnd_width = 8, 3388c2ecf20Sopenharmony_ci .hid_width = 5, 3398c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_blsp1_qup1_2_spi_apps_clk, 3408c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_spi_map, 3418c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 3428c2ecf20Sopenharmony_ci .name = "blsp1_qup2_spi_apps_clk_src", 3438c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200_spi, 3448c2ecf20Sopenharmony_ci .num_parents = 2, 3458c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 3468c2ecf20Sopenharmony_ci }, 3478c2ecf20Sopenharmony_ci}; 3488c2ecf20Sopenharmony_ci 3498c2ecf20Sopenharmony_cistatic struct clk_branch gcc_blsp1_qup2_spi_apps_clk = { 3508c2ecf20Sopenharmony_ci .halt_reg = 0x300c, 3518c2ecf20Sopenharmony_ci .clkr = { 3528c2ecf20Sopenharmony_ci .enable_reg = 0x300c, 3538c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 3548c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 3558c2ecf20Sopenharmony_ci .name = "gcc_blsp1_qup2_spi_apps_clk", 3568c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 3578c2ecf20Sopenharmony_ci "blsp1_qup2_spi_apps_clk_src", 3588c2ecf20Sopenharmony_ci }, 3598c2ecf20Sopenharmony_ci .num_parents = 1, 3608c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 3618c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 3628c2ecf20Sopenharmony_ci }, 3638c2ecf20Sopenharmony_ci }, 3648c2ecf20Sopenharmony_ci}; 3658c2ecf20Sopenharmony_ci 3668c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_blsp1_uart1_2_apps_clk[] = { 3678c2ecf20Sopenharmony_ci F(1843200, P_FEPLL200, 1, 144, 15625), 3688c2ecf20Sopenharmony_ci F(3686400, P_FEPLL200, 1, 288, 15625), 3698c2ecf20Sopenharmony_ci F(7372800, P_FEPLL200, 1, 576, 15625), 3708c2ecf20Sopenharmony_ci F(14745600, P_FEPLL200, 1, 1152, 15625), 3718c2ecf20Sopenharmony_ci F(16000000, P_FEPLL200, 1, 2, 25), 3728c2ecf20Sopenharmony_ci F(24000000, P_XO, 1, 1, 2), 3738c2ecf20Sopenharmony_ci F(32000000, P_FEPLL200, 1, 4, 25), 3748c2ecf20Sopenharmony_ci F(40000000, P_FEPLL200, 1, 1, 5), 3758c2ecf20Sopenharmony_ci F(46400000, P_FEPLL200, 1, 29, 125), 3768c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 3778c2ecf20Sopenharmony_ci { } 3788c2ecf20Sopenharmony_ci}; 3798c2ecf20Sopenharmony_ci 3808c2ecf20Sopenharmony_cistatic struct clk_rcg2 blsp1_uart1_apps_clk_src = { 3818c2ecf20Sopenharmony_ci .cmd_rcgr = 0x2044, 3828c2ecf20Sopenharmony_ci .mnd_width = 16, 3838c2ecf20Sopenharmony_ci .hid_width = 5, 3848c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_blsp1_uart1_2_apps_clk, 3858c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_spi_map, 3868c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 3878c2ecf20Sopenharmony_ci .name = "blsp1_uart1_apps_clk_src", 3888c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200_spi, 3898c2ecf20Sopenharmony_ci .num_parents = 2, 3908c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 3918c2ecf20Sopenharmony_ci }, 3928c2ecf20Sopenharmony_ci}; 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_cistatic struct clk_branch gcc_blsp1_uart1_apps_clk = { 3958c2ecf20Sopenharmony_ci .halt_reg = 0x203c, 3968c2ecf20Sopenharmony_ci .clkr = { 3978c2ecf20Sopenharmony_ci .enable_reg = 0x203c, 3988c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 3998c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 4008c2ecf20Sopenharmony_ci .name = "gcc_blsp1_uart1_apps_clk", 4018c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 4028c2ecf20Sopenharmony_ci "blsp1_uart1_apps_clk_src", 4038c2ecf20Sopenharmony_ci }, 4048c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 4058c2ecf20Sopenharmony_ci .num_parents = 1, 4068c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 4078c2ecf20Sopenharmony_ci }, 4088c2ecf20Sopenharmony_ci }, 4098c2ecf20Sopenharmony_ci}; 4108c2ecf20Sopenharmony_ci 4118c2ecf20Sopenharmony_cistatic struct clk_rcg2 blsp1_uart2_apps_clk_src = { 4128c2ecf20Sopenharmony_ci .cmd_rcgr = 0x3034, 4138c2ecf20Sopenharmony_ci .mnd_width = 16, 4148c2ecf20Sopenharmony_ci .hid_width = 5, 4158c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_blsp1_uart1_2_apps_clk, 4168c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_spi_map, 4178c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 4188c2ecf20Sopenharmony_ci .name = "blsp1_uart2_apps_clk_src", 4198c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200_spi, 4208c2ecf20Sopenharmony_ci .num_parents = 2, 4218c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 4228c2ecf20Sopenharmony_ci }, 4238c2ecf20Sopenharmony_ci}; 4248c2ecf20Sopenharmony_ci 4258c2ecf20Sopenharmony_cistatic struct clk_branch gcc_blsp1_uart2_apps_clk = { 4268c2ecf20Sopenharmony_ci .halt_reg = 0x302c, 4278c2ecf20Sopenharmony_ci .clkr = { 4288c2ecf20Sopenharmony_ci .enable_reg = 0x302c, 4298c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 4308c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 4318c2ecf20Sopenharmony_ci .name = "gcc_blsp1_uart2_apps_clk", 4328c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 4338c2ecf20Sopenharmony_ci "blsp1_uart2_apps_clk_src", 4348c2ecf20Sopenharmony_ci }, 4358c2ecf20Sopenharmony_ci .num_parents = 1, 4368c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 4378c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 4388c2ecf20Sopenharmony_ci }, 4398c2ecf20Sopenharmony_ci }, 4408c2ecf20Sopenharmony_ci}; 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_gp_clk[] = { 4438c2ecf20Sopenharmony_ci F(1250000, P_FEPLL200, 1, 16, 0), 4448c2ecf20Sopenharmony_ci F(2500000, P_FEPLL200, 1, 8, 0), 4458c2ecf20Sopenharmony_ci F(5000000, P_FEPLL200, 1, 4, 0), 4468c2ecf20Sopenharmony_ci { } 4478c2ecf20Sopenharmony_ci}; 4488c2ecf20Sopenharmony_ci 4498c2ecf20Sopenharmony_cistatic struct clk_rcg2 gp1_clk_src = { 4508c2ecf20Sopenharmony_ci .cmd_rcgr = 0x8004, 4518c2ecf20Sopenharmony_ci .mnd_width = 8, 4528c2ecf20Sopenharmony_ci .hid_width = 5, 4538c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_gp_clk, 4548c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_map, 4558c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 4568c2ecf20Sopenharmony_ci .name = "gp1_clk_src", 4578c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200, 4588c2ecf20Sopenharmony_ci .num_parents = 2, 4598c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 4608c2ecf20Sopenharmony_ci }, 4618c2ecf20Sopenharmony_ci}; 4628c2ecf20Sopenharmony_ci 4638c2ecf20Sopenharmony_cistatic struct clk_branch gcc_gp1_clk = { 4648c2ecf20Sopenharmony_ci .halt_reg = 0x8000, 4658c2ecf20Sopenharmony_ci .clkr = { 4668c2ecf20Sopenharmony_ci .enable_reg = 0x8000, 4678c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 4688c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 4698c2ecf20Sopenharmony_ci .name = "gcc_gp1_clk", 4708c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 4718c2ecf20Sopenharmony_ci "gp1_clk_src", 4728c2ecf20Sopenharmony_ci }, 4738c2ecf20Sopenharmony_ci .num_parents = 1, 4748c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 4758c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 4768c2ecf20Sopenharmony_ci }, 4778c2ecf20Sopenharmony_ci }, 4788c2ecf20Sopenharmony_ci}; 4798c2ecf20Sopenharmony_ci 4808c2ecf20Sopenharmony_cistatic struct clk_rcg2 gp2_clk_src = { 4818c2ecf20Sopenharmony_ci .cmd_rcgr = 0x9004, 4828c2ecf20Sopenharmony_ci .mnd_width = 8, 4838c2ecf20Sopenharmony_ci .hid_width = 5, 4848c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_gp_clk, 4858c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_map, 4868c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 4878c2ecf20Sopenharmony_ci .name = "gp2_clk_src", 4888c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200, 4898c2ecf20Sopenharmony_ci .num_parents = 2, 4908c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 4918c2ecf20Sopenharmony_ci }, 4928c2ecf20Sopenharmony_ci}; 4938c2ecf20Sopenharmony_ci 4948c2ecf20Sopenharmony_cistatic struct clk_branch gcc_gp2_clk = { 4958c2ecf20Sopenharmony_ci .halt_reg = 0x9000, 4968c2ecf20Sopenharmony_ci .clkr = { 4978c2ecf20Sopenharmony_ci .enable_reg = 0x9000, 4988c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 4998c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 5008c2ecf20Sopenharmony_ci .name = "gcc_gp2_clk", 5018c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 5028c2ecf20Sopenharmony_ci "gp2_clk_src", 5038c2ecf20Sopenharmony_ci }, 5048c2ecf20Sopenharmony_ci .num_parents = 1, 5058c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 5068c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 5078c2ecf20Sopenharmony_ci }, 5088c2ecf20Sopenharmony_ci }, 5098c2ecf20Sopenharmony_ci}; 5108c2ecf20Sopenharmony_ci 5118c2ecf20Sopenharmony_cistatic struct clk_rcg2 gp3_clk_src = { 5128c2ecf20Sopenharmony_ci .cmd_rcgr = 0xa004, 5138c2ecf20Sopenharmony_ci .mnd_width = 8, 5148c2ecf20Sopenharmony_ci .hid_width = 5, 5158c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_gp_clk, 5168c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_map, 5178c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 5188c2ecf20Sopenharmony_ci .name = "gp3_clk_src", 5198c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200, 5208c2ecf20Sopenharmony_ci .num_parents = 2, 5218c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 5228c2ecf20Sopenharmony_ci }, 5238c2ecf20Sopenharmony_ci}; 5248c2ecf20Sopenharmony_ci 5258c2ecf20Sopenharmony_cistatic struct clk_branch gcc_gp3_clk = { 5268c2ecf20Sopenharmony_ci .halt_reg = 0xa000, 5278c2ecf20Sopenharmony_ci .clkr = { 5288c2ecf20Sopenharmony_ci .enable_reg = 0xa000, 5298c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 5308c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 5318c2ecf20Sopenharmony_ci .name = "gcc_gp3_clk", 5328c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 5338c2ecf20Sopenharmony_ci "gp3_clk_src", 5348c2ecf20Sopenharmony_ci }, 5358c2ecf20Sopenharmony_ci .num_parents = 1, 5368c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 5378c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 5388c2ecf20Sopenharmony_ci }, 5398c2ecf20Sopenharmony_ci }, 5408c2ecf20Sopenharmony_ci}; 5418c2ecf20Sopenharmony_ci 5428c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_sdcc1_apps_clk[] = { 5438c2ecf20Sopenharmony_ci F(144000, P_XO, 1, 3, 240), 5448c2ecf20Sopenharmony_ci F(400000, P_XO, 1, 1, 0), 5458c2ecf20Sopenharmony_ci F(20000000, P_FEPLL500, 1, 1, 25), 5468c2ecf20Sopenharmony_ci F(25000000, P_FEPLL500, 1, 1, 20), 5478c2ecf20Sopenharmony_ci F(50000000, P_FEPLL500, 1, 1, 10), 5488c2ecf20Sopenharmony_ci F(100000000, P_FEPLL500, 1, 1, 5), 5498c2ecf20Sopenharmony_ci F(192000000, P_DDRPLL, 1, 0, 0), 5508c2ecf20Sopenharmony_ci { } 5518c2ecf20Sopenharmony_ci}; 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_cistatic struct clk_rcg2 sdcc1_apps_clk_src = { 5548c2ecf20Sopenharmony_ci .cmd_rcgr = 0x18004, 5558c2ecf20Sopenharmony_ci .hid_width = 5, 5568c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_sdcc1_apps_clk, 5578c2ecf20Sopenharmony_ci .parent_map = gcc_xo_sdcc1_500_map, 5588c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 5598c2ecf20Sopenharmony_ci .name = "sdcc1_apps_clk_src", 5608c2ecf20Sopenharmony_ci .parent_names = gcc_xo_sdcc1_500, 5618c2ecf20Sopenharmony_ci .num_parents = 3, 5628c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 5638c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 5648c2ecf20Sopenharmony_ci }, 5658c2ecf20Sopenharmony_ci}; 5668c2ecf20Sopenharmony_ci 5678c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_apps_clk[] = { 5688c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 5698c2ecf20Sopenharmony_ci F(200000000, P_FEPLL200, 1, 0, 0), 5708c2ecf20Sopenharmony_ci F(384000000, P_DDRPLLAPSS, 1, 0, 0), 5718c2ecf20Sopenharmony_ci F(413000000, P_DDRPLLAPSS, 1, 0, 0), 5728c2ecf20Sopenharmony_ci F(448000000, P_DDRPLLAPSS, 1, 0, 0), 5738c2ecf20Sopenharmony_ci F(488000000, P_DDRPLLAPSS, 1, 0, 0), 5748c2ecf20Sopenharmony_ci F(500000000, P_FEPLL500, 1, 0, 0), 5758c2ecf20Sopenharmony_ci F(512000000, P_DDRPLLAPSS, 1, 0, 0), 5768c2ecf20Sopenharmony_ci F(537000000, P_DDRPLLAPSS, 1, 0, 0), 5778c2ecf20Sopenharmony_ci F(565000000, P_DDRPLLAPSS, 1, 0, 0), 5788c2ecf20Sopenharmony_ci F(597000000, P_DDRPLLAPSS, 1, 0, 0), 5798c2ecf20Sopenharmony_ci F(632000000, P_DDRPLLAPSS, 1, 0, 0), 5808c2ecf20Sopenharmony_ci F(672000000, P_DDRPLLAPSS, 1, 0, 0), 5818c2ecf20Sopenharmony_ci F(716000000, P_DDRPLLAPSS, 1, 0, 0), 5828c2ecf20Sopenharmony_ci { } 5838c2ecf20Sopenharmony_ci}; 5848c2ecf20Sopenharmony_ci 5858c2ecf20Sopenharmony_cistatic struct clk_rcg2 apps_clk_src = { 5868c2ecf20Sopenharmony_ci .cmd_rcgr = 0x1900c, 5878c2ecf20Sopenharmony_ci .hid_width = 5, 5888c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_apps_clk, 5898c2ecf20Sopenharmony_ci .parent_map = gcc_xo_ddr_500_200_map, 5908c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 5918c2ecf20Sopenharmony_ci .name = "apps_clk_src", 5928c2ecf20Sopenharmony_ci .parent_names = gcc_xo_ddr_500_200, 5938c2ecf20Sopenharmony_ci .num_parents = 4, 5948c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 5958c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 5968c2ecf20Sopenharmony_ci }, 5978c2ecf20Sopenharmony_ci}; 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_apps_ahb_clk[] = { 6008c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 6018c2ecf20Sopenharmony_ci F(100000000, P_FEPLL200, 2, 0, 0), 6028c2ecf20Sopenharmony_ci { } 6038c2ecf20Sopenharmony_ci}; 6048c2ecf20Sopenharmony_ci 6058c2ecf20Sopenharmony_cistatic struct clk_rcg2 apps_ahb_clk_src = { 6068c2ecf20Sopenharmony_ci .cmd_rcgr = 0x19014, 6078c2ecf20Sopenharmony_ci .hid_width = 5, 6088c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_500_map, 6098c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_apps_ahb_clk, 6108c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 6118c2ecf20Sopenharmony_ci .name = "apps_ahb_clk_src", 6128c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200_500, 6138c2ecf20Sopenharmony_ci .num_parents = 3, 6148c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 6158c2ecf20Sopenharmony_ci }, 6168c2ecf20Sopenharmony_ci}; 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_cistatic struct clk_branch gcc_apss_ahb_clk = { 6198c2ecf20Sopenharmony_ci .halt_reg = 0x19004, 6208c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 6218c2ecf20Sopenharmony_ci .clkr = { 6228c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 6238c2ecf20Sopenharmony_ci .enable_mask = BIT(14), 6248c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 6258c2ecf20Sopenharmony_ci .name = "gcc_apss_ahb_clk", 6268c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 6278c2ecf20Sopenharmony_ci "apps_ahb_clk_src", 6288c2ecf20Sopenharmony_ci }, 6298c2ecf20Sopenharmony_ci .num_parents = 1, 6308c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 6318c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 6328c2ecf20Sopenharmony_ci }, 6338c2ecf20Sopenharmony_ci }, 6348c2ecf20Sopenharmony_ci}; 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_cistatic struct clk_branch gcc_blsp1_ahb_clk = { 6378c2ecf20Sopenharmony_ci .halt_reg = 0x1008, 6388c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 6398c2ecf20Sopenharmony_ci .clkr = { 6408c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 6418c2ecf20Sopenharmony_ci .enable_mask = BIT(10), 6428c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 6438c2ecf20Sopenharmony_ci .name = "gcc_blsp1_ahb_clk", 6448c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 6458c2ecf20Sopenharmony_ci "pcnoc_clk_src", 6468c2ecf20Sopenharmony_ci }, 6478c2ecf20Sopenharmony_ci .num_parents = 1, 6488c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 6498c2ecf20Sopenharmony_ci }, 6508c2ecf20Sopenharmony_ci }, 6518c2ecf20Sopenharmony_ci}; 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_cistatic struct clk_branch gcc_dcd_xo_clk = { 6548c2ecf20Sopenharmony_ci .halt_reg = 0x2103c, 6558c2ecf20Sopenharmony_ci .clkr = { 6568c2ecf20Sopenharmony_ci .enable_reg = 0x2103c, 6578c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 6588c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 6598c2ecf20Sopenharmony_ci .name = "gcc_dcd_xo_clk", 6608c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 6618c2ecf20Sopenharmony_ci "xo", 6628c2ecf20Sopenharmony_ci }, 6638c2ecf20Sopenharmony_ci .num_parents = 1, 6648c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 6658c2ecf20Sopenharmony_ci }, 6668c2ecf20Sopenharmony_ci }, 6678c2ecf20Sopenharmony_ci}; 6688c2ecf20Sopenharmony_ci 6698c2ecf20Sopenharmony_cistatic struct clk_branch gcc_boot_rom_ahb_clk = { 6708c2ecf20Sopenharmony_ci .halt_reg = 0x1300c, 6718c2ecf20Sopenharmony_ci .clkr = { 6728c2ecf20Sopenharmony_ci .enable_reg = 0x1300c, 6738c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 6748c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 6758c2ecf20Sopenharmony_ci .name = "gcc_boot_rom_ahb_clk", 6768c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 6778c2ecf20Sopenharmony_ci "pcnoc_clk_src", 6788c2ecf20Sopenharmony_ci }, 6798c2ecf20Sopenharmony_ci .num_parents = 1, 6808c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 6818c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 6828c2ecf20Sopenharmony_ci }, 6838c2ecf20Sopenharmony_ci }, 6848c2ecf20Sopenharmony_ci}; 6858c2ecf20Sopenharmony_ci 6868c2ecf20Sopenharmony_cistatic struct clk_branch gcc_crypto_ahb_clk = { 6878c2ecf20Sopenharmony_ci .halt_reg = 0x16024, 6888c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 6898c2ecf20Sopenharmony_ci .clkr = { 6908c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 6918c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 6928c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 6938c2ecf20Sopenharmony_ci .name = "gcc_crypto_ahb_clk", 6948c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 6958c2ecf20Sopenharmony_ci "pcnoc_clk_src", 6968c2ecf20Sopenharmony_ci }, 6978c2ecf20Sopenharmony_ci .num_parents = 1, 6988c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 6998c2ecf20Sopenharmony_ci }, 7008c2ecf20Sopenharmony_ci }, 7018c2ecf20Sopenharmony_ci}; 7028c2ecf20Sopenharmony_ci 7038c2ecf20Sopenharmony_cistatic struct clk_branch gcc_crypto_axi_clk = { 7048c2ecf20Sopenharmony_ci .halt_reg = 0x16020, 7058c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 7068c2ecf20Sopenharmony_ci .clkr = { 7078c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 7088c2ecf20Sopenharmony_ci .enable_mask = BIT(1), 7098c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 7108c2ecf20Sopenharmony_ci .name = "gcc_crypto_axi_clk", 7118c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 7128c2ecf20Sopenharmony_ci "fepll125", 7138c2ecf20Sopenharmony_ci }, 7148c2ecf20Sopenharmony_ci .num_parents = 1, 7158c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 7168c2ecf20Sopenharmony_ci }, 7178c2ecf20Sopenharmony_ci }, 7188c2ecf20Sopenharmony_ci}; 7198c2ecf20Sopenharmony_ci 7208c2ecf20Sopenharmony_cistatic struct clk_branch gcc_crypto_clk = { 7218c2ecf20Sopenharmony_ci .halt_reg = 0x1601c, 7228c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 7238c2ecf20Sopenharmony_ci .clkr = { 7248c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 7258c2ecf20Sopenharmony_ci .enable_mask = BIT(2), 7268c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 7278c2ecf20Sopenharmony_ci .name = "gcc_crypto_clk", 7288c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 7298c2ecf20Sopenharmony_ci "fepll125", 7308c2ecf20Sopenharmony_ci }, 7318c2ecf20Sopenharmony_ci .num_parents = 1, 7328c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 7338c2ecf20Sopenharmony_ci }, 7348c2ecf20Sopenharmony_ci }, 7358c2ecf20Sopenharmony_ci}; 7368c2ecf20Sopenharmony_ci 7378c2ecf20Sopenharmony_cistatic struct clk_branch gcc_ess_clk = { 7388c2ecf20Sopenharmony_ci .halt_reg = 0x12010, 7398c2ecf20Sopenharmony_ci .clkr = { 7408c2ecf20Sopenharmony_ci .enable_reg = 0x12010, 7418c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 7428c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 7438c2ecf20Sopenharmony_ci .name = "gcc_ess_clk", 7448c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 7458c2ecf20Sopenharmony_ci "fephy_125m_dly_clk_src", 7468c2ecf20Sopenharmony_ci }, 7478c2ecf20Sopenharmony_ci .num_parents = 1, 7488c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 7498c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 7508c2ecf20Sopenharmony_ci }, 7518c2ecf20Sopenharmony_ci }, 7528c2ecf20Sopenharmony_ci}; 7538c2ecf20Sopenharmony_ci 7548c2ecf20Sopenharmony_cistatic struct clk_branch gcc_imem_axi_clk = { 7558c2ecf20Sopenharmony_ci .halt_reg = 0xe004, 7568c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 7578c2ecf20Sopenharmony_ci .clkr = { 7588c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 7598c2ecf20Sopenharmony_ci .enable_mask = BIT(17), 7608c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 7618c2ecf20Sopenharmony_ci .name = "gcc_imem_axi_clk", 7628c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 7638c2ecf20Sopenharmony_ci "fepll200", 7648c2ecf20Sopenharmony_ci }, 7658c2ecf20Sopenharmony_ci .num_parents = 1, 7668c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 7678c2ecf20Sopenharmony_ci }, 7688c2ecf20Sopenharmony_ci }, 7698c2ecf20Sopenharmony_ci}; 7708c2ecf20Sopenharmony_ci 7718c2ecf20Sopenharmony_cistatic struct clk_branch gcc_imem_cfg_ahb_clk = { 7728c2ecf20Sopenharmony_ci .halt_reg = 0xe008, 7738c2ecf20Sopenharmony_ci .clkr = { 7748c2ecf20Sopenharmony_ci .enable_reg = 0xe008, 7758c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 7768c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 7778c2ecf20Sopenharmony_ci .name = "gcc_imem_cfg_ahb_clk", 7788c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 7798c2ecf20Sopenharmony_ci "pcnoc_clk_src", 7808c2ecf20Sopenharmony_ci }, 7818c2ecf20Sopenharmony_ci .num_parents = 1, 7828c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 7838c2ecf20Sopenharmony_ci }, 7848c2ecf20Sopenharmony_ci }, 7858c2ecf20Sopenharmony_ci}; 7868c2ecf20Sopenharmony_ci 7878c2ecf20Sopenharmony_cistatic struct clk_branch gcc_pcie_ahb_clk = { 7888c2ecf20Sopenharmony_ci .halt_reg = 0x1d00c, 7898c2ecf20Sopenharmony_ci .clkr = { 7908c2ecf20Sopenharmony_ci .enable_reg = 0x1d00c, 7918c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 7928c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 7938c2ecf20Sopenharmony_ci .name = "gcc_pcie_ahb_clk", 7948c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 7958c2ecf20Sopenharmony_ci "pcnoc_clk_src", 7968c2ecf20Sopenharmony_ci }, 7978c2ecf20Sopenharmony_ci .num_parents = 1, 7988c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 7998c2ecf20Sopenharmony_ci }, 8008c2ecf20Sopenharmony_ci }, 8018c2ecf20Sopenharmony_ci}; 8028c2ecf20Sopenharmony_ci 8038c2ecf20Sopenharmony_cistatic struct clk_branch gcc_pcie_axi_m_clk = { 8048c2ecf20Sopenharmony_ci .halt_reg = 0x1d004, 8058c2ecf20Sopenharmony_ci .clkr = { 8068c2ecf20Sopenharmony_ci .enable_reg = 0x1d004, 8078c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 8088c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 8098c2ecf20Sopenharmony_ci .name = "gcc_pcie_axi_m_clk", 8108c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 8118c2ecf20Sopenharmony_ci "fepll200", 8128c2ecf20Sopenharmony_ci }, 8138c2ecf20Sopenharmony_ci .num_parents = 1, 8148c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 8158c2ecf20Sopenharmony_ci }, 8168c2ecf20Sopenharmony_ci }, 8178c2ecf20Sopenharmony_ci}; 8188c2ecf20Sopenharmony_ci 8198c2ecf20Sopenharmony_cistatic struct clk_branch gcc_pcie_axi_s_clk = { 8208c2ecf20Sopenharmony_ci .halt_reg = 0x1d008, 8218c2ecf20Sopenharmony_ci .clkr = { 8228c2ecf20Sopenharmony_ci .enable_reg = 0x1d008, 8238c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 8248c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 8258c2ecf20Sopenharmony_ci .name = "gcc_pcie_axi_s_clk", 8268c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 8278c2ecf20Sopenharmony_ci "fepll200", 8288c2ecf20Sopenharmony_ci }, 8298c2ecf20Sopenharmony_ci .num_parents = 1, 8308c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 8318c2ecf20Sopenharmony_ci }, 8328c2ecf20Sopenharmony_ci }, 8338c2ecf20Sopenharmony_ci}; 8348c2ecf20Sopenharmony_ci 8358c2ecf20Sopenharmony_cistatic struct clk_branch gcc_prng_ahb_clk = { 8368c2ecf20Sopenharmony_ci .halt_reg = 0x13004, 8378c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 8388c2ecf20Sopenharmony_ci .clkr = { 8398c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 8408c2ecf20Sopenharmony_ci .enable_mask = BIT(8), 8418c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 8428c2ecf20Sopenharmony_ci .name = "gcc_prng_ahb_clk", 8438c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 8448c2ecf20Sopenharmony_ci "pcnoc_clk_src", 8458c2ecf20Sopenharmony_ci }, 8468c2ecf20Sopenharmony_ci .num_parents = 1, 8478c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 8488c2ecf20Sopenharmony_ci }, 8498c2ecf20Sopenharmony_ci }, 8508c2ecf20Sopenharmony_ci}; 8518c2ecf20Sopenharmony_ci 8528c2ecf20Sopenharmony_cistatic struct clk_branch gcc_qpic_ahb_clk = { 8538c2ecf20Sopenharmony_ci .halt_reg = 0x1c008, 8548c2ecf20Sopenharmony_ci .clkr = { 8558c2ecf20Sopenharmony_ci .enable_reg = 0x1c008, 8568c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 8578c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 8588c2ecf20Sopenharmony_ci .name = "gcc_qpic_ahb_clk", 8598c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 8608c2ecf20Sopenharmony_ci "pcnoc_clk_src", 8618c2ecf20Sopenharmony_ci }, 8628c2ecf20Sopenharmony_ci .num_parents = 1, 8638c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 8648c2ecf20Sopenharmony_ci }, 8658c2ecf20Sopenharmony_ci }, 8668c2ecf20Sopenharmony_ci}; 8678c2ecf20Sopenharmony_ci 8688c2ecf20Sopenharmony_cistatic struct clk_branch gcc_qpic_clk = { 8698c2ecf20Sopenharmony_ci .halt_reg = 0x1c004, 8708c2ecf20Sopenharmony_ci .clkr = { 8718c2ecf20Sopenharmony_ci .enable_reg = 0x1c004, 8728c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 8738c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 8748c2ecf20Sopenharmony_ci .name = "gcc_qpic_clk", 8758c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 8768c2ecf20Sopenharmony_ci "pcnoc_clk_src", 8778c2ecf20Sopenharmony_ci }, 8788c2ecf20Sopenharmony_ci .num_parents = 1, 8798c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 8808c2ecf20Sopenharmony_ci }, 8818c2ecf20Sopenharmony_ci }, 8828c2ecf20Sopenharmony_ci}; 8838c2ecf20Sopenharmony_ci 8848c2ecf20Sopenharmony_cistatic struct clk_branch gcc_sdcc1_ahb_clk = { 8858c2ecf20Sopenharmony_ci .halt_reg = 0x18010, 8868c2ecf20Sopenharmony_ci .clkr = { 8878c2ecf20Sopenharmony_ci .enable_reg = 0x18010, 8888c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 8898c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 8908c2ecf20Sopenharmony_ci .name = "gcc_sdcc1_ahb_clk", 8918c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 8928c2ecf20Sopenharmony_ci "pcnoc_clk_src", 8938c2ecf20Sopenharmony_ci }, 8948c2ecf20Sopenharmony_ci .num_parents = 1, 8958c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 8968c2ecf20Sopenharmony_ci }, 8978c2ecf20Sopenharmony_ci }, 8988c2ecf20Sopenharmony_ci}; 8998c2ecf20Sopenharmony_ci 9008c2ecf20Sopenharmony_cistatic struct clk_branch gcc_sdcc1_apps_clk = { 9018c2ecf20Sopenharmony_ci .halt_reg = 0x1800c, 9028c2ecf20Sopenharmony_ci .clkr = { 9038c2ecf20Sopenharmony_ci .enable_reg = 0x1800c, 9048c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 9058c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 9068c2ecf20Sopenharmony_ci .name = "gcc_sdcc1_apps_clk", 9078c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 9088c2ecf20Sopenharmony_ci "sdcc1_apps_clk_src", 9098c2ecf20Sopenharmony_ci }, 9108c2ecf20Sopenharmony_ci .num_parents = 1, 9118c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 9128c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 9138c2ecf20Sopenharmony_ci }, 9148c2ecf20Sopenharmony_ci }, 9158c2ecf20Sopenharmony_ci}; 9168c2ecf20Sopenharmony_ci 9178c2ecf20Sopenharmony_cistatic struct clk_branch gcc_tlmm_ahb_clk = { 9188c2ecf20Sopenharmony_ci .halt_reg = 0x5004, 9198c2ecf20Sopenharmony_ci .halt_check = BRANCH_HALT_VOTED, 9208c2ecf20Sopenharmony_ci .clkr = { 9218c2ecf20Sopenharmony_ci .enable_reg = 0x6000, 9228c2ecf20Sopenharmony_ci .enable_mask = BIT(5), 9238c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 9248c2ecf20Sopenharmony_ci .name = "gcc_tlmm_ahb_clk", 9258c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 9268c2ecf20Sopenharmony_ci "pcnoc_clk_src", 9278c2ecf20Sopenharmony_ci }, 9288c2ecf20Sopenharmony_ci .num_parents = 1, 9298c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 9308c2ecf20Sopenharmony_ci }, 9318c2ecf20Sopenharmony_ci }, 9328c2ecf20Sopenharmony_ci}; 9338c2ecf20Sopenharmony_ci 9348c2ecf20Sopenharmony_cistatic struct clk_branch gcc_usb2_master_clk = { 9358c2ecf20Sopenharmony_ci .halt_reg = 0x1e00c, 9368c2ecf20Sopenharmony_ci .clkr = { 9378c2ecf20Sopenharmony_ci .enable_reg = 0x1e00c, 9388c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 9398c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 9408c2ecf20Sopenharmony_ci .name = "gcc_usb2_master_clk", 9418c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 9428c2ecf20Sopenharmony_ci "pcnoc_clk_src", 9438c2ecf20Sopenharmony_ci }, 9448c2ecf20Sopenharmony_ci .num_parents = 1, 9458c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 9468c2ecf20Sopenharmony_ci }, 9478c2ecf20Sopenharmony_ci }, 9488c2ecf20Sopenharmony_ci}; 9498c2ecf20Sopenharmony_ci 9508c2ecf20Sopenharmony_cistatic struct clk_branch gcc_usb2_sleep_clk = { 9518c2ecf20Sopenharmony_ci .halt_reg = 0x1e010, 9528c2ecf20Sopenharmony_ci .clkr = { 9538c2ecf20Sopenharmony_ci .enable_reg = 0x1e010, 9548c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 9558c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 9568c2ecf20Sopenharmony_ci .name = "gcc_usb2_sleep_clk", 9578c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 9588c2ecf20Sopenharmony_ci "gcc_sleep_clk_src", 9598c2ecf20Sopenharmony_ci }, 9608c2ecf20Sopenharmony_ci .num_parents = 1, 9618c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 9628c2ecf20Sopenharmony_ci }, 9638c2ecf20Sopenharmony_ci }, 9648c2ecf20Sopenharmony_ci}; 9658c2ecf20Sopenharmony_ci 9668c2ecf20Sopenharmony_cistatic struct clk_branch gcc_usb2_mock_utmi_clk = { 9678c2ecf20Sopenharmony_ci .halt_reg = 0x1e014, 9688c2ecf20Sopenharmony_ci .clkr = { 9698c2ecf20Sopenharmony_ci .enable_reg = 0x1e014, 9708c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 9718c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 9728c2ecf20Sopenharmony_ci .name = "gcc_usb2_mock_utmi_clk", 9738c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 9748c2ecf20Sopenharmony_ci "usb30_mock_utmi_clk_src", 9758c2ecf20Sopenharmony_ci }, 9768c2ecf20Sopenharmony_ci .num_parents = 1, 9778c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 9788c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 9798c2ecf20Sopenharmony_ci }, 9808c2ecf20Sopenharmony_ci }, 9818c2ecf20Sopenharmony_ci}; 9828c2ecf20Sopenharmony_ci 9838c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_usb30_mock_utmi_clk[] = { 9848c2ecf20Sopenharmony_ci F(2000000, P_FEPLL200, 10, 0, 0), 9858c2ecf20Sopenharmony_ci { } 9868c2ecf20Sopenharmony_ci}; 9878c2ecf20Sopenharmony_ci 9888c2ecf20Sopenharmony_cistatic struct clk_rcg2 usb30_mock_utmi_clk_src = { 9898c2ecf20Sopenharmony_ci .cmd_rcgr = 0x1e000, 9908c2ecf20Sopenharmony_ci .hid_width = 5, 9918c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_map, 9928c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_usb30_mock_utmi_clk, 9938c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 9948c2ecf20Sopenharmony_ci .name = "usb30_mock_utmi_clk_src", 9958c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200, 9968c2ecf20Sopenharmony_ci .num_parents = 2, 9978c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 9988c2ecf20Sopenharmony_ci }, 9998c2ecf20Sopenharmony_ci}; 10008c2ecf20Sopenharmony_ci 10018c2ecf20Sopenharmony_cistatic struct clk_branch gcc_usb3_master_clk = { 10028c2ecf20Sopenharmony_ci .halt_reg = 0x1e028, 10038c2ecf20Sopenharmony_ci .clkr = { 10048c2ecf20Sopenharmony_ci .enable_reg = 0x1e028, 10058c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 10068c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 10078c2ecf20Sopenharmony_ci .name = "gcc_usb3_master_clk", 10088c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 10098c2ecf20Sopenharmony_ci "fepll125", 10108c2ecf20Sopenharmony_ci }, 10118c2ecf20Sopenharmony_ci .num_parents = 1, 10128c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 10138c2ecf20Sopenharmony_ci }, 10148c2ecf20Sopenharmony_ci }, 10158c2ecf20Sopenharmony_ci}; 10168c2ecf20Sopenharmony_ci 10178c2ecf20Sopenharmony_cistatic struct clk_branch gcc_usb3_sleep_clk = { 10188c2ecf20Sopenharmony_ci .halt_reg = 0x1e02C, 10198c2ecf20Sopenharmony_ci .clkr = { 10208c2ecf20Sopenharmony_ci .enable_reg = 0x1e02C, 10218c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 10228c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 10238c2ecf20Sopenharmony_ci .name = "gcc_usb3_sleep_clk", 10248c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 10258c2ecf20Sopenharmony_ci "gcc_sleep_clk_src", 10268c2ecf20Sopenharmony_ci }, 10278c2ecf20Sopenharmony_ci .num_parents = 1, 10288c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 10298c2ecf20Sopenharmony_ci }, 10308c2ecf20Sopenharmony_ci }, 10318c2ecf20Sopenharmony_ci}; 10328c2ecf20Sopenharmony_ci 10338c2ecf20Sopenharmony_cistatic struct clk_branch gcc_usb3_mock_utmi_clk = { 10348c2ecf20Sopenharmony_ci .halt_reg = 0x1e030, 10358c2ecf20Sopenharmony_ci .clkr = { 10368c2ecf20Sopenharmony_ci .enable_reg = 0x1e030, 10378c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 10388c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 10398c2ecf20Sopenharmony_ci .name = "gcc_usb3_mock_utmi_clk", 10408c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 10418c2ecf20Sopenharmony_ci "usb30_mock_utmi_clk_src", 10428c2ecf20Sopenharmony_ci }, 10438c2ecf20Sopenharmony_ci .num_parents = 1, 10448c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 10458c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 10468c2ecf20Sopenharmony_ci }, 10478c2ecf20Sopenharmony_ci }, 10488c2ecf20Sopenharmony_ci}; 10498c2ecf20Sopenharmony_ci 10508c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_fephy_dly_clk[] = { 10518c2ecf20Sopenharmony_ci F(125000000, P_FEPLL125DLY, 1, 0, 0), 10528c2ecf20Sopenharmony_ci { } 10538c2ecf20Sopenharmony_ci}; 10548c2ecf20Sopenharmony_ci 10558c2ecf20Sopenharmony_cistatic struct clk_rcg2 fephy_125m_dly_clk_src = { 10568c2ecf20Sopenharmony_ci .cmd_rcgr = 0x12000, 10578c2ecf20Sopenharmony_ci .hid_width = 5, 10588c2ecf20Sopenharmony_ci .parent_map = gcc_xo_125_dly_map, 10598c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_fephy_dly_clk, 10608c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 10618c2ecf20Sopenharmony_ci .name = "fephy_125m_dly_clk_src", 10628c2ecf20Sopenharmony_ci .parent_names = gcc_xo_125_dly, 10638c2ecf20Sopenharmony_ci .num_parents = 2, 10648c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 10658c2ecf20Sopenharmony_ci }, 10668c2ecf20Sopenharmony_ci}; 10678c2ecf20Sopenharmony_ci 10688c2ecf20Sopenharmony_ci 10698c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_wcss2g_clk[] = { 10708c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 10718c2ecf20Sopenharmony_ci F(250000000, P_FEPLLWCSS2G, 1, 0, 0), 10728c2ecf20Sopenharmony_ci { } 10738c2ecf20Sopenharmony_ci}; 10748c2ecf20Sopenharmony_ci 10758c2ecf20Sopenharmony_cistatic struct clk_rcg2 wcss2g_clk_src = { 10768c2ecf20Sopenharmony_ci .cmd_rcgr = 0x1f000, 10778c2ecf20Sopenharmony_ci .hid_width = 5, 10788c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_wcss2g_clk, 10798c2ecf20Sopenharmony_ci .parent_map = gcc_xo_wcss2g_map, 10808c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 10818c2ecf20Sopenharmony_ci .name = "wcss2g_clk_src", 10828c2ecf20Sopenharmony_ci .parent_names = gcc_xo_wcss2g, 10838c2ecf20Sopenharmony_ci .num_parents = 2, 10848c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 10858c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 10868c2ecf20Sopenharmony_ci }, 10878c2ecf20Sopenharmony_ci}; 10888c2ecf20Sopenharmony_ci 10898c2ecf20Sopenharmony_cistatic struct clk_branch gcc_wcss2g_clk = { 10908c2ecf20Sopenharmony_ci .halt_reg = 0x1f00C, 10918c2ecf20Sopenharmony_ci .clkr = { 10928c2ecf20Sopenharmony_ci .enable_reg = 0x1f00C, 10938c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 10948c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 10958c2ecf20Sopenharmony_ci .name = "gcc_wcss2g_clk", 10968c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 10978c2ecf20Sopenharmony_ci "wcss2g_clk_src", 10988c2ecf20Sopenharmony_ci }, 10998c2ecf20Sopenharmony_ci .num_parents = 1, 11008c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 11018c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 11028c2ecf20Sopenharmony_ci }, 11038c2ecf20Sopenharmony_ci }, 11048c2ecf20Sopenharmony_ci}; 11058c2ecf20Sopenharmony_ci 11068c2ecf20Sopenharmony_cistatic struct clk_branch gcc_wcss2g_ref_clk = { 11078c2ecf20Sopenharmony_ci .halt_reg = 0x1f00C, 11088c2ecf20Sopenharmony_ci .clkr = { 11098c2ecf20Sopenharmony_ci .enable_reg = 0x1f00C, 11108c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 11118c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 11128c2ecf20Sopenharmony_ci .name = "gcc_wcss2g_ref_clk", 11138c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 11148c2ecf20Sopenharmony_ci "xo", 11158c2ecf20Sopenharmony_ci }, 11168c2ecf20Sopenharmony_ci .num_parents = 1, 11178c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 11188c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 11198c2ecf20Sopenharmony_ci }, 11208c2ecf20Sopenharmony_ci }, 11218c2ecf20Sopenharmony_ci}; 11228c2ecf20Sopenharmony_ci 11238c2ecf20Sopenharmony_cistatic struct clk_branch gcc_wcss2g_rtc_clk = { 11248c2ecf20Sopenharmony_ci .halt_reg = 0x1f010, 11258c2ecf20Sopenharmony_ci .clkr = { 11268c2ecf20Sopenharmony_ci .enable_reg = 0x1f010, 11278c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 11288c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 11298c2ecf20Sopenharmony_ci .name = "gcc_wcss2g_rtc_clk", 11308c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 11318c2ecf20Sopenharmony_ci "gcc_sleep_clk_src", 11328c2ecf20Sopenharmony_ci }, 11338c2ecf20Sopenharmony_ci .num_parents = 1, 11348c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 11358c2ecf20Sopenharmony_ci }, 11368c2ecf20Sopenharmony_ci }, 11378c2ecf20Sopenharmony_ci}; 11388c2ecf20Sopenharmony_ci 11398c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_wcss5g_clk[] = { 11408c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 11418c2ecf20Sopenharmony_ci F(250000000, P_FEPLLWCSS5G, 1, 0, 0), 11428c2ecf20Sopenharmony_ci { } 11438c2ecf20Sopenharmony_ci}; 11448c2ecf20Sopenharmony_ci 11458c2ecf20Sopenharmony_cistatic struct clk_rcg2 wcss5g_clk_src = { 11468c2ecf20Sopenharmony_ci .cmd_rcgr = 0x20000, 11478c2ecf20Sopenharmony_ci .hid_width = 5, 11488c2ecf20Sopenharmony_ci .parent_map = gcc_xo_wcss5g_map, 11498c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_wcss5g_clk, 11508c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 11518c2ecf20Sopenharmony_ci .name = "wcss5g_clk_src", 11528c2ecf20Sopenharmony_ci .parent_names = gcc_xo_wcss5g, 11538c2ecf20Sopenharmony_ci .num_parents = 2, 11548c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 11558c2ecf20Sopenharmony_ci }, 11568c2ecf20Sopenharmony_ci}; 11578c2ecf20Sopenharmony_ci 11588c2ecf20Sopenharmony_cistatic struct clk_branch gcc_wcss5g_clk = { 11598c2ecf20Sopenharmony_ci .halt_reg = 0x2000c, 11608c2ecf20Sopenharmony_ci .clkr = { 11618c2ecf20Sopenharmony_ci .enable_reg = 0x2000c, 11628c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 11638c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 11648c2ecf20Sopenharmony_ci .name = "gcc_wcss5g_clk", 11658c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 11668c2ecf20Sopenharmony_ci "wcss5g_clk_src", 11678c2ecf20Sopenharmony_ci }, 11688c2ecf20Sopenharmony_ci .num_parents = 1, 11698c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 11708c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 11718c2ecf20Sopenharmony_ci }, 11728c2ecf20Sopenharmony_ci }, 11738c2ecf20Sopenharmony_ci}; 11748c2ecf20Sopenharmony_ci 11758c2ecf20Sopenharmony_cistatic struct clk_branch gcc_wcss5g_ref_clk = { 11768c2ecf20Sopenharmony_ci .halt_reg = 0x2000c, 11778c2ecf20Sopenharmony_ci .clkr = { 11788c2ecf20Sopenharmony_ci .enable_reg = 0x2000c, 11798c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 11808c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 11818c2ecf20Sopenharmony_ci .name = "gcc_wcss5g_ref_clk", 11828c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 11838c2ecf20Sopenharmony_ci "xo", 11848c2ecf20Sopenharmony_ci }, 11858c2ecf20Sopenharmony_ci .num_parents = 1, 11868c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 11878c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 11888c2ecf20Sopenharmony_ci }, 11898c2ecf20Sopenharmony_ci }, 11908c2ecf20Sopenharmony_ci}; 11918c2ecf20Sopenharmony_ci 11928c2ecf20Sopenharmony_cistatic struct clk_branch gcc_wcss5g_rtc_clk = { 11938c2ecf20Sopenharmony_ci .halt_reg = 0x20010, 11948c2ecf20Sopenharmony_ci .clkr = { 11958c2ecf20Sopenharmony_ci .enable_reg = 0x20010, 11968c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 11978c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 11988c2ecf20Sopenharmony_ci .name = "gcc_wcss5g_rtc_clk", 11998c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 12008c2ecf20Sopenharmony_ci "gcc_sleep_clk_src", 12018c2ecf20Sopenharmony_ci }, 12028c2ecf20Sopenharmony_ci .num_parents = 1, 12038c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 12048c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT, 12058c2ecf20Sopenharmony_ci }, 12068c2ecf20Sopenharmony_ci }, 12078c2ecf20Sopenharmony_ci}; 12088c2ecf20Sopenharmony_ci 12098c2ecf20Sopenharmony_ci/* Calculates the VCO rate for FEPLL. */ 12108c2ecf20Sopenharmony_cistatic u64 clk_fepll_vco_calc_rate(struct clk_fepll *pll_div, 12118c2ecf20Sopenharmony_ci unsigned long parent_rate) 12128c2ecf20Sopenharmony_ci{ 12138c2ecf20Sopenharmony_ci const struct clk_fepll_vco *pll_vco = pll_div->pll_vco; 12148c2ecf20Sopenharmony_ci u32 fdbkdiv, refclkdiv, cdiv; 12158c2ecf20Sopenharmony_ci u64 vco; 12168c2ecf20Sopenharmony_ci 12178c2ecf20Sopenharmony_ci regmap_read(pll_div->cdiv.clkr.regmap, pll_vco->reg, &cdiv); 12188c2ecf20Sopenharmony_ci refclkdiv = (cdiv >> pll_vco->refclkdiv_shift) & 12198c2ecf20Sopenharmony_ci (BIT(pll_vco->refclkdiv_width) - 1); 12208c2ecf20Sopenharmony_ci fdbkdiv = (cdiv >> pll_vco->fdbkdiv_shift) & 12218c2ecf20Sopenharmony_ci (BIT(pll_vco->fdbkdiv_width) - 1); 12228c2ecf20Sopenharmony_ci 12238c2ecf20Sopenharmony_ci vco = parent_rate / refclkdiv; 12248c2ecf20Sopenharmony_ci vco *= 2; 12258c2ecf20Sopenharmony_ci vco *= fdbkdiv; 12268c2ecf20Sopenharmony_ci 12278c2ecf20Sopenharmony_ci return vco; 12288c2ecf20Sopenharmony_ci} 12298c2ecf20Sopenharmony_ci 12308c2ecf20Sopenharmony_cistatic const struct clk_fepll_vco gcc_apss_ddrpll_vco = { 12318c2ecf20Sopenharmony_ci .fdbkdiv_shift = 16, 12328c2ecf20Sopenharmony_ci .fdbkdiv_width = 8, 12338c2ecf20Sopenharmony_ci .refclkdiv_shift = 24, 12348c2ecf20Sopenharmony_ci .refclkdiv_width = 5, 12358c2ecf20Sopenharmony_ci .reg = 0x2e020, 12368c2ecf20Sopenharmony_ci}; 12378c2ecf20Sopenharmony_ci 12388c2ecf20Sopenharmony_cistatic const struct clk_fepll_vco gcc_fepll_vco = { 12398c2ecf20Sopenharmony_ci .fdbkdiv_shift = 16, 12408c2ecf20Sopenharmony_ci .fdbkdiv_width = 8, 12418c2ecf20Sopenharmony_ci .refclkdiv_shift = 24, 12428c2ecf20Sopenharmony_ci .refclkdiv_width = 5, 12438c2ecf20Sopenharmony_ci .reg = 0x2f020, 12448c2ecf20Sopenharmony_ci}; 12458c2ecf20Sopenharmony_ci 12468c2ecf20Sopenharmony_ci/* 12478c2ecf20Sopenharmony_ci * Round rate function for APSS CPU PLL Clock divider. 12488c2ecf20Sopenharmony_ci * It looks up the frequency table and returns the next higher frequency 12498c2ecf20Sopenharmony_ci * supported in hardware. 12508c2ecf20Sopenharmony_ci */ 12518c2ecf20Sopenharmony_cistatic long clk_cpu_div_round_rate(struct clk_hw *hw, unsigned long rate, 12528c2ecf20Sopenharmony_ci unsigned long *p_rate) 12538c2ecf20Sopenharmony_ci{ 12548c2ecf20Sopenharmony_ci struct clk_fepll *pll = to_clk_fepll(hw); 12558c2ecf20Sopenharmony_ci struct clk_hw *p_hw; 12568c2ecf20Sopenharmony_ci const struct freq_tbl *f; 12578c2ecf20Sopenharmony_ci 12588c2ecf20Sopenharmony_ci f = qcom_find_freq(pll->freq_tbl, rate); 12598c2ecf20Sopenharmony_ci if (!f) 12608c2ecf20Sopenharmony_ci return -EINVAL; 12618c2ecf20Sopenharmony_ci 12628c2ecf20Sopenharmony_ci p_hw = clk_hw_get_parent_by_index(hw, f->src); 12638c2ecf20Sopenharmony_ci *p_rate = clk_hw_get_rate(p_hw); 12648c2ecf20Sopenharmony_ci 12658c2ecf20Sopenharmony_ci return f->freq; 12668c2ecf20Sopenharmony_ci}; 12678c2ecf20Sopenharmony_ci 12688c2ecf20Sopenharmony_ci/* 12698c2ecf20Sopenharmony_ci * Clock set rate function for APSS CPU PLL Clock divider. 12708c2ecf20Sopenharmony_ci * It looks up the frequency table and updates the PLL divider to corresponding 12718c2ecf20Sopenharmony_ci * divider value. 12728c2ecf20Sopenharmony_ci */ 12738c2ecf20Sopenharmony_cistatic int clk_cpu_div_set_rate(struct clk_hw *hw, unsigned long rate, 12748c2ecf20Sopenharmony_ci unsigned long parent_rate) 12758c2ecf20Sopenharmony_ci{ 12768c2ecf20Sopenharmony_ci struct clk_fepll *pll = to_clk_fepll(hw); 12778c2ecf20Sopenharmony_ci const struct freq_tbl *f; 12788c2ecf20Sopenharmony_ci u32 mask; 12798c2ecf20Sopenharmony_ci int ret; 12808c2ecf20Sopenharmony_ci 12818c2ecf20Sopenharmony_ci f = qcom_find_freq(pll->freq_tbl, rate); 12828c2ecf20Sopenharmony_ci if (!f) 12838c2ecf20Sopenharmony_ci return -EINVAL; 12848c2ecf20Sopenharmony_ci 12858c2ecf20Sopenharmony_ci mask = (BIT(pll->cdiv.width) - 1) << pll->cdiv.shift; 12868c2ecf20Sopenharmony_ci ret = regmap_update_bits(pll->cdiv.clkr.regmap, 12878c2ecf20Sopenharmony_ci pll->cdiv.reg, mask, 12888c2ecf20Sopenharmony_ci f->pre_div << pll->cdiv.shift); 12898c2ecf20Sopenharmony_ci /* 12908c2ecf20Sopenharmony_ci * There is no status bit which can be checked for successful CPU 12918c2ecf20Sopenharmony_ci * divider update operation so using delay for the same. 12928c2ecf20Sopenharmony_ci */ 12938c2ecf20Sopenharmony_ci udelay(1); 12948c2ecf20Sopenharmony_ci 12958c2ecf20Sopenharmony_ci return 0; 12968c2ecf20Sopenharmony_ci}; 12978c2ecf20Sopenharmony_ci 12988c2ecf20Sopenharmony_ci/* 12998c2ecf20Sopenharmony_ci * Clock frequency calculation function for APSS CPU PLL Clock divider. 13008c2ecf20Sopenharmony_ci * This clock divider is nonlinear so this function calculates the actual 13018c2ecf20Sopenharmony_ci * divider and returns the output frequency by dividing VCO Frequency 13028c2ecf20Sopenharmony_ci * with this actual divider value. 13038c2ecf20Sopenharmony_ci */ 13048c2ecf20Sopenharmony_cistatic unsigned long 13058c2ecf20Sopenharmony_ciclk_cpu_div_recalc_rate(struct clk_hw *hw, 13068c2ecf20Sopenharmony_ci unsigned long parent_rate) 13078c2ecf20Sopenharmony_ci{ 13088c2ecf20Sopenharmony_ci struct clk_fepll *pll = to_clk_fepll(hw); 13098c2ecf20Sopenharmony_ci u32 cdiv, pre_div; 13108c2ecf20Sopenharmony_ci u64 rate; 13118c2ecf20Sopenharmony_ci 13128c2ecf20Sopenharmony_ci regmap_read(pll->cdiv.clkr.regmap, pll->cdiv.reg, &cdiv); 13138c2ecf20Sopenharmony_ci cdiv = (cdiv >> pll->cdiv.shift) & (BIT(pll->cdiv.width) - 1); 13148c2ecf20Sopenharmony_ci 13158c2ecf20Sopenharmony_ci /* 13168c2ecf20Sopenharmony_ci * Some dividers have value in 0.5 fraction so multiply both VCO 13178c2ecf20Sopenharmony_ci * frequency(parent_rate) and pre_div with 2 to make integer 13188c2ecf20Sopenharmony_ci * calculation. 13198c2ecf20Sopenharmony_ci */ 13208c2ecf20Sopenharmony_ci if (cdiv > 10) 13218c2ecf20Sopenharmony_ci pre_div = (cdiv + 1) * 2; 13228c2ecf20Sopenharmony_ci else 13238c2ecf20Sopenharmony_ci pre_div = cdiv + 12; 13248c2ecf20Sopenharmony_ci 13258c2ecf20Sopenharmony_ci rate = clk_fepll_vco_calc_rate(pll, parent_rate) * 2; 13268c2ecf20Sopenharmony_ci do_div(rate, pre_div); 13278c2ecf20Sopenharmony_ci 13288c2ecf20Sopenharmony_ci return rate; 13298c2ecf20Sopenharmony_ci}; 13308c2ecf20Sopenharmony_ci 13318c2ecf20Sopenharmony_cistatic const struct clk_ops clk_regmap_cpu_div_ops = { 13328c2ecf20Sopenharmony_ci .round_rate = clk_cpu_div_round_rate, 13338c2ecf20Sopenharmony_ci .set_rate = clk_cpu_div_set_rate, 13348c2ecf20Sopenharmony_ci .recalc_rate = clk_cpu_div_recalc_rate, 13358c2ecf20Sopenharmony_ci}; 13368c2ecf20Sopenharmony_ci 13378c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_apss_ddr_pll[] = { 13388c2ecf20Sopenharmony_ci { 384000000, P_XO, 0xd, 0, 0 }, 13398c2ecf20Sopenharmony_ci { 413000000, P_XO, 0xc, 0, 0 }, 13408c2ecf20Sopenharmony_ci { 448000000, P_XO, 0xb, 0, 0 }, 13418c2ecf20Sopenharmony_ci { 488000000, P_XO, 0xa, 0, 0 }, 13428c2ecf20Sopenharmony_ci { 512000000, P_XO, 0x9, 0, 0 }, 13438c2ecf20Sopenharmony_ci { 537000000, P_XO, 0x8, 0, 0 }, 13448c2ecf20Sopenharmony_ci { 565000000, P_XO, 0x7, 0, 0 }, 13458c2ecf20Sopenharmony_ci { 597000000, P_XO, 0x6, 0, 0 }, 13468c2ecf20Sopenharmony_ci { 632000000, P_XO, 0x5, 0, 0 }, 13478c2ecf20Sopenharmony_ci { 672000000, P_XO, 0x4, 0, 0 }, 13488c2ecf20Sopenharmony_ci { 716000000, P_XO, 0x3, 0, 0 }, 13498c2ecf20Sopenharmony_ci { 768000000, P_XO, 0x2, 0, 0 }, 13508c2ecf20Sopenharmony_ci { 823000000, P_XO, 0x1, 0, 0 }, 13518c2ecf20Sopenharmony_ci { 896000000, P_XO, 0x0, 0, 0 }, 13528c2ecf20Sopenharmony_ci { } 13538c2ecf20Sopenharmony_ci}; 13548c2ecf20Sopenharmony_ci 13558c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_apss_cpu_plldiv_clk = { 13568c2ecf20Sopenharmony_ci .cdiv.reg = 0x2e020, 13578c2ecf20Sopenharmony_ci .cdiv.shift = 4, 13588c2ecf20Sopenharmony_ci .cdiv.width = 4, 13598c2ecf20Sopenharmony_ci .cdiv.clkr = { 13608c2ecf20Sopenharmony_ci .enable_reg = 0x2e000, 13618c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 13628c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 13638c2ecf20Sopenharmony_ci .name = "ddrpllapss", 13648c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 13658c2ecf20Sopenharmony_ci "xo", 13668c2ecf20Sopenharmony_ci }, 13678c2ecf20Sopenharmony_ci .num_parents = 1, 13688c2ecf20Sopenharmony_ci .ops = &clk_regmap_cpu_div_ops, 13698c2ecf20Sopenharmony_ci }, 13708c2ecf20Sopenharmony_ci }, 13718c2ecf20Sopenharmony_ci .freq_tbl = ftbl_apss_ddr_pll, 13728c2ecf20Sopenharmony_ci .pll_vco = &gcc_apss_ddrpll_vco, 13738c2ecf20Sopenharmony_ci}; 13748c2ecf20Sopenharmony_ci 13758c2ecf20Sopenharmony_ci/* Calculates the rate for PLL divider. 13768c2ecf20Sopenharmony_ci * If the divider value is not fixed then it gets the actual divider value 13778c2ecf20Sopenharmony_ci * from divider table. Then, it calculate the clock rate by dividing the 13788c2ecf20Sopenharmony_ci * parent rate with actual divider value. 13798c2ecf20Sopenharmony_ci */ 13808c2ecf20Sopenharmony_cistatic unsigned long 13818c2ecf20Sopenharmony_ciclk_regmap_clk_div_recalc_rate(struct clk_hw *hw, 13828c2ecf20Sopenharmony_ci unsigned long parent_rate) 13838c2ecf20Sopenharmony_ci{ 13848c2ecf20Sopenharmony_ci struct clk_fepll *pll = to_clk_fepll(hw); 13858c2ecf20Sopenharmony_ci u32 cdiv, pre_div = 1; 13868c2ecf20Sopenharmony_ci u64 rate; 13878c2ecf20Sopenharmony_ci const struct clk_div_table *clkt; 13888c2ecf20Sopenharmony_ci 13898c2ecf20Sopenharmony_ci if (pll->fixed_div) { 13908c2ecf20Sopenharmony_ci pre_div = pll->fixed_div; 13918c2ecf20Sopenharmony_ci } else { 13928c2ecf20Sopenharmony_ci regmap_read(pll->cdiv.clkr.regmap, pll->cdiv.reg, &cdiv); 13938c2ecf20Sopenharmony_ci cdiv = (cdiv >> pll->cdiv.shift) & (BIT(pll->cdiv.width) - 1); 13948c2ecf20Sopenharmony_ci 13958c2ecf20Sopenharmony_ci for (clkt = pll->div_table; clkt->div; clkt++) { 13968c2ecf20Sopenharmony_ci if (clkt->val == cdiv) 13978c2ecf20Sopenharmony_ci pre_div = clkt->div; 13988c2ecf20Sopenharmony_ci } 13998c2ecf20Sopenharmony_ci } 14008c2ecf20Sopenharmony_ci 14018c2ecf20Sopenharmony_ci rate = clk_fepll_vco_calc_rate(pll, parent_rate); 14028c2ecf20Sopenharmony_ci do_div(rate, pre_div); 14038c2ecf20Sopenharmony_ci 14048c2ecf20Sopenharmony_ci return rate; 14058c2ecf20Sopenharmony_ci}; 14068c2ecf20Sopenharmony_ci 14078c2ecf20Sopenharmony_cistatic const struct clk_ops clk_fepll_div_ops = { 14088c2ecf20Sopenharmony_ci .recalc_rate = clk_regmap_clk_div_recalc_rate, 14098c2ecf20Sopenharmony_ci}; 14108c2ecf20Sopenharmony_ci 14118c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_apss_sdcc_clk = { 14128c2ecf20Sopenharmony_ci .fixed_div = 28, 14138c2ecf20Sopenharmony_ci .cdiv.clkr = { 14148c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 14158c2ecf20Sopenharmony_ci .name = "ddrpllsdcc", 14168c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 14178c2ecf20Sopenharmony_ci "xo", 14188c2ecf20Sopenharmony_ci }, 14198c2ecf20Sopenharmony_ci .num_parents = 1, 14208c2ecf20Sopenharmony_ci .ops = &clk_fepll_div_ops, 14218c2ecf20Sopenharmony_ci }, 14228c2ecf20Sopenharmony_ci }, 14238c2ecf20Sopenharmony_ci .pll_vco = &gcc_apss_ddrpll_vco, 14248c2ecf20Sopenharmony_ci}; 14258c2ecf20Sopenharmony_ci 14268c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_fepll125_clk = { 14278c2ecf20Sopenharmony_ci .fixed_div = 32, 14288c2ecf20Sopenharmony_ci .cdiv.clkr = { 14298c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 14308c2ecf20Sopenharmony_ci .name = "fepll125", 14318c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 14328c2ecf20Sopenharmony_ci "xo", 14338c2ecf20Sopenharmony_ci }, 14348c2ecf20Sopenharmony_ci .num_parents = 1, 14358c2ecf20Sopenharmony_ci .ops = &clk_fepll_div_ops, 14368c2ecf20Sopenharmony_ci }, 14378c2ecf20Sopenharmony_ci }, 14388c2ecf20Sopenharmony_ci .pll_vco = &gcc_fepll_vco, 14398c2ecf20Sopenharmony_ci}; 14408c2ecf20Sopenharmony_ci 14418c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_fepll125dly_clk = { 14428c2ecf20Sopenharmony_ci .fixed_div = 32, 14438c2ecf20Sopenharmony_ci .cdiv.clkr = { 14448c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 14458c2ecf20Sopenharmony_ci .name = "fepll125dly", 14468c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 14478c2ecf20Sopenharmony_ci "xo", 14488c2ecf20Sopenharmony_ci }, 14498c2ecf20Sopenharmony_ci .num_parents = 1, 14508c2ecf20Sopenharmony_ci .ops = &clk_fepll_div_ops, 14518c2ecf20Sopenharmony_ci }, 14528c2ecf20Sopenharmony_ci }, 14538c2ecf20Sopenharmony_ci .pll_vco = &gcc_fepll_vco, 14548c2ecf20Sopenharmony_ci}; 14558c2ecf20Sopenharmony_ci 14568c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_fepll200_clk = { 14578c2ecf20Sopenharmony_ci .fixed_div = 20, 14588c2ecf20Sopenharmony_ci .cdiv.clkr = { 14598c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 14608c2ecf20Sopenharmony_ci .name = "fepll200", 14618c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 14628c2ecf20Sopenharmony_ci "xo", 14638c2ecf20Sopenharmony_ci }, 14648c2ecf20Sopenharmony_ci .num_parents = 1, 14658c2ecf20Sopenharmony_ci .ops = &clk_fepll_div_ops, 14668c2ecf20Sopenharmony_ci }, 14678c2ecf20Sopenharmony_ci }, 14688c2ecf20Sopenharmony_ci .pll_vco = &gcc_fepll_vco, 14698c2ecf20Sopenharmony_ci}; 14708c2ecf20Sopenharmony_ci 14718c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_fepll500_clk = { 14728c2ecf20Sopenharmony_ci .fixed_div = 8, 14738c2ecf20Sopenharmony_ci .cdiv.clkr = { 14748c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 14758c2ecf20Sopenharmony_ci .name = "fepll500", 14768c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 14778c2ecf20Sopenharmony_ci "xo", 14788c2ecf20Sopenharmony_ci }, 14798c2ecf20Sopenharmony_ci .num_parents = 1, 14808c2ecf20Sopenharmony_ci .ops = &clk_fepll_div_ops, 14818c2ecf20Sopenharmony_ci }, 14828c2ecf20Sopenharmony_ci }, 14838c2ecf20Sopenharmony_ci .pll_vco = &gcc_fepll_vco, 14848c2ecf20Sopenharmony_ci}; 14858c2ecf20Sopenharmony_ci 14868c2ecf20Sopenharmony_cistatic const struct clk_div_table fepllwcss_clk_div_table[] = { 14878c2ecf20Sopenharmony_ci { 0, 15 }, 14888c2ecf20Sopenharmony_ci { 1, 16 }, 14898c2ecf20Sopenharmony_ci { 2, 18 }, 14908c2ecf20Sopenharmony_ci { 3, 20 }, 14918c2ecf20Sopenharmony_ci { }, 14928c2ecf20Sopenharmony_ci}; 14938c2ecf20Sopenharmony_ci 14948c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_fepllwcss2g_clk = { 14958c2ecf20Sopenharmony_ci .cdiv.reg = 0x2f020, 14968c2ecf20Sopenharmony_ci .cdiv.shift = 8, 14978c2ecf20Sopenharmony_ci .cdiv.width = 2, 14988c2ecf20Sopenharmony_ci .cdiv.clkr = { 14998c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 15008c2ecf20Sopenharmony_ci .name = "fepllwcss2g", 15018c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 15028c2ecf20Sopenharmony_ci "xo", 15038c2ecf20Sopenharmony_ci }, 15048c2ecf20Sopenharmony_ci .num_parents = 1, 15058c2ecf20Sopenharmony_ci .ops = &clk_fepll_div_ops, 15068c2ecf20Sopenharmony_ci }, 15078c2ecf20Sopenharmony_ci }, 15088c2ecf20Sopenharmony_ci .div_table = fepllwcss_clk_div_table, 15098c2ecf20Sopenharmony_ci .pll_vco = &gcc_fepll_vco, 15108c2ecf20Sopenharmony_ci}; 15118c2ecf20Sopenharmony_ci 15128c2ecf20Sopenharmony_cistatic struct clk_fepll gcc_fepllwcss5g_clk = { 15138c2ecf20Sopenharmony_ci .cdiv.reg = 0x2f020, 15148c2ecf20Sopenharmony_ci .cdiv.shift = 12, 15158c2ecf20Sopenharmony_ci .cdiv.width = 2, 15168c2ecf20Sopenharmony_ci .cdiv.clkr = { 15178c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 15188c2ecf20Sopenharmony_ci .name = "fepllwcss5g", 15198c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 15208c2ecf20Sopenharmony_ci "xo", 15218c2ecf20Sopenharmony_ci }, 15228c2ecf20Sopenharmony_ci .num_parents = 1, 15238c2ecf20Sopenharmony_ci .ops = &clk_fepll_div_ops, 15248c2ecf20Sopenharmony_ci }, 15258c2ecf20Sopenharmony_ci }, 15268c2ecf20Sopenharmony_ci .div_table = fepllwcss_clk_div_table, 15278c2ecf20Sopenharmony_ci .pll_vco = &gcc_fepll_vco, 15288c2ecf20Sopenharmony_ci}; 15298c2ecf20Sopenharmony_ci 15308c2ecf20Sopenharmony_cistatic const struct freq_tbl ftbl_gcc_pcnoc_ahb_clk[] = { 15318c2ecf20Sopenharmony_ci F(48000000, P_XO, 1, 0, 0), 15328c2ecf20Sopenharmony_ci F(100000000, P_FEPLL200, 2, 0, 0), 15338c2ecf20Sopenharmony_ci { } 15348c2ecf20Sopenharmony_ci}; 15358c2ecf20Sopenharmony_ci 15368c2ecf20Sopenharmony_cistatic struct clk_rcg2 gcc_pcnoc_ahb_clk_src = { 15378c2ecf20Sopenharmony_ci .cmd_rcgr = 0x21024, 15388c2ecf20Sopenharmony_ci .hid_width = 5, 15398c2ecf20Sopenharmony_ci .parent_map = gcc_xo_200_500_map, 15408c2ecf20Sopenharmony_ci .freq_tbl = ftbl_gcc_pcnoc_ahb_clk, 15418c2ecf20Sopenharmony_ci .clkr.hw.init = &(struct clk_init_data){ 15428c2ecf20Sopenharmony_ci .name = "gcc_pcnoc_ahb_clk_src", 15438c2ecf20Sopenharmony_ci .parent_names = gcc_xo_200_500, 15448c2ecf20Sopenharmony_ci .num_parents = 3, 15458c2ecf20Sopenharmony_ci .ops = &clk_rcg2_ops, 15468c2ecf20Sopenharmony_ci }, 15478c2ecf20Sopenharmony_ci}; 15488c2ecf20Sopenharmony_ci 15498c2ecf20Sopenharmony_cistatic struct clk_branch pcnoc_clk_src = { 15508c2ecf20Sopenharmony_ci .halt_reg = 0x21030, 15518c2ecf20Sopenharmony_ci .clkr = { 15528c2ecf20Sopenharmony_ci .enable_reg = 0x21030, 15538c2ecf20Sopenharmony_ci .enable_mask = BIT(0), 15548c2ecf20Sopenharmony_ci .hw.init = &(struct clk_init_data){ 15558c2ecf20Sopenharmony_ci .name = "pcnoc_clk_src", 15568c2ecf20Sopenharmony_ci .parent_names = (const char *[]){ 15578c2ecf20Sopenharmony_ci "gcc_pcnoc_ahb_clk_src", 15588c2ecf20Sopenharmony_ci }, 15598c2ecf20Sopenharmony_ci .num_parents = 1, 15608c2ecf20Sopenharmony_ci .ops = &clk_branch2_ops, 15618c2ecf20Sopenharmony_ci .flags = CLK_SET_RATE_PARENT | 15628c2ecf20Sopenharmony_ci CLK_IS_CRITICAL, 15638c2ecf20Sopenharmony_ci }, 15648c2ecf20Sopenharmony_ci }, 15658c2ecf20Sopenharmony_ci}; 15668c2ecf20Sopenharmony_ci 15678c2ecf20Sopenharmony_cistatic struct clk_regmap *gcc_ipq4019_clocks[] = { 15688c2ecf20Sopenharmony_ci [AUDIO_CLK_SRC] = &audio_clk_src.clkr, 15698c2ecf20Sopenharmony_ci [BLSP1_QUP1_I2C_APPS_CLK_SRC] = &blsp1_qup1_i2c_apps_clk_src.clkr, 15708c2ecf20Sopenharmony_ci [BLSP1_QUP1_SPI_APPS_CLK_SRC] = &blsp1_qup1_spi_apps_clk_src.clkr, 15718c2ecf20Sopenharmony_ci [BLSP1_QUP2_I2C_APPS_CLK_SRC] = &blsp1_qup2_i2c_apps_clk_src.clkr, 15728c2ecf20Sopenharmony_ci [BLSP1_QUP2_SPI_APPS_CLK_SRC] = &blsp1_qup2_spi_apps_clk_src.clkr, 15738c2ecf20Sopenharmony_ci [BLSP1_UART1_APPS_CLK_SRC] = &blsp1_uart1_apps_clk_src.clkr, 15748c2ecf20Sopenharmony_ci [BLSP1_UART2_APPS_CLK_SRC] = &blsp1_uart2_apps_clk_src.clkr, 15758c2ecf20Sopenharmony_ci [GCC_USB3_MOCK_UTMI_CLK_SRC] = &usb30_mock_utmi_clk_src.clkr, 15768c2ecf20Sopenharmony_ci [GCC_APPS_CLK_SRC] = &apps_clk_src.clkr, 15778c2ecf20Sopenharmony_ci [GCC_APPS_AHB_CLK_SRC] = &apps_ahb_clk_src.clkr, 15788c2ecf20Sopenharmony_ci [GP1_CLK_SRC] = &gp1_clk_src.clkr, 15798c2ecf20Sopenharmony_ci [GP2_CLK_SRC] = &gp2_clk_src.clkr, 15808c2ecf20Sopenharmony_ci [GP3_CLK_SRC] = &gp3_clk_src.clkr, 15818c2ecf20Sopenharmony_ci [SDCC1_APPS_CLK_SRC] = &sdcc1_apps_clk_src.clkr, 15828c2ecf20Sopenharmony_ci [FEPHY_125M_DLY_CLK_SRC] = &fephy_125m_dly_clk_src.clkr, 15838c2ecf20Sopenharmony_ci [WCSS2G_CLK_SRC] = &wcss2g_clk_src.clkr, 15848c2ecf20Sopenharmony_ci [WCSS5G_CLK_SRC] = &wcss5g_clk_src.clkr, 15858c2ecf20Sopenharmony_ci [GCC_APSS_AHB_CLK] = &gcc_apss_ahb_clk.clkr, 15868c2ecf20Sopenharmony_ci [GCC_AUDIO_AHB_CLK] = &gcc_audio_ahb_clk.clkr, 15878c2ecf20Sopenharmony_ci [GCC_AUDIO_PWM_CLK] = &gcc_audio_pwm_clk.clkr, 15888c2ecf20Sopenharmony_ci [GCC_BLSP1_AHB_CLK] = &gcc_blsp1_ahb_clk.clkr, 15898c2ecf20Sopenharmony_ci [GCC_BLSP1_QUP1_I2C_APPS_CLK] = &gcc_blsp1_qup1_i2c_apps_clk.clkr, 15908c2ecf20Sopenharmony_ci [GCC_BLSP1_QUP1_SPI_APPS_CLK] = &gcc_blsp1_qup1_spi_apps_clk.clkr, 15918c2ecf20Sopenharmony_ci [GCC_BLSP1_QUP2_I2C_APPS_CLK] = &gcc_blsp1_qup2_i2c_apps_clk.clkr, 15928c2ecf20Sopenharmony_ci [GCC_BLSP1_QUP2_SPI_APPS_CLK] = &gcc_blsp1_qup2_spi_apps_clk.clkr, 15938c2ecf20Sopenharmony_ci [GCC_BLSP1_UART1_APPS_CLK] = &gcc_blsp1_uart1_apps_clk.clkr, 15948c2ecf20Sopenharmony_ci [GCC_BLSP1_UART2_APPS_CLK] = &gcc_blsp1_uart2_apps_clk.clkr, 15958c2ecf20Sopenharmony_ci [GCC_DCD_XO_CLK] = &gcc_dcd_xo_clk.clkr, 15968c2ecf20Sopenharmony_ci [GCC_GP1_CLK] = &gcc_gp1_clk.clkr, 15978c2ecf20Sopenharmony_ci [GCC_GP2_CLK] = &gcc_gp2_clk.clkr, 15988c2ecf20Sopenharmony_ci [GCC_GP3_CLK] = &gcc_gp3_clk.clkr, 15998c2ecf20Sopenharmony_ci [GCC_BOOT_ROM_AHB_CLK] = &gcc_boot_rom_ahb_clk.clkr, 16008c2ecf20Sopenharmony_ci [GCC_CRYPTO_AHB_CLK] = &gcc_crypto_ahb_clk.clkr, 16018c2ecf20Sopenharmony_ci [GCC_CRYPTO_AXI_CLK] = &gcc_crypto_axi_clk.clkr, 16028c2ecf20Sopenharmony_ci [GCC_CRYPTO_CLK] = &gcc_crypto_clk.clkr, 16038c2ecf20Sopenharmony_ci [GCC_ESS_CLK] = &gcc_ess_clk.clkr, 16048c2ecf20Sopenharmony_ci [GCC_IMEM_AXI_CLK] = &gcc_imem_axi_clk.clkr, 16058c2ecf20Sopenharmony_ci [GCC_IMEM_CFG_AHB_CLK] = &gcc_imem_cfg_ahb_clk.clkr, 16068c2ecf20Sopenharmony_ci [GCC_PCIE_AHB_CLK] = &gcc_pcie_ahb_clk.clkr, 16078c2ecf20Sopenharmony_ci [GCC_PCIE_AXI_M_CLK] = &gcc_pcie_axi_m_clk.clkr, 16088c2ecf20Sopenharmony_ci [GCC_PCIE_AXI_S_CLK] = &gcc_pcie_axi_s_clk.clkr, 16098c2ecf20Sopenharmony_ci [GCC_PRNG_AHB_CLK] = &gcc_prng_ahb_clk.clkr, 16108c2ecf20Sopenharmony_ci [GCC_QPIC_AHB_CLK] = &gcc_qpic_ahb_clk.clkr, 16118c2ecf20Sopenharmony_ci [GCC_QPIC_CLK] = &gcc_qpic_clk.clkr, 16128c2ecf20Sopenharmony_ci [GCC_SDCC1_AHB_CLK] = &gcc_sdcc1_ahb_clk.clkr, 16138c2ecf20Sopenharmony_ci [GCC_SDCC1_APPS_CLK] = &gcc_sdcc1_apps_clk.clkr, 16148c2ecf20Sopenharmony_ci [GCC_TLMM_AHB_CLK] = &gcc_tlmm_ahb_clk.clkr, 16158c2ecf20Sopenharmony_ci [GCC_USB2_MASTER_CLK] = &gcc_usb2_master_clk.clkr, 16168c2ecf20Sopenharmony_ci [GCC_USB2_SLEEP_CLK] = &gcc_usb2_sleep_clk.clkr, 16178c2ecf20Sopenharmony_ci [GCC_USB2_MOCK_UTMI_CLK] = &gcc_usb2_mock_utmi_clk.clkr, 16188c2ecf20Sopenharmony_ci [GCC_USB3_MASTER_CLK] = &gcc_usb3_master_clk.clkr, 16198c2ecf20Sopenharmony_ci [GCC_USB3_SLEEP_CLK] = &gcc_usb3_sleep_clk.clkr, 16208c2ecf20Sopenharmony_ci [GCC_USB3_MOCK_UTMI_CLK] = &gcc_usb3_mock_utmi_clk.clkr, 16218c2ecf20Sopenharmony_ci [GCC_WCSS2G_CLK] = &gcc_wcss2g_clk.clkr, 16228c2ecf20Sopenharmony_ci [GCC_WCSS2G_REF_CLK] = &gcc_wcss2g_ref_clk.clkr, 16238c2ecf20Sopenharmony_ci [GCC_WCSS2G_RTC_CLK] = &gcc_wcss2g_rtc_clk.clkr, 16248c2ecf20Sopenharmony_ci [GCC_WCSS5G_CLK] = &gcc_wcss5g_clk.clkr, 16258c2ecf20Sopenharmony_ci [GCC_WCSS5G_REF_CLK] = &gcc_wcss5g_ref_clk.clkr, 16268c2ecf20Sopenharmony_ci [GCC_WCSS5G_RTC_CLK] = &gcc_wcss5g_rtc_clk.clkr, 16278c2ecf20Sopenharmony_ci [GCC_SDCC_PLLDIV_CLK] = &gcc_apss_sdcc_clk.cdiv.clkr, 16288c2ecf20Sopenharmony_ci [GCC_FEPLL125_CLK] = &gcc_fepll125_clk.cdiv.clkr, 16298c2ecf20Sopenharmony_ci [GCC_FEPLL125DLY_CLK] = &gcc_fepll125dly_clk.cdiv.clkr, 16308c2ecf20Sopenharmony_ci [GCC_FEPLL200_CLK] = &gcc_fepll200_clk.cdiv.clkr, 16318c2ecf20Sopenharmony_ci [GCC_FEPLL500_CLK] = &gcc_fepll500_clk.cdiv.clkr, 16328c2ecf20Sopenharmony_ci [GCC_FEPLL_WCSS2G_CLK] = &gcc_fepllwcss2g_clk.cdiv.clkr, 16338c2ecf20Sopenharmony_ci [GCC_FEPLL_WCSS5G_CLK] = &gcc_fepllwcss5g_clk.cdiv.clkr, 16348c2ecf20Sopenharmony_ci [GCC_APSS_CPU_PLLDIV_CLK] = &gcc_apss_cpu_plldiv_clk.cdiv.clkr, 16358c2ecf20Sopenharmony_ci [GCC_PCNOC_AHB_CLK_SRC] = &gcc_pcnoc_ahb_clk_src.clkr, 16368c2ecf20Sopenharmony_ci [GCC_PCNOC_AHB_CLK] = &pcnoc_clk_src.clkr, 16378c2ecf20Sopenharmony_ci}; 16388c2ecf20Sopenharmony_ci 16398c2ecf20Sopenharmony_cistatic const struct qcom_reset_map gcc_ipq4019_resets[] = { 16408c2ecf20Sopenharmony_ci [WIFI0_CPU_INIT_RESET] = { 0x1f008, 5 }, 16418c2ecf20Sopenharmony_ci [WIFI0_RADIO_SRIF_RESET] = { 0x1f008, 4 }, 16428c2ecf20Sopenharmony_ci [WIFI0_RADIO_WARM_RESET] = { 0x1f008, 3 }, 16438c2ecf20Sopenharmony_ci [WIFI0_RADIO_COLD_RESET] = { 0x1f008, 2 }, 16448c2ecf20Sopenharmony_ci [WIFI0_CORE_WARM_RESET] = { 0x1f008, 1 }, 16458c2ecf20Sopenharmony_ci [WIFI0_CORE_COLD_RESET] = { 0x1f008, 0 }, 16468c2ecf20Sopenharmony_ci [WIFI1_CPU_INIT_RESET] = { 0x20008, 5 }, 16478c2ecf20Sopenharmony_ci [WIFI1_RADIO_SRIF_RESET] = { 0x20008, 4 }, 16488c2ecf20Sopenharmony_ci [WIFI1_RADIO_WARM_RESET] = { 0x20008, 3 }, 16498c2ecf20Sopenharmony_ci [WIFI1_RADIO_COLD_RESET] = { 0x20008, 2 }, 16508c2ecf20Sopenharmony_ci [WIFI1_CORE_WARM_RESET] = { 0x20008, 1 }, 16518c2ecf20Sopenharmony_ci [WIFI1_CORE_COLD_RESET] = { 0x20008, 0 }, 16528c2ecf20Sopenharmony_ci [USB3_UNIPHY_PHY_ARES] = { 0x1e038, 5 }, 16538c2ecf20Sopenharmony_ci [USB3_HSPHY_POR_ARES] = { 0x1e038, 4 }, 16548c2ecf20Sopenharmony_ci [USB3_HSPHY_S_ARES] = { 0x1e038, 2 }, 16558c2ecf20Sopenharmony_ci [USB2_HSPHY_POR_ARES] = { 0x1e01c, 4 }, 16568c2ecf20Sopenharmony_ci [USB2_HSPHY_S_ARES] = { 0x1e01c, 2 }, 16578c2ecf20Sopenharmony_ci [PCIE_PHY_AHB_ARES] = { 0x1d010, 11 }, 16588c2ecf20Sopenharmony_ci [PCIE_AHB_ARES] = { 0x1d010, 10 }, 16598c2ecf20Sopenharmony_ci [PCIE_PWR_ARES] = { 0x1d010, 9 }, 16608c2ecf20Sopenharmony_ci [PCIE_PIPE_STICKY_ARES] = { 0x1d010, 8 }, 16618c2ecf20Sopenharmony_ci [PCIE_AXI_M_STICKY_ARES] = { 0x1d010, 7 }, 16628c2ecf20Sopenharmony_ci [PCIE_PHY_ARES] = { 0x1d010, 6 }, 16638c2ecf20Sopenharmony_ci [PCIE_PARF_XPU_ARES] = { 0x1d010, 5 }, 16648c2ecf20Sopenharmony_ci [PCIE_AXI_S_XPU_ARES] = { 0x1d010, 4 }, 16658c2ecf20Sopenharmony_ci [PCIE_AXI_M_VMIDMT_ARES] = { 0x1d010, 3 }, 16668c2ecf20Sopenharmony_ci [PCIE_PIPE_ARES] = { 0x1d010, 2 }, 16678c2ecf20Sopenharmony_ci [PCIE_AXI_S_ARES] = { 0x1d010, 1 }, 16688c2ecf20Sopenharmony_ci [PCIE_AXI_M_ARES] = { 0x1d010, 0 }, 16698c2ecf20Sopenharmony_ci [ESS_RESET] = { 0x12008, 0}, 16708c2ecf20Sopenharmony_ci [GCC_BLSP1_BCR] = {0x01000, 0}, 16718c2ecf20Sopenharmony_ci [GCC_BLSP1_QUP1_BCR] = {0x02000, 0}, 16728c2ecf20Sopenharmony_ci [GCC_BLSP1_UART1_BCR] = {0x02038, 0}, 16738c2ecf20Sopenharmony_ci [GCC_BLSP1_QUP2_BCR] = {0x03008, 0}, 16748c2ecf20Sopenharmony_ci [GCC_BLSP1_UART2_BCR] = {0x03028, 0}, 16758c2ecf20Sopenharmony_ci [GCC_BIMC_BCR] = {0x04000, 0}, 16768c2ecf20Sopenharmony_ci [GCC_TLMM_BCR] = {0x05000, 0}, 16778c2ecf20Sopenharmony_ci [GCC_IMEM_BCR] = {0x0E000, 0}, 16788c2ecf20Sopenharmony_ci [GCC_ESS_BCR] = {0x12008, 0}, 16798c2ecf20Sopenharmony_ci [GCC_PRNG_BCR] = {0x13000, 0}, 16808c2ecf20Sopenharmony_ci [GCC_BOOT_ROM_BCR] = {0x13008, 0}, 16818c2ecf20Sopenharmony_ci [GCC_CRYPTO_BCR] = {0x16000, 0}, 16828c2ecf20Sopenharmony_ci [GCC_SDCC1_BCR] = {0x18000, 0}, 16838c2ecf20Sopenharmony_ci [GCC_SEC_CTRL_BCR] = {0x1A000, 0}, 16848c2ecf20Sopenharmony_ci [GCC_AUDIO_BCR] = {0x1B008, 0}, 16858c2ecf20Sopenharmony_ci [GCC_QPIC_BCR] = {0x1C000, 0}, 16868c2ecf20Sopenharmony_ci [GCC_PCIE_BCR] = {0x1D000, 0}, 16878c2ecf20Sopenharmony_ci [GCC_USB2_BCR] = {0x1E008, 0}, 16888c2ecf20Sopenharmony_ci [GCC_USB2_PHY_BCR] = {0x1E018, 0}, 16898c2ecf20Sopenharmony_ci [GCC_USB3_BCR] = {0x1E024, 0}, 16908c2ecf20Sopenharmony_ci [GCC_USB3_PHY_BCR] = {0x1E034, 0}, 16918c2ecf20Sopenharmony_ci [GCC_SYSTEM_NOC_BCR] = {0x21000, 0}, 16928c2ecf20Sopenharmony_ci [GCC_PCNOC_BCR] = {0x2102C, 0}, 16938c2ecf20Sopenharmony_ci [GCC_DCD_BCR] = {0x21038, 0}, 16948c2ecf20Sopenharmony_ci [GCC_SNOC_BUS_TIMEOUT0_BCR] = {0x21064, 0}, 16958c2ecf20Sopenharmony_ci [GCC_SNOC_BUS_TIMEOUT1_BCR] = {0x2106C, 0}, 16968c2ecf20Sopenharmony_ci [GCC_SNOC_BUS_TIMEOUT2_BCR] = {0x21074, 0}, 16978c2ecf20Sopenharmony_ci [GCC_SNOC_BUS_TIMEOUT3_BCR] = {0x2107C, 0}, 16988c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT0_BCR] = {0x21084, 0}, 16998c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT1_BCR] = {0x2108C, 0}, 17008c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT2_BCR] = {0x21094, 0}, 17018c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT3_BCR] = {0x2109C, 0}, 17028c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT4_BCR] = {0x210A4, 0}, 17038c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT5_BCR] = {0x210AC, 0}, 17048c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT6_BCR] = {0x210B4, 0}, 17058c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT7_BCR] = {0x210BC, 0}, 17068c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT8_BCR] = {0x210C4, 0}, 17078c2ecf20Sopenharmony_ci [GCC_PCNOC_BUS_TIMEOUT9_BCR] = {0x210CC, 0}, 17088c2ecf20Sopenharmony_ci [GCC_TCSR_BCR] = {0x22000, 0}, 17098c2ecf20Sopenharmony_ci [GCC_MPM_BCR] = {0x24000, 0}, 17108c2ecf20Sopenharmony_ci [GCC_SPDM_BCR] = {0x25000, 0}, 17118c2ecf20Sopenharmony_ci}; 17128c2ecf20Sopenharmony_ci 17138c2ecf20Sopenharmony_cistatic const struct regmap_config gcc_ipq4019_regmap_config = { 17148c2ecf20Sopenharmony_ci .reg_bits = 32, 17158c2ecf20Sopenharmony_ci .reg_stride = 4, 17168c2ecf20Sopenharmony_ci .val_bits = 32, 17178c2ecf20Sopenharmony_ci .max_register = 0x2ffff, 17188c2ecf20Sopenharmony_ci .fast_io = true, 17198c2ecf20Sopenharmony_ci}; 17208c2ecf20Sopenharmony_ci 17218c2ecf20Sopenharmony_cistatic const struct qcom_cc_desc gcc_ipq4019_desc = { 17228c2ecf20Sopenharmony_ci .config = &gcc_ipq4019_regmap_config, 17238c2ecf20Sopenharmony_ci .clks = gcc_ipq4019_clocks, 17248c2ecf20Sopenharmony_ci .num_clks = ARRAY_SIZE(gcc_ipq4019_clocks), 17258c2ecf20Sopenharmony_ci .resets = gcc_ipq4019_resets, 17268c2ecf20Sopenharmony_ci .num_resets = ARRAY_SIZE(gcc_ipq4019_resets), 17278c2ecf20Sopenharmony_ci}; 17288c2ecf20Sopenharmony_ci 17298c2ecf20Sopenharmony_cistatic const struct of_device_id gcc_ipq4019_match_table[] = { 17308c2ecf20Sopenharmony_ci { .compatible = "qcom,gcc-ipq4019" }, 17318c2ecf20Sopenharmony_ci { } 17328c2ecf20Sopenharmony_ci}; 17338c2ecf20Sopenharmony_ciMODULE_DEVICE_TABLE(of, gcc_ipq4019_match_table); 17348c2ecf20Sopenharmony_ci 17358c2ecf20Sopenharmony_cistatic int 17368c2ecf20Sopenharmony_cigcc_ipq4019_cpu_clk_notifier_fn(struct notifier_block *nb, 17378c2ecf20Sopenharmony_ci unsigned long action, void *data) 17388c2ecf20Sopenharmony_ci{ 17398c2ecf20Sopenharmony_ci int err = 0; 17408c2ecf20Sopenharmony_ci 17418c2ecf20Sopenharmony_ci if (action == PRE_RATE_CHANGE) 17428c2ecf20Sopenharmony_ci err = clk_rcg2_ops.set_parent(&apps_clk_src.clkr.hw, 17438c2ecf20Sopenharmony_ci gcc_ipq4019_cpu_safe_parent); 17448c2ecf20Sopenharmony_ci 17458c2ecf20Sopenharmony_ci return notifier_from_errno(err); 17468c2ecf20Sopenharmony_ci} 17478c2ecf20Sopenharmony_ci 17488c2ecf20Sopenharmony_cistatic struct notifier_block gcc_ipq4019_cpu_clk_notifier = { 17498c2ecf20Sopenharmony_ci .notifier_call = gcc_ipq4019_cpu_clk_notifier_fn, 17508c2ecf20Sopenharmony_ci}; 17518c2ecf20Sopenharmony_ci 17528c2ecf20Sopenharmony_cistatic int gcc_ipq4019_probe(struct platform_device *pdev) 17538c2ecf20Sopenharmony_ci{ 17548c2ecf20Sopenharmony_ci int err; 17558c2ecf20Sopenharmony_ci 17568c2ecf20Sopenharmony_ci err = qcom_cc_probe(pdev, &gcc_ipq4019_desc); 17578c2ecf20Sopenharmony_ci if (err) 17588c2ecf20Sopenharmony_ci return err; 17598c2ecf20Sopenharmony_ci 17608c2ecf20Sopenharmony_ci return clk_notifier_register(apps_clk_src.clkr.hw.clk, 17618c2ecf20Sopenharmony_ci &gcc_ipq4019_cpu_clk_notifier); 17628c2ecf20Sopenharmony_ci} 17638c2ecf20Sopenharmony_ci 17648c2ecf20Sopenharmony_cistatic int gcc_ipq4019_remove(struct platform_device *pdev) 17658c2ecf20Sopenharmony_ci{ 17668c2ecf20Sopenharmony_ci return clk_notifier_unregister(apps_clk_src.clkr.hw.clk, 17678c2ecf20Sopenharmony_ci &gcc_ipq4019_cpu_clk_notifier); 17688c2ecf20Sopenharmony_ci} 17698c2ecf20Sopenharmony_ci 17708c2ecf20Sopenharmony_cistatic struct platform_driver gcc_ipq4019_driver = { 17718c2ecf20Sopenharmony_ci .probe = gcc_ipq4019_probe, 17728c2ecf20Sopenharmony_ci .remove = gcc_ipq4019_remove, 17738c2ecf20Sopenharmony_ci .driver = { 17748c2ecf20Sopenharmony_ci .name = "qcom,gcc-ipq4019", 17758c2ecf20Sopenharmony_ci .of_match_table = gcc_ipq4019_match_table, 17768c2ecf20Sopenharmony_ci }, 17778c2ecf20Sopenharmony_ci}; 17788c2ecf20Sopenharmony_ci 17798c2ecf20Sopenharmony_cistatic int __init gcc_ipq4019_init(void) 17808c2ecf20Sopenharmony_ci{ 17818c2ecf20Sopenharmony_ci return platform_driver_register(&gcc_ipq4019_driver); 17828c2ecf20Sopenharmony_ci} 17838c2ecf20Sopenharmony_cicore_initcall(gcc_ipq4019_init); 17848c2ecf20Sopenharmony_ci 17858c2ecf20Sopenharmony_cistatic void __exit gcc_ipq4019_exit(void) 17868c2ecf20Sopenharmony_ci{ 17878c2ecf20Sopenharmony_ci platform_driver_unregister(&gcc_ipq4019_driver); 17888c2ecf20Sopenharmony_ci} 17898c2ecf20Sopenharmony_cimodule_exit(gcc_ipq4019_exit); 17908c2ecf20Sopenharmony_ci 17918c2ecf20Sopenharmony_ciMODULE_ALIAS("platform:gcc-ipq4019"); 17928c2ecf20Sopenharmony_ciMODULE_LICENSE("GPL v2"); 17938c2ecf20Sopenharmony_ciMODULE_DESCRIPTION("QCOM GCC IPQ4019 driver"); 1794