| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2015, The Linux Foundation. All rights reserved. |
|---|
| 3 | | - * |
|---|
| 4 | | - * This software is licensed under the terms of the GNU General Public |
|---|
| 5 | | - * License version 2, as published by the Free Software Foundation, and |
|---|
| 6 | | - * may be copied, distributed, and modified under those terms. |
|---|
| 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 | 4 | */ |
|---|
| 13 | 5 | |
|---|
| 14 | 6 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 221 | 213 | .parent_names = (const char *[]){ "gpll0_early" }, |
|---|
| 222 | 214 | .num_parents = 1, |
|---|
| 223 | 215 | .ops = &clk_alpha_pll_postdiv_ops, |
|---|
| 216 | + }, |
|---|
| 217 | +}; |
|---|
| 218 | + |
|---|
| 219 | +static struct clk_branch gcc_mmss_gpll0_div_clk = { |
|---|
| 220 | + .halt_check = BRANCH_HALT_DELAY, |
|---|
| 221 | + .clkr = { |
|---|
| 222 | + .enable_reg = 0x5200c, |
|---|
| 223 | + .enable_mask = BIT(0), |
|---|
| 224 | + .hw.init = &(struct clk_init_data){ |
|---|
| 225 | + .name = "gcc_mmss_gpll0_div_clk", |
|---|
| 226 | + .parent_names = (const char *[]){ "gpll0" }, |
|---|
| 227 | + .num_parents = 1, |
|---|
| 228 | + .flags = CLK_SET_RATE_PARENT, |
|---|
| 229 | + .ops = &clk_branch2_ops, |
|---|
| 230 | + }, |
|---|
| 231 | + }, |
|---|
| 232 | +}; |
|---|
| 233 | + |
|---|
| 234 | +static struct clk_branch gcc_mss_gpll0_div_clk = { |
|---|
| 235 | + .halt_check = BRANCH_HALT_DELAY, |
|---|
| 236 | + .clkr = { |
|---|
| 237 | + .enable_reg = 0x5200c, |
|---|
| 238 | + .enable_mask = BIT(2), |
|---|
| 239 | + .hw.init = &(struct clk_init_data){ |
|---|
| 240 | + .name = "gcc_mss_gpll0_div_clk", |
|---|
| 241 | + .parent_names = (const char *[]){ "gpll0" }, |
|---|
| 242 | + .num_parents = 1, |
|---|
| 243 | + .flags = CLK_SET_RATE_PARENT, |
|---|
| 244 | + .ops = &clk_branch2_ops |
|---|
| 245 | + }, |
|---|
| 224 | 246 | }, |
|---|
| 225 | 247 | }; |
|---|
| 226 | 248 | |
|---|
| .. | .. |
|---|
| 2945 | 2967 | }, |
|---|
| 2946 | 2968 | }; |
|---|
| 2947 | 2969 | |
|---|
| 2970 | +static struct clk_branch gcc_dcc_ahb_clk = { |
|---|
| 2971 | + .halt_reg = 0x84004, |
|---|
| 2972 | + .clkr = { |
|---|
| 2973 | + .enable_reg = 0x84004, |
|---|
| 2974 | + .enable_mask = BIT(0), |
|---|
| 2975 | + .hw.init = &(struct clk_init_data){ |
|---|
| 2976 | + .name = "gcc_dcc_ahb_clk", |
|---|
| 2977 | + .parent_names = (const char *[]){ "config_noc_clk_src" }, |
|---|
| 2978 | + .num_parents = 1, |
|---|
| 2979 | + .ops = &clk_branch2_ops, |
|---|
| 2980 | + }, |
|---|
| 2981 | + }, |
|---|
| 2982 | +}; |
|---|
| 2983 | + |
|---|
| 2984 | +static struct clk_branch gcc_aggre0_noc_mpu_cfg_ahb_clk = { |
|---|
| 2985 | + .halt_reg = 0x85000, |
|---|
| 2986 | + .clkr = { |
|---|
| 2987 | + .enable_reg = 0x85000, |
|---|
| 2988 | + .enable_mask = BIT(0), |
|---|
| 2989 | + .hw.init = &(struct clk_init_data){ |
|---|
| 2990 | + .name = "gcc_aggre0_noc_mpu_cfg_ahb_clk", |
|---|
| 2991 | + .parent_names = (const char *[]){ "config_noc_clk_src" }, |
|---|
| 2992 | + .num_parents = 1, |
|---|
| 2993 | + .ops = &clk_branch2_ops, |
|---|
| 2994 | + }, |
|---|
| 2995 | + }, |
|---|
| 2996 | +}; |
|---|
| 2997 | + |
|---|
| 2948 | 2998 | static struct clk_branch gcc_qspi_ahb_clk = { |
|---|
| 2949 | 2999 | .halt_reg = 0x8b004, |
|---|
| 2950 | 3000 | .clkr = { |
|---|
| .. | .. |
|---|
| 2982 | 3032 | .enable_mask = BIT(0), |
|---|
| 2983 | 3033 | .hw.init = &(struct clk_init_data){ |
|---|
| 2984 | 3034 | .name = "gcc_usb3_clkref_clk", |
|---|
| 2985 | | - .parent_names = (const char *[]){ "xo" }, |
|---|
| 3035 | + .parent_data = &(const struct clk_parent_data){ |
|---|
| 3036 | + .fw_name = "cxo2", |
|---|
| 3037 | + .name = "xo", |
|---|
| 3038 | + }, |
|---|
| 2986 | 3039 | .num_parents = 1, |
|---|
| 2987 | 3040 | .ops = &clk_branch2_ops, |
|---|
| 2988 | 3041 | }, |
|---|
| .. | .. |
|---|
| 2996 | 3049 | .enable_mask = BIT(0), |
|---|
| 2997 | 3050 | .hw.init = &(struct clk_init_data){ |
|---|
| 2998 | 3051 | .name = "gcc_hdmi_clkref_clk", |
|---|
| 2999 | | - .parent_names = (const char *[]){ "xo" }, |
|---|
| 3052 | + .parent_data = &(const struct clk_parent_data){ |
|---|
| 3053 | + .fw_name = "cxo2", |
|---|
| 3054 | + .name = "xo", |
|---|
| 3055 | + }, |
|---|
| 3056 | + .num_parents = 1, |
|---|
| 3057 | + .ops = &clk_branch2_ops, |
|---|
| 3058 | + }, |
|---|
| 3059 | + }, |
|---|
| 3060 | +}; |
|---|
| 3061 | + |
|---|
| 3062 | +static struct clk_branch gcc_edp_clkref_clk = { |
|---|
| 3063 | + .halt_reg = 0x88004, |
|---|
| 3064 | + .clkr = { |
|---|
| 3065 | + .enable_reg = 0x88004, |
|---|
| 3066 | + .enable_mask = BIT(0), |
|---|
| 3067 | + .hw.init = &(struct clk_init_data){ |
|---|
| 3068 | + .name = "gcc_edp_clkref_clk", |
|---|
| 3069 | + .parent_data = &(const struct clk_parent_data){ |
|---|
| 3070 | + .fw_name = "cxo2", |
|---|
| 3071 | + .name = "xo", |
|---|
| 3072 | + }, |
|---|
| 3000 | 3073 | .num_parents = 1, |
|---|
| 3001 | 3074 | .ops = &clk_branch2_ops, |
|---|
| 3002 | 3075 | }, |
|---|
| .. | .. |
|---|
| 3010 | 3083 | .enable_mask = BIT(0), |
|---|
| 3011 | 3084 | .hw.init = &(struct clk_init_data){ |
|---|
| 3012 | 3085 | .name = "gcc_ufs_clkref_clk", |
|---|
| 3013 | | - .parent_names = (const char *[]){ "xo" }, |
|---|
| 3086 | + .parent_data = &(const struct clk_parent_data){ |
|---|
| 3087 | + .fw_name = "cxo2", |
|---|
| 3088 | + .name = "xo", |
|---|
| 3089 | + }, |
|---|
| 3014 | 3090 | .num_parents = 1, |
|---|
| 3015 | 3091 | .ops = &clk_branch2_ops, |
|---|
| 3016 | 3092 | }, |
|---|
| .. | .. |
|---|
| 3024 | 3100 | .enable_mask = BIT(0), |
|---|
| 3025 | 3101 | .hw.init = &(struct clk_init_data){ |
|---|
| 3026 | 3102 | .name = "gcc_pcie_clkref_clk", |
|---|
| 3027 | | - .parent_names = (const char *[]){ "xo" }, |
|---|
| 3103 | + .parent_data = &(const struct clk_parent_data){ |
|---|
| 3104 | + .fw_name = "cxo2", |
|---|
| 3105 | + .name = "xo", |
|---|
| 3106 | + }, |
|---|
| 3028 | 3107 | .num_parents = 1, |
|---|
| 3029 | 3108 | .ops = &clk_branch2_ops, |
|---|
| 3030 | 3109 | }, |
|---|
| .. | .. |
|---|
| 3038 | 3117 | .enable_mask = BIT(0), |
|---|
| 3039 | 3118 | .hw.init = &(struct clk_init_data){ |
|---|
| 3040 | 3119 | .name = "gcc_rx2_usb2_clkref_clk", |
|---|
| 3041 | | - .parent_names = (const char *[]){ "xo" }, |
|---|
| 3120 | + .parent_data = &(const struct clk_parent_data){ |
|---|
| 3121 | + .fw_name = "cxo2", |
|---|
| 3122 | + .name = "xo", |
|---|
| 3123 | + }, |
|---|
| 3042 | 3124 | .num_parents = 1, |
|---|
| 3043 | 3125 | .ops = &clk_branch2_ops, |
|---|
| 3044 | 3126 | }, |
|---|
| .. | .. |
|---|
| 3052 | 3134 | .enable_mask = BIT(0), |
|---|
| 3053 | 3135 | .hw.init = &(struct clk_init_data){ |
|---|
| 3054 | 3136 | .name = "gcc_rx1_usb2_clkref_clk", |
|---|
| 3055 | | - .parent_names = (const char *[]){ "xo" }, |
|---|
| 3137 | + .parent_data = &(const struct clk_parent_data){ |
|---|
| 3138 | + .fw_name = "cxo2", |
|---|
| 3139 | + .name = "xo", |
|---|
| 3140 | + }, |
|---|
| 3141 | + .num_parents = 1, |
|---|
| 3142 | + .ops = &clk_branch2_ops, |
|---|
| 3143 | + }, |
|---|
| 3144 | + }, |
|---|
| 3145 | +}; |
|---|
| 3146 | + |
|---|
| 3147 | +static struct clk_branch gcc_mss_cfg_ahb_clk = { |
|---|
| 3148 | + .halt_reg = 0x8a000, |
|---|
| 3149 | + .clkr = { |
|---|
| 3150 | + .enable_reg = 0x8a000, |
|---|
| 3151 | + .enable_mask = BIT(0), |
|---|
| 3152 | + .hw.init = &(struct clk_init_data){ |
|---|
| 3153 | + .name = "gcc_mss_cfg_ahb_clk", |
|---|
| 3154 | + .parent_names = (const char *[]){ "config_noc_clk_src" }, |
|---|
| 3155 | + .num_parents = 1, |
|---|
| 3156 | + .ops = &clk_branch2_ops, |
|---|
| 3157 | + }, |
|---|
| 3158 | + }, |
|---|
| 3159 | +}; |
|---|
| 3160 | + |
|---|
| 3161 | +static struct clk_branch gcc_mss_mnoc_bimc_axi_clk = { |
|---|
| 3162 | + .halt_reg = 0x8a004, |
|---|
| 3163 | + .clkr = { |
|---|
| 3164 | + .enable_reg = 0x8a004, |
|---|
| 3165 | + .enable_mask = BIT(0), |
|---|
| 3166 | + .hw.init = &(struct clk_init_data){ |
|---|
| 3167 | + .name = "gcc_mss_mnoc_bimc_axi_clk", |
|---|
| 3168 | + .parent_names = (const char *[]){ "system_noc_clk_src" }, |
|---|
| 3169 | + .num_parents = 1, |
|---|
| 3170 | + .ops = &clk_branch2_ops, |
|---|
| 3171 | + }, |
|---|
| 3172 | + }, |
|---|
| 3173 | +}; |
|---|
| 3174 | + |
|---|
| 3175 | +static struct clk_branch gcc_mss_snoc_axi_clk = { |
|---|
| 3176 | + .halt_reg = 0x8a024, |
|---|
| 3177 | + .clkr = { |
|---|
| 3178 | + .enable_reg = 0x8a024, |
|---|
| 3179 | + .enable_mask = BIT(0), |
|---|
| 3180 | + .hw.init = &(struct clk_init_data){ |
|---|
| 3181 | + .name = "gcc_mss_snoc_axi_clk", |
|---|
| 3182 | + .parent_names = (const char *[]){ "system_noc_clk_src" }, |
|---|
| 3183 | + .num_parents = 1, |
|---|
| 3184 | + .ops = &clk_branch2_ops, |
|---|
| 3185 | + }, |
|---|
| 3186 | + }, |
|---|
| 3187 | +}; |
|---|
| 3188 | + |
|---|
| 3189 | +static struct clk_branch gcc_mss_q6_bimc_axi_clk = { |
|---|
| 3190 | + .halt_reg = 0x8a028, |
|---|
| 3191 | + .clkr = { |
|---|
| 3192 | + .enable_reg = 0x8a028, |
|---|
| 3193 | + .enable_mask = BIT(0), |
|---|
| 3194 | + .hw.init = &(struct clk_init_data){ |
|---|
| 3195 | + .name = "gcc_mss_q6_bimc_axi_clk", |
|---|
| 3196 | + .parent_names = (const char *[]){ "system_noc_clk_src" }, |
|---|
| 3056 | 3197 | .num_parents = 1, |
|---|
| 3057 | 3198 | .ops = &clk_branch2_ops, |
|---|
| 3058 | 3199 | }, |
|---|
| .. | .. |
|---|
| 3329 | 3470 | [GCC_PCIE_CLKREF_CLK] = &gcc_pcie_clkref_clk.clkr, |
|---|
| 3330 | 3471 | [GCC_RX2_USB2_CLKREF_CLK] = &gcc_rx2_usb2_clkref_clk.clkr, |
|---|
| 3331 | 3472 | [GCC_RX1_USB2_CLKREF_CLK] = &gcc_rx1_usb2_clkref_clk.clkr, |
|---|
| 3473 | + [GCC_EDP_CLKREF_CLK] = &gcc_edp_clkref_clk.clkr, |
|---|
| 3474 | + [GCC_MSS_CFG_AHB_CLK] = &gcc_mss_cfg_ahb_clk.clkr, |
|---|
| 3475 | + [GCC_MSS_Q6_BIMC_AXI_CLK] = &gcc_mss_q6_bimc_axi_clk.clkr, |
|---|
| 3476 | + [GCC_MSS_SNOC_AXI_CLK] = &gcc_mss_snoc_axi_clk.clkr, |
|---|
| 3477 | + [GCC_MSS_MNOC_BIMC_AXI_CLK] = &gcc_mss_mnoc_bimc_axi_clk.clkr, |
|---|
| 3478 | + [GCC_DCC_AHB_CLK] = &gcc_dcc_ahb_clk.clkr, |
|---|
| 3479 | + [GCC_AGGRE0_NOC_MPU_CFG_AHB_CLK] = &gcc_aggre0_noc_mpu_cfg_ahb_clk.clkr, |
|---|
| 3480 | + [GCC_MMSS_GPLL0_DIV_CLK] = &gcc_mmss_gpll0_div_clk.clkr, |
|---|
| 3481 | + [GCC_MSS_GPLL0_DIV_CLK] = &gcc_mss_gpll0_div_clk.clkr, |
|---|
| 3332 | 3482 | }; |
|---|
| 3333 | 3483 | |
|---|
| 3334 | 3484 | static struct gdsc *gcc_msm8996_gdscs[] = { |
|---|
| .. | .. |
|---|
| 3468 | 3618 | .num_resets = ARRAY_SIZE(gcc_msm8996_resets), |
|---|
| 3469 | 3619 | .gdscs = gcc_msm8996_gdscs, |
|---|
| 3470 | 3620 | .num_gdscs = ARRAY_SIZE(gcc_msm8996_gdscs), |
|---|
| 3621 | + .clk_hws = gcc_msm8996_hws, |
|---|
| 3622 | + .num_clk_hws = ARRAY_SIZE(gcc_msm8996_hws), |
|---|
| 3471 | 3623 | }; |
|---|
| 3472 | 3624 | |
|---|
| 3473 | 3625 | static const struct of_device_id gcc_msm8996_match_table[] = { |
|---|
| .. | .. |
|---|
| 3478 | 3630 | |
|---|
| 3479 | 3631 | static int gcc_msm8996_probe(struct platform_device *pdev) |
|---|
| 3480 | 3632 | { |
|---|
| 3481 | | - struct device *dev = &pdev->dev; |
|---|
| 3482 | | - int i, ret; |
|---|
| 3483 | 3633 | struct regmap *regmap; |
|---|
| 3484 | 3634 | |
|---|
| 3485 | 3635 | regmap = qcom_cc_map(pdev, &gcc_msm8996_desc); |
|---|
| .. | .. |
|---|
| 3491 | 3641 | * turned off by hardware during certain apps low power modes. |
|---|
| 3492 | 3642 | */ |
|---|
| 3493 | 3643 | regmap_update_bits(regmap, 0x52008, BIT(21), BIT(21)); |
|---|
| 3494 | | - |
|---|
| 3495 | | - for (i = 0; i < ARRAY_SIZE(gcc_msm8996_hws); i++) { |
|---|
| 3496 | | - ret = devm_clk_hw_register(dev, gcc_msm8996_hws[i]); |
|---|
| 3497 | | - if (ret) |
|---|
| 3498 | | - return ret; |
|---|
| 3499 | | - } |
|---|
| 3500 | 3644 | |
|---|
| 3501 | 3645 | return qcom_cc_really_probe(pdev, &gcc_msm8996_desc, regmap); |
|---|
| 3502 | 3646 | } |
|---|