.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (c) 2013-2014, 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> |
---|
.. | .. |
---|
30 | 22 | #include "clk-pll.h" |
---|
31 | 23 | #include "clk-rcg.h" |
---|
32 | 24 | #include "clk-branch.h" |
---|
| 25 | +#include "clk-hfpll.h" |
---|
33 | 26 | #include "reset.h" |
---|
34 | 27 | |
---|
35 | 28 | static struct clk_pll pll3 = { |
---|
.. | .. |
---|
84 | 77 | .num_parents = 1, |
---|
85 | 78 | .ops = &clk_pll_vote_ops, |
---|
86 | 79 | }, |
---|
| 80 | +}; |
---|
| 81 | + |
---|
| 82 | +static struct hfpll_data hfpll0_data = { |
---|
| 83 | + .mode_reg = 0x3200, |
---|
| 84 | + .l_reg = 0x3208, |
---|
| 85 | + .m_reg = 0x320c, |
---|
| 86 | + .n_reg = 0x3210, |
---|
| 87 | + .config_reg = 0x3204, |
---|
| 88 | + .status_reg = 0x321c, |
---|
| 89 | + .config_val = 0x7845c665, |
---|
| 90 | + .droop_reg = 0x3214, |
---|
| 91 | + .droop_val = 0x0108c000, |
---|
| 92 | + .min_rate = 600000000UL, |
---|
| 93 | + .max_rate = 1800000000UL, |
---|
| 94 | +}; |
---|
| 95 | + |
---|
| 96 | +static struct clk_hfpll hfpll0 = { |
---|
| 97 | + .d = &hfpll0_data, |
---|
| 98 | + .clkr.hw.init = &(struct clk_init_data){ |
---|
| 99 | + .parent_names = (const char *[]){ "pxo" }, |
---|
| 100 | + .num_parents = 1, |
---|
| 101 | + .name = "hfpll0", |
---|
| 102 | + .ops = &clk_ops_hfpll, |
---|
| 103 | + .flags = CLK_IGNORE_UNUSED, |
---|
| 104 | + }, |
---|
| 105 | + .lock = __SPIN_LOCK_UNLOCKED(hfpll0.lock), |
---|
| 106 | +}; |
---|
| 107 | + |
---|
| 108 | +static struct hfpll_data hfpll1_8064_data = { |
---|
| 109 | + .mode_reg = 0x3240, |
---|
| 110 | + .l_reg = 0x3248, |
---|
| 111 | + .m_reg = 0x324c, |
---|
| 112 | + .n_reg = 0x3250, |
---|
| 113 | + .config_reg = 0x3244, |
---|
| 114 | + .status_reg = 0x325c, |
---|
| 115 | + .config_val = 0x7845c665, |
---|
| 116 | + .droop_reg = 0x3254, |
---|
| 117 | + .droop_val = 0x0108c000, |
---|
| 118 | + .min_rate = 600000000UL, |
---|
| 119 | + .max_rate = 1800000000UL, |
---|
| 120 | +}; |
---|
| 121 | + |
---|
| 122 | +static struct hfpll_data hfpll1_data = { |
---|
| 123 | + .mode_reg = 0x3300, |
---|
| 124 | + .l_reg = 0x3308, |
---|
| 125 | + .m_reg = 0x330c, |
---|
| 126 | + .n_reg = 0x3310, |
---|
| 127 | + .config_reg = 0x3304, |
---|
| 128 | + .status_reg = 0x331c, |
---|
| 129 | + .config_val = 0x7845c665, |
---|
| 130 | + .droop_reg = 0x3314, |
---|
| 131 | + .droop_val = 0x0108c000, |
---|
| 132 | + .min_rate = 600000000UL, |
---|
| 133 | + .max_rate = 1800000000UL, |
---|
| 134 | +}; |
---|
| 135 | + |
---|
| 136 | +static struct clk_hfpll hfpll1 = { |
---|
| 137 | + .d = &hfpll1_data, |
---|
| 138 | + .clkr.hw.init = &(struct clk_init_data){ |
---|
| 139 | + .parent_names = (const char *[]){ "pxo" }, |
---|
| 140 | + .num_parents = 1, |
---|
| 141 | + .name = "hfpll1", |
---|
| 142 | + .ops = &clk_ops_hfpll, |
---|
| 143 | + .flags = CLK_IGNORE_UNUSED, |
---|
| 144 | + }, |
---|
| 145 | + .lock = __SPIN_LOCK_UNLOCKED(hfpll1.lock), |
---|
| 146 | +}; |
---|
| 147 | + |
---|
| 148 | +static struct hfpll_data hfpll2_data = { |
---|
| 149 | + .mode_reg = 0x3280, |
---|
| 150 | + .l_reg = 0x3288, |
---|
| 151 | + .m_reg = 0x328c, |
---|
| 152 | + .n_reg = 0x3290, |
---|
| 153 | + .config_reg = 0x3284, |
---|
| 154 | + .status_reg = 0x329c, |
---|
| 155 | + .config_val = 0x7845c665, |
---|
| 156 | + .droop_reg = 0x3294, |
---|
| 157 | + .droop_val = 0x0108c000, |
---|
| 158 | + .min_rate = 600000000UL, |
---|
| 159 | + .max_rate = 1800000000UL, |
---|
| 160 | +}; |
---|
| 161 | + |
---|
| 162 | +static struct clk_hfpll hfpll2 = { |
---|
| 163 | + .d = &hfpll2_data, |
---|
| 164 | + .clkr.hw.init = &(struct clk_init_data){ |
---|
| 165 | + .parent_names = (const char *[]){ "pxo" }, |
---|
| 166 | + .num_parents = 1, |
---|
| 167 | + .name = "hfpll2", |
---|
| 168 | + .ops = &clk_ops_hfpll, |
---|
| 169 | + .flags = CLK_IGNORE_UNUSED, |
---|
| 170 | + }, |
---|
| 171 | + .lock = __SPIN_LOCK_UNLOCKED(hfpll2.lock), |
---|
| 172 | +}; |
---|
| 173 | + |
---|
| 174 | +static struct hfpll_data hfpll3_data = { |
---|
| 175 | + .mode_reg = 0x32c0, |
---|
| 176 | + .l_reg = 0x32c8, |
---|
| 177 | + .m_reg = 0x32cc, |
---|
| 178 | + .n_reg = 0x32d0, |
---|
| 179 | + .config_reg = 0x32c4, |
---|
| 180 | + .status_reg = 0x32dc, |
---|
| 181 | + .config_val = 0x7845c665, |
---|
| 182 | + .droop_reg = 0x32d4, |
---|
| 183 | + .droop_val = 0x0108c000, |
---|
| 184 | + .min_rate = 600000000UL, |
---|
| 185 | + .max_rate = 1800000000UL, |
---|
| 186 | +}; |
---|
| 187 | + |
---|
| 188 | +static struct clk_hfpll hfpll3 = { |
---|
| 189 | + .d = &hfpll3_data, |
---|
| 190 | + .clkr.hw.init = &(struct clk_init_data){ |
---|
| 191 | + .parent_names = (const char *[]){ "pxo" }, |
---|
| 192 | + .num_parents = 1, |
---|
| 193 | + .name = "hfpll3", |
---|
| 194 | + .ops = &clk_ops_hfpll, |
---|
| 195 | + .flags = CLK_IGNORE_UNUSED, |
---|
| 196 | + }, |
---|
| 197 | + .lock = __SPIN_LOCK_UNLOCKED(hfpll3.lock), |
---|
| 198 | +}; |
---|
| 199 | + |
---|
| 200 | +static struct hfpll_data hfpll_l2_8064_data = { |
---|
| 201 | + .mode_reg = 0x3300, |
---|
| 202 | + .l_reg = 0x3308, |
---|
| 203 | + .m_reg = 0x330c, |
---|
| 204 | + .n_reg = 0x3310, |
---|
| 205 | + .config_reg = 0x3304, |
---|
| 206 | + .status_reg = 0x331c, |
---|
| 207 | + .config_val = 0x7845c665, |
---|
| 208 | + .droop_reg = 0x3314, |
---|
| 209 | + .droop_val = 0x0108c000, |
---|
| 210 | + .min_rate = 600000000UL, |
---|
| 211 | + .max_rate = 1800000000UL, |
---|
| 212 | +}; |
---|
| 213 | + |
---|
| 214 | +static struct hfpll_data hfpll_l2_data = { |
---|
| 215 | + .mode_reg = 0x3400, |
---|
| 216 | + .l_reg = 0x3408, |
---|
| 217 | + .m_reg = 0x340c, |
---|
| 218 | + .n_reg = 0x3410, |
---|
| 219 | + .config_reg = 0x3404, |
---|
| 220 | + .status_reg = 0x341c, |
---|
| 221 | + .config_val = 0x7845c665, |
---|
| 222 | + .droop_reg = 0x3414, |
---|
| 223 | + .droop_val = 0x0108c000, |
---|
| 224 | + .min_rate = 600000000UL, |
---|
| 225 | + .max_rate = 1800000000UL, |
---|
| 226 | +}; |
---|
| 227 | + |
---|
| 228 | +static struct clk_hfpll hfpll_l2 = { |
---|
| 229 | + .d = &hfpll_l2_data, |
---|
| 230 | + .clkr.hw.init = &(struct clk_init_data){ |
---|
| 231 | + .parent_names = (const char *[]){ "pxo" }, |
---|
| 232 | + .num_parents = 1, |
---|
| 233 | + .name = "hfpll_l2", |
---|
| 234 | + .ops = &clk_ops_hfpll, |
---|
| 235 | + .flags = CLK_IGNORE_UNUSED, |
---|
| 236 | + }, |
---|
| 237 | + .lock = __SPIN_LOCK_UNLOCKED(hfpll_l2.lock), |
---|
87 | 238 | }; |
---|
88 | 239 | |
---|
89 | 240 | static struct clk_pll pll14 = { |
---|
.. | .. |
---|
3107 | 3258 | [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr, |
---|
3108 | 3259 | [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr, |
---|
3109 | 3260 | [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr, |
---|
| 3261 | + [PLL9] = &hfpll0.clkr, |
---|
| 3262 | + [PLL10] = &hfpll1.clkr, |
---|
| 3263 | + [PLL12] = &hfpll_l2.clkr, |
---|
3110 | 3264 | }; |
---|
3111 | 3265 | |
---|
3112 | 3266 | static const struct qcom_reset_map gcc_msm8960_resets[] = { |
---|
.. | .. |
---|
3318 | 3472 | [PMIC_ARB1_H_CLK] = &pmic_arb1_h_clk.clkr, |
---|
3319 | 3473 | [PMIC_SSBI2_CLK] = &pmic_ssbi2_clk.clkr, |
---|
3320 | 3474 | [RPM_MSG_RAM_H_CLK] = &rpm_msg_ram_h_clk.clkr, |
---|
| 3475 | + [PLL9] = &hfpll0.clkr, |
---|
| 3476 | + [PLL10] = &hfpll1.clkr, |
---|
| 3477 | + [PLL12] = &hfpll_l2.clkr, |
---|
| 3478 | + [PLL16] = &hfpll2.clkr, |
---|
| 3479 | + [PLL17] = &hfpll3.clkr, |
---|
3321 | 3480 | }; |
---|
3322 | 3481 | |
---|
3323 | 3482 | static const struct qcom_reset_map gcc_apq8064_resets[] = { |
---|
.. | .. |
---|
3477 | 3636 | if (ret) |
---|
3478 | 3637 | return ret; |
---|
3479 | 3638 | |
---|
| 3639 | + if (match->data == &gcc_apq8064_desc) { |
---|
| 3640 | + hfpll1.d = &hfpll1_8064_data; |
---|
| 3641 | + hfpll_l2.d = &hfpll_l2_8064_data; |
---|
| 3642 | + } |
---|
| 3643 | + |
---|
3480 | 3644 | tsens = platform_device_register_data(&pdev->dev, "qcom-tsens", -1, |
---|
3481 | 3645 | NULL, 0); |
---|
3482 | 3646 | if (IS_ERR(tsens)) |
---|