1 // SPDX-License-Identifier: GPL-2.0-only
3 * Clock definitions for u8500 platform.
5 * Copyright (C) 2012 ST-Ericsson SA
6 * Author: Ulf Hansson <ulf.hansson@linaro.org>
10 #include <linux/of_address.h>
11 #include <linux/clk-provider.h>
12 #include <linux/mfd/dbx500-prcmu.h>
16 #include "reset-prcc.h"
18 static struct clk
*prcc_pclk
[(PRCC_NUM_PERIPH_CLUSTERS
+ 1) * PRCC_PERIPHS_PER_CLUSTER
];
19 static struct clk
*prcc_kclk
[(PRCC_NUM_PERIPH_CLUSTERS
+ 1) * PRCC_PERIPHS_PER_CLUSTER
];
20 static struct clk_hw
*clkout_clk
[2];
22 #define PRCC_SHOW(clk, base, bit) \
23 clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit]
24 #define PRCC_PCLK_STORE(clk, base, bit) \
25 prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
26 #define PRCC_KCLK_STORE(clk, base, bit) \
27 prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
29 static struct clk
*ux500_twocell_get(struct of_phandle_args
*clkspec
,
32 struct clk
**clk_data
= data
;
33 unsigned int base
, bit
;
35 if (clkspec
->args_count
!= 2)
36 return ERR_PTR(-EINVAL
);
38 base
= clkspec
->args
[0];
39 bit
= clkspec
->args
[1];
41 if (base
!= 1 && base
!= 2 && base
!= 3 && base
!= 5 && base
!= 6) {
42 pr_err("%s: invalid PRCC base %d\n", __func__
, base
);
43 return ERR_PTR(-EINVAL
);
46 return PRCC_SHOW(clk_data
, base
, bit
);
49 static struct clk_hw_onecell_data u8500_prcmu_hw_clks
= {
52 * This assignment makes sure the dynamic array
53 * gets the right size.
55 [PRCMU_NUM_CLKS
] = NULL
,
57 .num
= PRCMU_NUM_CLKS
,
60 /* Essentially names for the first PRCMU_CLKSRC_* defines */
61 static const char * const u8500_clkout_parents
[] = {
64 /* Just called "sysclk" in documentation */
70 /* CLK009 is not implemented, add it if you need it */
74 static struct clk_hw
*ux500_clkout_get(struct of_phandle_args
*clkspec
,
77 u32 id
, source
, divider
;
78 struct clk_hw
*clkout
;
80 if (clkspec
->args_count
!= 3)
81 return ERR_PTR(-EINVAL
);
83 id
= clkspec
->args
[0];
84 source
= clkspec
->args
[1];
85 divider
= clkspec
->args
[2];
88 pr_err("%s: invalid clkout ID %d\n", __func__
, id
);
89 return ERR_PTR(-EINVAL
);
93 pr_info("%s: clkout%d already registered, not reconfiguring\n",
95 return clkout_clk
[id
];
99 pr_err("%s: invalid source ID %d\n", __func__
, source
);
100 return ERR_PTR(-EINVAL
);
103 if (divider
== 0 || divider
> 63) {
104 pr_err("%s: invalid divider %d\n", __func__
, divider
);
105 return ERR_PTR(-EINVAL
);
108 pr_debug("registering clkout%d with source %d and divider %d\n",
109 id
+ 1, source
, divider
);
111 clkout
= clk_reg_prcmu_clkout(id
? "clkout2" : "clkout1",
112 u8500_clkout_parents
,
113 ARRAY_SIZE(u8500_clkout_parents
),
115 if (IS_ERR(clkout
)) {
116 pr_err("failed to register clkout%d\n", id
+ 1);
117 return ERR_CAST(clkout
);
120 clkout_clk
[id
] = clkout
;
125 static void u8500_clk_init(struct device_node
*np
)
127 struct prcmu_fw_version
*fw_version
;
128 struct device_node
*child
= NULL
;
129 const char *sgaclk_parent
= NULL
;
130 struct clk
*clk
, *rtc_clk
, *twd_clk
;
131 u32 bases
[CLKRST_MAX
];
132 struct u8500_prcc_reset
*rstc
;
136 * We allocate the reset controller here so that we can fill in the
137 * base addresses properly and pass to the reset controller init
140 rstc
= kzalloc(sizeof(*rstc
), GFP_KERNEL
);
144 for (i
= 0; i
< ARRAY_SIZE(bases
); i
++) {
147 if (of_address_to_resource(np
, i
, &r
))
148 /* Not much choice but to continue */
149 pr_err("failed to get CLKRST %d base address\n",
152 rstc
->phy_base
[i
] = r
.start
;
156 u8500_prcmu_hw_clks
.hws
[PRCMU_PLLSOC0
] =
157 clk_reg_prcmu_gate("soc0_pll", NULL
, PRCMU_PLLSOC0
,
160 u8500_prcmu_hw_clks
.hws
[PRCMU_PLLSOC1
] =
161 clk_reg_prcmu_gate("soc1_pll", NULL
, PRCMU_PLLSOC1
,
164 u8500_prcmu_hw_clks
.hws
[PRCMU_PLLDDR
] =
165 clk_reg_prcmu_gate("ddr_pll", NULL
, PRCMU_PLLDDR
,
169 * Read-only clocks that only return their current rate, only used
170 * as parents to other clocks and not visible in the device tree.
171 * clk38m_to_clkgen is the same as the SYSCLK, i.e. the root clock.
173 clk_reg_prcmu_rate("clk38m_to_clkgen", NULL
, PRCMU_SYSCLK
,
175 clk_reg_prcmu_rate("aclk", NULL
, PRCMU_ACLK
,
178 /* TODO: add CLK009 if needed */
180 rtc_clk
= clk_register_fixed_rate(NULL
, "rtc32k", "NULL",
185 fw_version
= prcmu_get_fw_version();
186 if (fw_version
!= NULL
) {
187 switch (fw_version
->project
) {
188 case PRCMU_FW_PROJECT_U8500_C2
:
189 case PRCMU_FW_PROJECT_U8500_SSG1
:
190 case PRCMU_FW_PROJECT_U8520
:
191 case PRCMU_FW_PROJECT_U8420
:
192 case PRCMU_FW_PROJECT_U8420_SYSCLK
:
193 case PRCMU_FW_PROJECT_U8500_SSG2
:
194 sgaclk_parent
= "soc0_pll";
202 u8500_prcmu_hw_clks
.hws
[PRCMU_SGACLK
] =
203 clk_reg_prcmu_gate("sgclk", sgaclk_parent
,
206 u8500_prcmu_hw_clks
.hws
[PRCMU_SGACLK
] =
207 clk_reg_prcmu_gate("sgclk", NULL
, PRCMU_SGACLK
, 0);
209 u8500_prcmu_hw_clks
.hws
[PRCMU_UARTCLK
] =
210 clk_reg_prcmu_gate("uartclk", NULL
, PRCMU_UARTCLK
, 0);
211 u8500_prcmu_hw_clks
.hws
[PRCMU_MSP02CLK
] =
212 clk_reg_prcmu_gate("msp02clk", NULL
, PRCMU_MSP02CLK
, 0);
213 u8500_prcmu_hw_clks
.hws
[PRCMU_MSP1CLK
] =
214 clk_reg_prcmu_gate("msp1clk", NULL
, PRCMU_MSP1CLK
, 0);
215 u8500_prcmu_hw_clks
.hws
[PRCMU_I2CCLK
] =
216 clk_reg_prcmu_gate("i2cclk", NULL
, PRCMU_I2CCLK
, 0);
217 u8500_prcmu_hw_clks
.hws
[PRCMU_SLIMCLK
] =
218 clk_reg_prcmu_gate("slimclk", NULL
, PRCMU_SLIMCLK
, 0);
219 u8500_prcmu_hw_clks
.hws
[PRCMU_PER1CLK
] =
220 clk_reg_prcmu_gate("per1clk", NULL
, PRCMU_PER1CLK
, 0);
221 u8500_prcmu_hw_clks
.hws
[PRCMU_PER2CLK
] =
222 clk_reg_prcmu_gate("per2clk", NULL
, PRCMU_PER2CLK
, 0);
223 u8500_prcmu_hw_clks
.hws
[PRCMU_PER3CLK
] =
224 clk_reg_prcmu_gate("per3clk", NULL
, PRCMU_PER3CLK
, 0);
225 u8500_prcmu_hw_clks
.hws
[PRCMU_PER5CLK
] =
226 clk_reg_prcmu_gate("per5clk", NULL
, PRCMU_PER5CLK
, 0);
227 u8500_prcmu_hw_clks
.hws
[PRCMU_PER6CLK
] =
228 clk_reg_prcmu_gate("per6clk", NULL
, PRCMU_PER6CLK
, 0);
229 u8500_prcmu_hw_clks
.hws
[PRCMU_PER7CLK
] =
230 clk_reg_prcmu_gate("per7clk", NULL
, PRCMU_PER7CLK
, 0);
231 u8500_prcmu_hw_clks
.hws
[PRCMU_LCDCLK
] =
232 clk_reg_prcmu_scalable("lcdclk", NULL
, PRCMU_LCDCLK
, 0,
234 u8500_prcmu_hw_clks
.hws
[PRCMU_BMLCLK
] =
235 clk_reg_prcmu_opp_gate("bmlclk", NULL
, PRCMU_BMLCLK
, 0);
236 u8500_prcmu_hw_clks
.hws
[PRCMU_HSITXCLK
] =
237 clk_reg_prcmu_scalable("hsitxclk", NULL
, PRCMU_HSITXCLK
, 0,
239 u8500_prcmu_hw_clks
.hws
[PRCMU_HSIRXCLK
] =
240 clk_reg_prcmu_scalable("hsirxclk", NULL
, PRCMU_HSIRXCLK
, 0,
242 u8500_prcmu_hw_clks
.hws
[PRCMU_HDMICLK
] =
243 clk_reg_prcmu_scalable("hdmiclk", NULL
, PRCMU_HDMICLK
, 0,
245 u8500_prcmu_hw_clks
.hws
[PRCMU_APEATCLK
] =
246 clk_reg_prcmu_gate("apeatclk", NULL
, PRCMU_APEATCLK
, 0);
247 u8500_prcmu_hw_clks
.hws
[PRCMU_APETRACECLK
] =
248 clk_reg_prcmu_scalable("apetraceclk", NULL
, PRCMU_APETRACECLK
, 0,
250 u8500_prcmu_hw_clks
.hws
[PRCMU_MCDECLK
] =
251 clk_reg_prcmu_gate("mcdeclk", NULL
, PRCMU_MCDECLK
, 0);
252 u8500_prcmu_hw_clks
.hws
[PRCMU_IPI2CCLK
] =
253 clk_reg_prcmu_opp_gate("ipi2cclk", NULL
, PRCMU_IPI2CCLK
, 0);
254 u8500_prcmu_hw_clks
.hws
[PRCMU_DSIALTCLK
] =
255 clk_reg_prcmu_gate("dsialtclk", NULL
, PRCMU_DSIALTCLK
, 0);
256 u8500_prcmu_hw_clks
.hws
[PRCMU_DMACLK
] =
257 clk_reg_prcmu_gate("dmaclk", NULL
, PRCMU_DMACLK
, 0);
258 u8500_prcmu_hw_clks
.hws
[PRCMU_B2R2CLK
] =
259 clk_reg_prcmu_gate("b2r2clk", NULL
, PRCMU_B2R2CLK
, 0);
260 u8500_prcmu_hw_clks
.hws
[PRCMU_TVCLK
] =
261 clk_reg_prcmu_scalable("tvclk", NULL
, PRCMU_TVCLK
, 0,
263 u8500_prcmu_hw_clks
.hws
[PRCMU_SSPCLK
] =
264 clk_reg_prcmu_gate("sspclk", NULL
, PRCMU_SSPCLK
, 0);
265 u8500_prcmu_hw_clks
.hws
[PRCMU_RNGCLK
] =
266 clk_reg_prcmu_gate("rngclk", NULL
, PRCMU_RNGCLK
, 0);
267 u8500_prcmu_hw_clks
.hws
[PRCMU_UICCCLK
] =
268 clk_reg_prcmu_gate("uiccclk", NULL
, PRCMU_UICCCLK
, 0);
269 u8500_prcmu_hw_clks
.hws
[PRCMU_TIMCLK
] =
270 clk_reg_prcmu_gate("timclk", NULL
, PRCMU_TIMCLK
, 0);
271 u8500_prcmu_hw_clks
.hws
[PRCMU_SYSCLK
] =
272 clk_reg_prcmu_gate("ab8500_sysclk", NULL
, PRCMU_SYSCLK
, 0);
273 u8500_prcmu_hw_clks
.hws
[PRCMU_SDMMCCLK
] =
274 clk_reg_prcmu_opp_volt_scalable("sdmmcclk", NULL
,
275 PRCMU_SDMMCCLK
, 100000000,
277 u8500_prcmu_hw_clks
.hws
[PRCMU_PLLDSI
] =
278 clk_reg_prcmu_scalable("dsi_pll", "hdmiclk",
279 PRCMU_PLLDSI
, 0, CLK_SET_RATE_GATE
);
280 u8500_prcmu_hw_clks
.hws
[PRCMU_DSI0CLK
] =
281 clk_reg_prcmu_scalable("dsi0clk", "dsi_pll",
282 PRCMU_DSI0CLK
, 0, CLK_SET_RATE_GATE
);
283 u8500_prcmu_hw_clks
.hws
[PRCMU_DSI1CLK
] =
284 clk_reg_prcmu_scalable("dsi1clk", "dsi_pll",
285 PRCMU_DSI1CLK
, 0, CLK_SET_RATE_GATE
);
286 u8500_prcmu_hw_clks
.hws
[PRCMU_DSI0ESCCLK
] =
287 clk_reg_prcmu_scalable("dsi0escclk", "tvclk",
288 PRCMU_DSI0ESCCLK
, 0, CLK_SET_RATE_GATE
);
289 u8500_prcmu_hw_clks
.hws
[PRCMU_DSI1ESCCLK
] =
290 clk_reg_prcmu_scalable("dsi1escclk", "tvclk",
291 PRCMU_DSI1ESCCLK
, 0, CLK_SET_RATE_GATE
);
292 u8500_prcmu_hw_clks
.hws
[PRCMU_DSI2ESCCLK
] =
293 clk_reg_prcmu_scalable("dsi2escclk", "tvclk",
294 PRCMU_DSI2ESCCLK
, 0, CLK_SET_RATE_GATE
);
295 u8500_prcmu_hw_clks
.hws
[PRCMU_ARMSS
] =
296 clk_reg_prcmu_scalable_rate("armss", NULL
,
297 PRCMU_ARMSS
, 0, CLK_IGNORE_UNUSED
);
299 twd_clk
= clk_register_fixed_factor(NULL
, "smp_twd", "armss",
300 CLK_IGNORE_UNUSED
, 1, 2);
303 clk
= clk_reg_prcc_pclk("p1_pclk0", "per1clk", bases
[CLKRST1_INDEX
],
305 PRCC_PCLK_STORE(clk
, 1, 0);
307 clk
= clk_reg_prcc_pclk("p1_pclk1", "per1clk", bases
[CLKRST1_INDEX
],
309 PRCC_PCLK_STORE(clk
, 1, 1);
311 clk
= clk_reg_prcc_pclk("p1_pclk2", "per1clk", bases
[CLKRST1_INDEX
],
313 PRCC_PCLK_STORE(clk
, 1, 2);
315 clk
= clk_reg_prcc_pclk("p1_pclk3", "per1clk", bases
[CLKRST1_INDEX
],
317 PRCC_PCLK_STORE(clk
, 1, 3);
319 clk
= clk_reg_prcc_pclk("p1_pclk4", "per1clk", bases
[CLKRST1_INDEX
],
321 PRCC_PCLK_STORE(clk
, 1, 4);
323 clk
= clk_reg_prcc_pclk("p1_pclk5", "per1clk", bases
[CLKRST1_INDEX
],
325 PRCC_PCLK_STORE(clk
, 1, 5);
327 clk
= clk_reg_prcc_pclk("p1_pclk6", "per1clk", bases
[CLKRST1_INDEX
],
329 PRCC_PCLK_STORE(clk
, 1, 6);
331 clk
= clk_reg_prcc_pclk("p1_pclk7", "per1clk", bases
[CLKRST1_INDEX
],
333 PRCC_PCLK_STORE(clk
, 1, 7);
335 clk
= clk_reg_prcc_pclk("p1_pclk8", "per1clk", bases
[CLKRST1_INDEX
],
337 PRCC_PCLK_STORE(clk
, 1, 8);
339 clk
= clk_reg_prcc_pclk("p1_pclk9", "per1clk", bases
[CLKRST1_INDEX
],
341 PRCC_PCLK_STORE(clk
, 1, 9);
343 clk
= clk_reg_prcc_pclk("p1_pclk10", "per1clk", bases
[CLKRST1_INDEX
],
345 PRCC_PCLK_STORE(clk
, 1, 10);
347 clk
= clk_reg_prcc_pclk("p1_pclk11", "per1clk", bases
[CLKRST1_INDEX
],
349 PRCC_PCLK_STORE(clk
, 1, 11);
351 clk
= clk_reg_prcc_pclk("p2_pclk0", "per2clk", bases
[CLKRST2_INDEX
],
353 PRCC_PCLK_STORE(clk
, 2, 0);
355 clk
= clk_reg_prcc_pclk("p2_pclk1", "per2clk", bases
[CLKRST2_INDEX
],
357 PRCC_PCLK_STORE(clk
, 2, 1);
359 clk
= clk_reg_prcc_pclk("p2_pclk2", "per2clk", bases
[CLKRST2_INDEX
],
361 PRCC_PCLK_STORE(clk
, 2, 2);
363 clk
= clk_reg_prcc_pclk("p2_pclk3", "per2clk", bases
[CLKRST2_INDEX
],
365 PRCC_PCLK_STORE(clk
, 2, 3);
367 clk
= clk_reg_prcc_pclk("p2_pclk4", "per2clk", bases
[CLKRST2_INDEX
],
369 PRCC_PCLK_STORE(clk
, 2, 4);
371 clk
= clk_reg_prcc_pclk("p2_pclk5", "per2clk", bases
[CLKRST2_INDEX
],
373 PRCC_PCLK_STORE(clk
, 2, 5);
375 clk
= clk_reg_prcc_pclk("p2_pclk6", "per2clk", bases
[CLKRST2_INDEX
],
377 PRCC_PCLK_STORE(clk
, 2, 6);
379 clk
= clk_reg_prcc_pclk("p2_pclk7", "per2clk", bases
[CLKRST2_INDEX
],
381 PRCC_PCLK_STORE(clk
, 2, 7);
383 clk
= clk_reg_prcc_pclk("p2_pclk8", "per2clk", bases
[CLKRST2_INDEX
],
385 PRCC_PCLK_STORE(clk
, 2, 8);
387 clk
= clk_reg_prcc_pclk("p2_pclk9", "per2clk", bases
[CLKRST2_INDEX
],
389 PRCC_PCLK_STORE(clk
, 2, 9);
391 clk
= clk_reg_prcc_pclk("p2_pclk10", "per2clk", bases
[CLKRST2_INDEX
],
393 PRCC_PCLK_STORE(clk
, 2, 10);
395 clk
= clk_reg_prcc_pclk("p2_pclk11", "per2clk", bases
[CLKRST2_INDEX
],
397 PRCC_PCLK_STORE(clk
, 2, 11);
399 clk
= clk_reg_prcc_pclk("p2_pclk12", "per2clk", bases
[CLKRST2_INDEX
],
401 PRCC_PCLK_STORE(clk
, 2, 12);
403 clk
= clk_reg_prcc_pclk("p3_pclk0", "per3clk", bases
[CLKRST3_INDEX
],
405 PRCC_PCLK_STORE(clk
, 3, 0);
407 clk
= clk_reg_prcc_pclk("p3_pclk1", "per3clk", bases
[CLKRST3_INDEX
],
409 PRCC_PCLK_STORE(clk
, 3, 1);
411 clk
= clk_reg_prcc_pclk("p3_pclk2", "per3clk", bases
[CLKRST3_INDEX
],
413 PRCC_PCLK_STORE(clk
, 3, 2);
415 clk
= clk_reg_prcc_pclk("p3_pclk3", "per3clk", bases
[CLKRST3_INDEX
],
417 PRCC_PCLK_STORE(clk
, 3, 3);
419 clk
= clk_reg_prcc_pclk("p3_pclk4", "per3clk", bases
[CLKRST3_INDEX
],
421 PRCC_PCLK_STORE(clk
, 3, 4);
423 clk
= clk_reg_prcc_pclk("p3_pclk5", "per3clk", bases
[CLKRST3_INDEX
],
425 PRCC_PCLK_STORE(clk
, 3, 5);
427 clk
= clk_reg_prcc_pclk("p3_pclk6", "per3clk", bases
[CLKRST3_INDEX
],
429 PRCC_PCLK_STORE(clk
, 3, 6);
431 clk
= clk_reg_prcc_pclk("p3_pclk7", "per3clk", bases
[CLKRST3_INDEX
],
433 PRCC_PCLK_STORE(clk
, 3, 7);
435 clk
= clk_reg_prcc_pclk("p3_pclk8", "per3clk", bases
[CLKRST3_INDEX
],
437 PRCC_PCLK_STORE(clk
, 3, 8);
439 clk
= clk_reg_prcc_pclk("p5_pclk0", "per5clk", bases
[CLKRST5_INDEX
],
441 PRCC_PCLK_STORE(clk
, 5, 0);
443 clk
= clk_reg_prcc_pclk("p5_pclk1", "per5clk", bases
[CLKRST5_INDEX
],
445 PRCC_PCLK_STORE(clk
, 5, 1);
447 clk
= clk_reg_prcc_pclk("p6_pclk0", "per6clk", bases
[CLKRST6_INDEX
],
449 PRCC_PCLK_STORE(clk
, 6, 0);
451 clk
= clk_reg_prcc_pclk("p6_pclk1", "per6clk", bases
[CLKRST6_INDEX
],
453 PRCC_PCLK_STORE(clk
, 6, 1);
455 clk
= clk_reg_prcc_pclk("p6_pclk2", "per6clk", bases
[CLKRST6_INDEX
],
457 PRCC_PCLK_STORE(clk
, 6, 2);
459 clk
= clk_reg_prcc_pclk("p6_pclk3", "per6clk", bases
[CLKRST6_INDEX
],
461 PRCC_PCLK_STORE(clk
, 6, 3);
463 clk
= clk_reg_prcc_pclk("p6_pclk4", "per6clk", bases
[CLKRST6_INDEX
],
465 PRCC_PCLK_STORE(clk
, 6, 4);
467 clk
= clk_reg_prcc_pclk("p6_pclk5", "per6clk", bases
[CLKRST6_INDEX
],
469 PRCC_PCLK_STORE(clk
, 6, 5);
471 clk
= clk_reg_prcc_pclk("p6_pclk6", "per6clk", bases
[CLKRST6_INDEX
],
473 PRCC_PCLK_STORE(clk
, 6, 6);
475 clk
= clk_reg_prcc_pclk("p6_pclk7", "per6clk", bases
[CLKRST6_INDEX
],
477 PRCC_PCLK_STORE(clk
, 6, 7);
481 * FIXME: Some drivers requires PERPIH[n| to be automatically enabled
482 * by enabling just the K-clock, even if it is not a valid parent to
483 * the K-clock. Until drivers get fixed we might need some kind of
484 * "parent muxed join".
488 clk
= clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk",
489 bases
[CLKRST1_INDEX
], BIT(0), CLK_SET_RATE_GATE
);
490 PRCC_KCLK_STORE(clk
, 1, 0);
492 clk
= clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk",
493 bases
[CLKRST1_INDEX
], BIT(1), CLK_SET_RATE_GATE
);
494 PRCC_KCLK_STORE(clk
, 1, 1);
496 clk
= clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk",
497 bases
[CLKRST1_INDEX
], BIT(2), CLK_SET_RATE_GATE
);
498 PRCC_KCLK_STORE(clk
, 1, 2);
500 clk
= clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk",
501 bases
[CLKRST1_INDEX
], BIT(3), CLK_SET_RATE_GATE
);
502 PRCC_KCLK_STORE(clk
, 1, 3);
504 clk
= clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk",
505 bases
[CLKRST1_INDEX
], BIT(4), CLK_SET_RATE_GATE
);
506 PRCC_KCLK_STORE(clk
, 1, 4);
508 clk
= clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk",
509 bases
[CLKRST1_INDEX
], BIT(5), CLK_SET_RATE_GATE
);
510 PRCC_KCLK_STORE(clk
, 1, 5);
512 clk
= clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk",
513 bases
[CLKRST1_INDEX
], BIT(6), CLK_SET_RATE_GATE
);
514 PRCC_KCLK_STORE(clk
, 1, 6);
516 clk
= clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk",
517 bases
[CLKRST1_INDEX
], BIT(8), CLK_SET_RATE_GATE
);
518 PRCC_KCLK_STORE(clk
, 1, 8);
520 clk
= clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk",
521 bases
[CLKRST1_INDEX
], BIT(9), CLK_SET_RATE_GATE
);
522 PRCC_KCLK_STORE(clk
, 1, 9);
524 clk
= clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk",
525 bases
[CLKRST1_INDEX
], BIT(10), CLK_SET_RATE_GATE
);
526 PRCC_KCLK_STORE(clk
, 1, 10);
529 clk
= clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk",
530 bases
[CLKRST2_INDEX
], BIT(0), CLK_SET_RATE_GATE
);
531 PRCC_KCLK_STORE(clk
, 2, 0);
533 clk
= clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk",
534 bases
[CLKRST2_INDEX
], BIT(2), CLK_SET_RATE_GATE
);
535 PRCC_KCLK_STORE(clk
, 2, 2);
537 clk
= clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk",
538 bases
[CLKRST2_INDEX
], BIT(3), CLK_SET_RATE_GATE
);
539 PRCC_KCLK_STORE(clk
, 2, 3);
541 clk
= clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk",
542 bases
[CLKRST2_INDEX
], BIT(4), CLK_SET_RATE_GATE
);
543 PRCC_KCLK_STORE(clk
, 2, 4);
545 clk
= clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk",
546 bases
[CLKRST2_INDEX
], BIT(5), CLK_SET_RATE_GATE
);
547 PRCC_KCLK_STORE(clk
, 2, 5);
549 /* Note that rate is received from parent. */
550 clk
= clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk",
551 bases
[CLKRST2_INDEX
], BIT(6),
552 CLK_SET_RATE_GATE
|CLK_SET_RATE_PARENT
);
553 PRCC_KCLK_STORE(clk
, 2, 6);
555 clk
= clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk",
556 bases
[CLKRST2_INDEX
], BIT(7),
557 CLK_SET_RATE_GATE
|CLK_SET_RATE_PARENT
);
558 PRCC_KCLK_STORE(clk
, 2, 7);
561 clk
= clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk",
562 bases
[CLKRST3_INDEX
], BIT(1), CLK_SET_RATE_GATE
);
563 PRCC_KCLK_STORE(clk
, 3, 1);
565 clk
= clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk",
566 bases
[CLKRST3_INDEX
], BIT(2), CLK_SET_RATE_GATE
);
567 PRCC_KCLK_STORE(clk
, 3, 2);
569 clk
= clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk",
570 bases
[CLKRST3_INDEX
], BIT(3), CLK_SET_RATE_GATE
);
571 PRCC_KCLK_STORE(clk
, 3, 3);
573 clk
= clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk",
574 bases
[CLKRST3_INDEX
], BIT(4), CLK_SET_RATE_GATE
);
575 PRCC_KCLK_STORE(clk
, 3, 4);
577 clk
= clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k",
578 bases
[CLKRST3_INDEX
], BIT(5), CLK_SET_RATE_GATE
);
579 PRCC_KCLK_STORE(clk
, 3, 5);
581 clk
= clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk",
582 bases
[CLKRST3_INDEX
], BIT(6), CLK_SET_RATE_GATE
);
583 PRCC_KCLK_STORE(clk
, 3, 6);
585 clk
= clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk",
586 bases
[CLKRST3_INDEX
], BIT(7), CLK_SET_RATE_GATE
);
587 PRCC_KCLK_STORE(clk
, 3, 7);
590 clk
= clk_reg_prcc_kclk("p3_rng_kclk", "rngclk",
591 bases
[CLKRST6_INDEX
], BIT(0), CLK_SET_RATE_GATE
);
592 PRCC_KCLK_STORE(clk
, 6, 0);
594 for_each_child_of_node(np
, child
) {
595 if (of_node_name_eq(child
, "prcmu-clock"))
596 of_clk_add_hw_provider(child
, of_clk_hw_onecell_get
,
597 &u8500_prcmu_hw_clks
);
599 if (of_node_name_eq(child
, "clkout-clock"))
600 of_clk_add_hw_provider(child
, ux500_clkout_get
, NULL
);
602 if (of_node_name_eq(child
, "prcc-periph-clock"))
603 of_clk_add_provider(child
, ux500_twocell_get
, prcc_pclk
);
605 if (of_node_name_eq(child
, "prcc-kernel-clock"))
606 of_clk_add_provider(child
, ux500_twocell_get
, prcc_kclk
);
608 if (of_node_name_eq(child
, "rtc32k-clock"))
609 of_clk_add_provider(child
, of_clk_src_simple_get
, rtc_clk
);
611 if (of_node_name_eq(child
, "smp-twd-clock"))
612 of_clk_add_provider(child
, of_clk_src_simple_get
, twd_clk
);
614 if (of_node_name_eq(child
, "prcc-reset-controller"))
615 u8500_prcc_reset_init(child
, rstc
);
618 CLK_OF_DECLARE(u8500_clks
, "stericsson,u8500-clks", u8500_clk_init
);