xref: /linux/drivers/clk/ux500/u8500_of_clk.c (revision 4f2c0a4acffbec01079c28f839422e64ddeff004)
1af873fceSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
282b0f4b7SLee Jones /*
382b0f4b7SLee Jones  * Clock definitions for u8500 platform.
482b0f4b7SLee Jones  *
582b0f4b7SLee Jones  * Copyright (C) 2012 ST-Ericsson SA
682b0f4b7SLee Jones  * Author: Ulf Hansson <ulf.hansson@linaro.org>
782b0f4b7SLee Jones  */
882b0f4b7SLee Jones 
9dec759d8SLee Jones #include <linux/of.h>
105dc0fe19SLinus Walleij #include <linux/of_address.h>
1182b0f4b7SLee Jones #include <linux/clk-provider.h>
1282b0f4b7SLee Jones #include <linux/mfd/dbx500-prcmu.h>
1382b0f4b7SLee Jones 
14b14cbdfdSLinus Walleij #include "clk.h"
15b14cbdfdSLinus Walleij #include "prcc.h"
16b14cbdfdSLinus Walleij #include "reset-prcc.h"
172d080300SLee Jones 
182d080300SLee Jones static struct clk *prcc_pclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
1989da2dfaSLee Jones static struct clk *prcc_kclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
20*639d5661SLinus Walleij static struct clk_hw *clkout_clk[2];
21f9fcb8e8SLee Jones 
22b4bdc81bSLee Jones #define PRCC_SHOW(clk, base, bit) \
23b4bdc81bSLee Jones 	clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit]
242d080300SLee Jones #define PRCC_PCLK_STORE(clk, base, bit)	\
252d080300SLee Jones 	prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
2689da2dfaSLee Jones #define PRCC_KCLK_STORE(clk, base, bit)        \
2789da2dfaSLee Jones 	prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
28b4bdc81bSLee Jones 
ux500_twocell_get(struct of_phandle_args * clkspec,void * data)29c112c1d8SSachin Kamat static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec,
30c112c1d8SSachin Kamat 				     void *data)
31b4bdc81bSLee Jones {
32b4bdc81bSLee Jones 	struct clk **clk_data = data;
33b4bdc81bSLee Jones 	unsigned int base, bit;
34b4bdc81bSLee Jones 
35b4bdc81bSLee Jones 	if (clkspec->args_count != 2)
36b4bdc81bSLee Jones 		return  ERR_PTR(-EINVAL);
37b4bdc81bSLee Jones 
38b4bdc81bSLee Jones 	base = clkspec->args[0];
39b4bdc81bSLee Jones 	bit = clkspec->args[1];
40b4bdc81bSLee Jones 
41b4bdc81bSLee Jones 	if (base != 1 && base != 2 && base != 3 && base != 5 && base != 6) {
42b4bdc81bSLee Jones 		pr_err("%s: invalid PRCC base %d\n", __func__, base);
43b4bdc81bSLee Jones 		return ERR_PTR(-EINVAL);
44b4bdc81bSLee Jones 	}
45b4bdc81bSLee Jones 
46b4bdc81bSLee Jones 	return PRCC_SHOW(clk_data, base, bit);
47b4bdc81bSLee Jones }
48b4bdc81bSLee Jones 
49a8173c59SLinus Walleij static struct clk_hw_onecell_data u8500_prcmu_hw_clks = {
50a8173c59SLinus Walleij 	.hws = {
51a8173c59SLinus Walleij 		/*
52a8173c59SLinus Walleij 		 * This assignment makes sure the dynamic array
53a8173c59SLinus Walleij 		 * gets the right size.
54a8173c59SLinus Walleij 		 */
55a8173c59SLinus Walleij 		[PRCMU_NUM_CLKS] = NULL,
56a8173c59SLinus Walleij 	},
57a8173c59SLinus Walleij 	.num = PRCMU_NUM_CLKS,
58a8173c59SLinus Walleij };
59a8173c59SLinus Walleij 
60*639d5661SLinus Walleij /* Essentially names for the first PRCMU_CLKSRC_* defines */
61*639d5661SLinus Walleij static const char * const u8500_clkout_parents[] = {
62*639d5661SLinus Walleij 	"clk38m_to_clkgen",
63*639d5661SLinus Walleij 	"aclk",
64*639d5661SLinus Walleij 	/* Just called "sysclk" in documentation */
65*639d5661SLinus Walleij 	"ab8500_sysclk",
66*639d5661SLinus Walleij 	"lcdclk",
67*639d5661SLinus Walleij 	"sdmmcclk",
68*639d5661SLinus Walleij 	"tvclk",
69*639d5661SLinus Walleij 	"timclk",
70*639d5661SLinus Walleij 	/* CLK009 is not implemented, add it if you need it */
71*639d5661SLinus Walleij 	"clk009",
72*639d5661SLinus Walleij };
73*639d5661SLinus Walleij 
ux500_clkout_get(struct of_phandle_args * clkspec,void * data)74*639d5661SLinus Walleij static struct clk_hw *ux500_clkout_get(struct of_phandle_args *clkspec,
75*639d5661SLinus Walleij 				       void *data)
76*639d5661SLinus Walleij {
77*639d5661SLinus Walleij 	u32 id, source, divider;
78*639d5661SLinus Walleij 	struct clk_hw *clkout;
79*639d5661SLinus Walleij 
80*639d5661SLinus Walleij 	if (clkspec->args_count != 3)
81*639d5661SLinus Walleij 		return  ERR_PTR(-EINVAL);
82*639d5661SLinus Walleij 
83*639d5661SLinus Walleij 	id = clkspec->args[0];
84*639d5661SLinus Walleij 	source = clkspec->args[1];
85*639d5661SLinus Walleij 	divider = clkspec->args[2];
86*639d5661SLinus Walleij 
87*639d5661SLinus Walleij 	if (id > 1) {
88*639d5661SLinus Walleij 		pr_err("%s: invalid clkout ID %d\n", __func__, id);
89*639d5661SLinus Walleij 		return ERR_PTR(-EINVAL);
90*639d5661SLinus Walleij 	}
91*639d5661SLinus Walleij 
92*639d5661SLinus Walleij 	if (clkout_clk[id]) {
93*639d5661SLinus Walleij 		pr_info("%s: clkout%d already registered, not reconfiguring\n",
94*639d5661SLinus Walleij 			__func__, id + 1);
95*639d5661SLinus Walleij 		return clkout_clk[id];
96*639d5661SLinus Walleij 	}
97*639d5661SLinus Walleij 
98*639d5661SLinus Walleij 	if (source > 7) {
99*639d5661SLinus Walleij 		pr_err("%s: invalid source ID %d\n", __func__, source);
100*639d5661SLinus Walleij 		return ERR_PTR(-EINVAL);
101*639d5661SLinus Walleij 	}
102*639d5661SLinus Walleij 
103*639d5661SLinus Walleij 	if (divider == 0 || divider > 63) {
104*639d5661SLinus Walleij 		pr_err("%s: invalid divider %d\n", __func__, divider);
105*639d5661SLinus Walleij 		return ERR_PTR(-EINVAL);
106*639d5661SLinus Walleij 	}
107*639d5661SLinus Walleij 
108*639d5661SLinus Walleij 	pr_debug("registering clkout%d with source %d and divider %d\n",
109*639d5661SLinus Walleij 		 id + 1, source, divider);
110*639d5661SLinus Walleij 
111*639d5661SLinus Walleij 	clkout = clk_reg_prcmu_clkout(id ? "clkout2" : "clkout1",
112*639d5661SLinus Walleij 				      u8500_clkout_parents,
113*639d5661SLinus Walleij 				      ARRAY_SIZE(u8500_clkout_parents),
114*639d5661SLinus Walleij 				      source, divider);
115*639d5661SLinus Walleij 	if (IS_ERR(clkout)) {
116*639d5661SLinus Walleij 		pr_err("failed to register clkout%d\n",  id + 1);
117*639d5661SLinus Walleij 		return ERR_CAST(clkout);
118*639d5661SLinus Walleij 	}
119*639d5661SLinus Walleij 
120*639d5661SLinus Walleij 	clkout_clk[id] = clkout;
121*639d5661SLinus Walleij 
122*639d5661SLinus Walleij 	return clkout;
123*639d5661SLinus Walleij }
124*639d5661SLinus Walleij 
u8500_clk_init(struct device_node * np)125269f1aacSArnd Bergmann static void u8500_clk_init(struct device_node *np)
12682b0f4b7SLee Jones {
12782b0f4b7SLee Jones 	struct prcmu_fw_version *fw_version;
128dec759d8SLee Jones 	struct device_node *child = NULL;
12982b0f4b7SLee Jones 	const char *sgaclk_parent = NULL;
1304e334660SLee Jones 	struct clk *clk, *rtc_clk, *twd_clk;
1315dc0fe19SLinus Walleij 	u32 bases[CLKRST_MAX];
132b14cbdfdSLinus Walleij 	struct u8500_prcc_reset *rstc;
1335dc0fe19SLinus Walleij 	int i;
13482b0f4b7SLee Jones 
135b14cbdfdSLinus Walleij 	/*
136b14cbdfdSLinus Walleij 	 * We allocate the reset controller here so that we can fill in the
137b14cbdfdSLinus Walleij 	 * base addresses properly and pass to the reset controller init
138b14cbdfdSLinus Walleij 	 * function later on.
139b14cbdfdSLinus Walleij 	 */
140b14cbdfdSLinus Walleij 	rstc = kzalloc(sizeof(*rstc), GFP_KERNEL);
141b14cbdfdSLinus Walleij 	if (!rstc)
142b14cbdfdSLinus Walleij 		return;
143b14cbdfdSLinus Walleij 
1445dc0fe19SLinus Walleij 	for (i = 0; i < ARRAY_SIZE(bases); i++) {
1455dc0fe19SLinus Walleij 		struct resource r;
1465dc0fe19SLinus Walleij 
1475dc0fe19SLinus Walleij 		if (of_address_to_resource(np, i, &r))
1485dc0fe19SLinus Walleij 			/* Not much choice but to continue */
1495dc0fe19SLinus Walleij 			pr_err("failed to get CLKRST %d base address\n",
1505dc0fe19SLinus Walleij 			       i + 1);
1515dc0fe19SLinus Walleij 		bases[i] = r.start;
152b14cbdfdSLinus Walleij 		rstc->phy_base[i] = r.start;
1535dc0fe19SLinus Walleij 	}
154dec759d8SLee Jones 
15582b0f4b7SLee Jones 	/* Clock sources */
156a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PLLSOC0] =
157a8173c59SLinus Walleij 		clk_reg_prcmu_gate("soc0_pll", NULL, PRCMU_PLLSOC0,
15866f4ae77SStephen Boyd 				   CLK_IGNORE_UNUSED);
15982b0f4b7SLee Jones 
160a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PLLSOC1] =
161a8173c59SLinus Walleij 		clk_reg_prcmu_gate("soc1_pll", NULL, PRCMU_PLLSOC1,
16266f4ae77SStephen Boyd 				   CLK_IGNORE_UNUSED);
16382b0f4b7SLee Jones 
164a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PLLDDR] =
165a8173c59SLinus Walleij 		clk_reg_prcmu_gate("ddr_pll", NULL, PRCMU_PLLDDR,
16666f4ae77SStephen Boyd 				   CLK_IGNORE_UNUSED);
16782b0f4b7SLee Jones 
168*639d5661SLinus Walleij 	/*
169*639d5661SLinus Walleij 	 * Read-only clocks that only return their current rate, only used
170*639d5661SLinus Walleij 	 * as parents to other clocks and not visible in the device tree.
171*639d5661SLinus Walleij 	 * clk38m_to_clkgen is the same as the SYSCLK, i.e. the root clock.
172*639d5661SLinus Walleij 	 */
173*639d5661SLinus Walleij 	clk_reg_prcmu_rate("clk38m_to_clkgen", NULL, PRCMU_SYSCLK,
174*639d5661SLinus Walleij 			   CLK_IGNORE_UNUSED);
175*639d5661SLinus Walleij 	clk_reg_prcmu_rate("aclk", NULL, PRCMU_ACLK,
176*639d5661SLinus Walleij 			   CLK_IGNORE_UNUSED);
177*639d5661SLinus Walleij 
178*639d5661SLinus Walleij 	/* TODO: add CLK009 if needed */
17982b0f4b7SLee Jones 
180d625a730SLee Jones 	rtc_clk = clk_register_fixed_rate(NULL, "rtc32k", "NULL",
18166f4ae77SStephen Boyd 				CLK_IGNORE_UNUSED,
18282b0f4b7SLee Jones 				32768);
18382b0f4b7SLee Jones 
18482b0f4b7SLee Jones 	/* PRCMU clocks */
18582b0f4b7SLee Jones 	fw_version = prcmu_get_fw_version();
18682b0f4b7SLee Jones 	if (fw_version != NULL) {
18782b0f4b7SLee Jones 		switch (fw_version->project) {
18882b0f4b7SLee Jones 		case PRCMU_FW_PROJECT_U8500_C2:
1899050ad81SLinus Walleij 		case PRCMU_FW_PROJECT_U8500_SSG1:
19082b0f4b7SLee Jones 		case PRCMU_FW_PROJECT_U8520:
19182b0f4b7SLee Jones 		case PRCMU_FW_PROJECT_U8420:
192248fdcc7SLinus Walleij 		case PRCMU_FW_PROJECT_U8420_SYSCLK:
1939050ad81SLinus Walleij 		case PRCMU_FW_PROJECT_U8500_SSG2:
19482b0f4b7SLee Jones 			sgaclk_parent = "soc0_pll";
19582b0f4b7SLee Jones 			break;
19682b0f4b7SLee Jones 		default:
19782b0f4b7SLee Jones 			break;
19882b0f4b7SLee Jones 		}
19982b0f4b7SLee Jones 	}
20082b0f4b7SLee Jones 
20182b0f4b7SLee Jones 	if (sgaclk_parent)
202a8173c59SLinus Walleij 		u8500_prcmu_hw_clks.hws[PRCMU_SGACLK] =
203a8173c59SLinus Walleij 			clk_reg_prcmu_gate("sgclk", sgaclk_parent,
20482b0f4b7SLee Jones 					   PRCMU_SGACLK, 0);
20582b0f4b7SLee Jones 	else
206a8173c59SLinus Walleij 		u8500_prcmu_hw_clks.hws[PRCMU_SGACLK] =
207a8173c59SLinus Walleij 			clk_reg_prcmu_gate("sgclk", NULL, PRCMU_SGACLK, 0);
20882b0f4b7SLee Jones 
209a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_UARTCLK] =
210a8173c59SLinus Walleij 		clk_reg_prcmu_gate("uartclk", NULL, PRCMU_UARTCLK, 0);
211a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_MSP02CLK] =
212a8173c59SLinus Walleij 		clk_reg_prcmu_gate("msp02clk", NULL, PRCMU_MSP02CLK, 0);
213a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_MSP1CLK] =
214a8173c59SLinus Walleij 		clk_reg_prcmu_gate("msp1clk", NULL, PRCMU_MSP1CLK, 0);
215a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_I2CCLK] =
216a8173c59SLinus Walleij 		clk_reg_prcmu_gate("i2cclk", NULL, PRCMU_I2CCLK, 0);
217a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_SLIMCLK] =
218a8173c59SLinus Walleij 		clk_reg_prcmu_gate("slimclk", NULL, PRCMU_SLIMCLK, 0);
219a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PER1CLK] =
220a8173c59SLinus Walleij 		clk_reg_prcmu_gate("per1clk", NULL, PRCMU_PER1CLK, 0);
221a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PER2CLK] =
222a8173c59SLinus Walleij 		clk_reg_prcmu_gate("per2clk", NULL, PRCMU_PER2CLK, 0);
223a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PER3CLK] =
224a8173c59SLinus Walleij 		clk_reg_prcmu_gate("per3clk", NULL, PRCMU_PER3CLK, 0);
225a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PER5CLK] =
226a8173c59SLinus Walleij 		clk_reg_prcmu_gate("per5clk", NULL, PRCMU_PER5CLK, 0);
227a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PER6CLK] =
228a8173c59SLinus Walleij 		clk_reg_prcmu_gate("per6clk", NULL, PRCMU_PER6CLK, 0);
229a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PER7CLK] =
230a8173c59SLinus Walleij 		clk_reg_prcmu_gate("per7clk", NULL, PRCMU_PER7CLK, 0);
231a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_LCDCLK] =
232a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("lcdclk", NULL, PRCMU_LCDCLK, 0,
23366f4ae77SStephen Boyd 				       CLK_SET_RATE_GATE);
234a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_BMLCLK] =
235a8173c59SLinus Walleij 		clk_reg_prcmu_opp_gate("bmlclk", NULL, PRCMU_BMLCLK, 0);
236a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_HSITXCLK] =
237a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("hsitxclk", NULL, PRCMU_HSITXCLK, 0,
23866f4ae77SStephen Boyd 				       CLK_SET_RATE_GATE);
239a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_HSIRXCLK] =
240a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("hsirxclk", NULL, PRCMU_HSIRXCLK, 0,
24166f4ae77SStephen Boyd 				       CLK_SET_RATE_GATE);
242a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_HDMICLK] =
243a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("hdmiclk", NULL, PRCMU_HDMICLK, 0,
24466f4ae77SStephen Boyd 				       CLK_SET_RATE_GATE);
245a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_APEATCLK] =
246a8173c59SLinus Walleij 		clk_reg_prcmu_gate("apeatclk", NULL, PRCMU_APEATCLK, 0);
247a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_APETRACECLK] =
248a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("apetraceclk", NULL, PRCMU_APETRACECLK, 0,
24966f4ae77SStephen Boyd 				       CLK_SET_RATE_GATE);
250a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_MCDECLK] =
251a8173c59SLinus Walleij 		clk_reg_prcmu_gate("mcdeclk", NULL, PRCMU_MCDECLK, 0);
252a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_IPI2CCLK] =
253a8173c59SLinus Walleij 		clk_reg_prcmu_opp_gate("ipi2cclk", NULL, PRCMU_IPI2CCLK, 0);
254a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_DSIALTCLK] =
255a8173c59SLinus Walleij 		clk_reg_prcmu_gate("dsialtclk", NULL, PRCMU_DSIALTCLK, 0);
256a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_DMACLK] =
257a8173c59SLinus Walleij 		clk_reg_prcmu_gate("dmaclk", NULL, PRCMU_DMACLK, 0);
258a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_B2R2CLK] =
259a8173c59SLinus Walleij 		clk_reg_prcmu_gate("b2r2clk", NULL, PRCMU_B2R2CLK, 0);
260a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_TVCLK] =
261a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("tvclk", NULL, PRCMU_TVCLK, 0,
26266f4ae77SStephen Boyd 				       CLK_SET_RATE_GATE);
263a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_SSPCLK] =
264a8173c59SLinus Walleij 		clk_reg_prcmu_gate("sspclk", NULL, PRCMU_SSPCLK, 0);
265a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_RNGCLK] =
266a8173c59SLinus Walleij 		clk_reg_prcmu_gate("rngclk", NULL, PRCMU_RNGCLK, 0);
267a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_UICCCLK] =
268a8173c59SLinus Walleij 		clk_reg_prcmu_gate("uiccclk", NULL, PRCMU_UICCCLK, 0);
269a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_TIMCLK] =
270a8173c59SLinus Walleij 		clk_reg_prcmu_gate("timclk", NULL, PRCMU_TIMCLK, 0);
271a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_SYSCLK] =
272a8173c59SLinus Walleij 		clk_reg_prcmu_gate("ab8500_sysclk", NULL, PRCMU_SYSCLK, 0);
273a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_SDMMCCLK] =
274a8173c59SLinus Walleij 		clk_reg_prcmu_opp_volt_scalable("sdmmcclk", NULL,
275a8173c59SLinus Walleij 						PRCMU_SDMMCCLK, 100000000,
276a8173c59SLinus Walleij 						CLK_SET_RATE_GATE);
277a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_PLLDSI] =
278a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("dsi_pll", "hdmiclk",
27982b0f4b7SLee Jones 				       PRCMU_PLLDSI, 0, CLK_SET_RATE_GATE);
280a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_DSI0CLK] =
281a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("dsi0clk", "dsi_pll",
28282b0f4b7SLee Jones 				       PRCMU_DSI0CLK, 0, CLK_SET_RATE_GATE);
283a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_DSI1CLK] =
284a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("dsi1clk", "dsi_pll",
28582b0f4b7SLee Jones 				       PRCMU_DSI1CLK, 0, CLK_SET_RATE_GATE);
286a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_DSI0ESCCLK] =
287a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("dsi0escclk", "tvclk",
28882b0f4b7SLee Jones 				       PRCMU_DSI0ESCCLK, 0, CLK_SET_RATE_GATE);
289a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_DSI1ESCCLK] =
290a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("dsi1escclk", "tvclk",
29182b0f4b7SLee Jones 				       PRCMU_DSI1ESCCLK, 0, CLK_SET_RATE_GATE);
292a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_DSI2ESCCLK] =
293a8173c59SLinus Walleij 		clk_reg_prcmu_scalable("dsi2escclk", "tvclk",
29482b0f4b7SLee Jones 				       PRCMU_DSI2ESCCLK, 0, CLK_SET_RATE_GATE);
295a8173c59SLinus Walleij 	u8500_prcmu_hw_clks.hws[PRCMU_ARMSS] =
296a8173c59SLinus Walleij 		clk_reg_prcmu_scalable_rate("armss", NULL,
29766f4ae77SStephen Boyd 					    PRCMU_ARMSS, 0, CLK_IGNORE_UNUSED);
29882b0f4b7SLee Jones 
2994e334660SLee Jones 	twd_clk = clk_register_fixed_factor(NULL, "smp_twd", "armss",
30082b0f4b7SLee Jones 				CLK_IGNORE_UNUSED, 1, 2);
30182b0f4b7SLee Jones 
30282b0f4b7SLee Jones 	/* PRCC P-clocks */
3035dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", bases[CLKRST1_INDEX],
30482b0f4b7SLee Jones 				BIT(0), 0);
3052d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 0);
30682b0f4b7SLee Jones 
3075dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", bases[CLKRST1_INDEX],
30882b0f4b7SLee Jones 				BIT(1), 0);
3092d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 1);
31082b0f4b7SLee Jones 
3115dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", bases[CLKRST1_INDEX],
31282b0f4b7SLee Jones 				BIT(2), 0);
3132d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 2);
31482b0f4b7SLee Jones 
3155dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", bases[CLKRST1_INDEX],
31682b0f4b7SLee Jones 				BIT(3), 0);
3172d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 3);
31882b0f4b7SLee Jones 
3195dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", bases[CLKRST1_INDEX],
32082b0f4b7SLee Jones 				BIT(4), 0);
3212d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 4);
32282b0f4b7SLee Jones 
3235dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", bases[CLKRST1_INDEX],
32482b0f4b7SLee Jones 				BIT(5), 0);
3252d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 5);
32682b0f4b7SLee Jones 
3275dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", bases[CLKRST1_INDEX],
32882b0f4b7SLee Jones 				BIT(6), 0);
3292d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 6);
33082b0f4b7SLee Jones 
3315dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", bases[CLKRST1_INDEX],
33282b0f4b7SLee Jones 				BIT(7), 0);
3332d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 7);
33482b0f4b7SLee Jones 
3355dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", bases[CLKRST1_INDEX],
33682b0f4b7SLee Jones 				BIT(8), 0);
3372d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 8);
33882b0f4b7SLee Jones 
3395dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", bases[CLKRST1_INDEX],
34082b0f4b7SLee Jones 				BIT(9), 0);
3412d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 9);
34282b0f4b7SLee Jones 
3435dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", bases[CLKRST1_INDEX],
34482b0f4b7SLee Jones 				BIT(10), 0);
3452d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 10);
34682b0f4b7SLee Jones 
3475dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", bases[CLKRST1_INDEX],
34882b0f4b7SLee Jones 				BIT(11), 0);
3492d080300SLee Jones 	PRCC_PCLK_STORE(clk, 1, 11);
35082b0f4b7SLee Jones 
3515dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", bases[CLKRST2_INDEX],
35282b0f4b7SLee Jones 				BIT(0), 0);
3532d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 0);
35482b0f4b7SLee Jones 
3555dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", bases[CLKRST2_INDEX],
35682b0f4b7SLee Jones 				BIT(1), 0);
3572d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 1);
35882b0f4b7SLee Jones 
3595dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", bases[CLKRST2_INDEX],
36082b0f4b7SLee Jones 				BIT(2), 0);
3612d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 2);
36282b0f4b7SLee Jones 
3635dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", bases[CLKRST2_INDEX],
36482b0f4b7SLee Jones 				BIT(3), 0);
3652d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 3);
36682b0f4b7SLee Jones 
3675dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", bases[CLKRST2_INDEX],
36882b0f4b7SLee Jones 				BIT(4), 0);
3692d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 4);
37082b0f4b7SLee Jones 
3715dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", bases[CLKRST2_INDEX],
37282b0f4b7SLee Jones 				BIT(5), 0);
3732d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 5);
37482b0f4b7SLee Jones 
3755dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", bases[CLKRST2_INDEX],
37682b0f4b7SLee Jones 				BIT(6), 0);
3772d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 6);
37882b0f4b7SLee Jones 
3795dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", bases[CLKRST2_INDEX],
38082b0f4b7SLee Jones 				BIT(7), 0);
3812d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 7);
38282b0f4b7SLee Jones 
3835dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", bases[CLKRST2_INDEX],
38482b0f4b7SLee Jones 				BIT(8), 0);
3852d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 8);
38682b0f4b7SLee Jones 
3875dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", bases[CLKRST2_INDEX],
38882b0f4b7SLee Jones 				BIT(9), 0);
3892d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 9);
39082b0f4b7SLee Jones 
3915dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", bases[CLKRST2_INDEX],
39282b0f4b7SLee Jones 				BIT(10), 0);
3932d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 10);
39482b0f4b7SLee Jones 
3955dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", bases[CLKRST2_INDEX],
39682b0f4b7SLee Jones 				BIT(11), 0);
397f5ff9a11SLinus Walleij 	PRCC_PCLK_STORE(clk, 2, 11);
39882b0f4b7SLee Jones 
3995dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", bases[CLKRST2_INDEX],
40082b0f4b7SLee Jones 				BIT(12), 0);
4012d080300SLee Jones 	PRCC_PCLK_STORE(clk, 2, 12);
40282b0f4b7SLee Jones 
4035dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", bases[CLKRST3_INDEX],
40482b0f4b7SLee Jones 				BIT(0), 0);
4052d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 0);
40682b0f4b7SLee Jones 
4075dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", bases[CLKRST3_INDEX],
40882b0f4b7SLee Jones 				BIT(1), 0);
4092d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 1);
41082b0f4b7SLee Jones 
4115dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", bases[CLKRST3_INDEX],
41282b0f4b7SLee Jones 				BIT(2), 0);
4132d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 2);
41482b0f4b7SLee Jones 
4155dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", bases[CLKRST3_INDEX],
41682b0f4b7SLee Jones 				BIT(3), 0);
4172d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 3);
41882b0f4b7SLee Jones 
4195dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", bases[CLKRST3_INDEX],
42082b0f4b7SLee Jones 				BIT(4), 0);
4212d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 4);
42282b0f4b7SLee Jones 
4235dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", bases[CLKRST3_INDEX],
42482b0f4b7SLee Jones 				BIT(5), 0);
4252d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 5);
42682b0f4b7SLee Jones 
4275dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", bases[CLKRST3_INDEX],
42882b0f4b7SLee Jones 				BIT(6), 0);
4292d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 6);
43082b0f4b7SLee Jones 
4315dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", bases[CLKRST3_INDEX],
43282b0f4b7SLee Jones 				BIT(7), 0);
4332d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 7);
43482b0f4b7SLee Jones 
4355dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", bases[CLKRST3_INDEX],
43682b0f4b7SLee Jones 				BIT(8), 0);
4372d080300SLee Jones 	PRCC_PCLK_STORE(clk, 3, 8);
43882b0f4b7SLee Jones 
4395dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", bases[CLKRST5_INDEX],
44082b0f4b7SLee Jones 				BIT(0), 0);
4412d080300SLee Jones 	PRCC_PCLK_STORE(clk, 5, 0);
44282b0f4b7SLee Jones 
4435dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", bases[CLKRST5_INDEX],
44482b0f4b7SLee Jones 				BIT(1), 0);
4452d080300SLee Jones 	PRCC_PCLK_STORE(clk, 5, 1);
44682b0f4b7SLee Jones 
4475dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", bases[CLKRST6_INDEX],
44882b0f4b7SLee Jones 				BIT(0), 0);
4492d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 0);
45082b0f4b7SLee Jones 
4515dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", bases[CLKRST6_INDEX],
45282b0f4b7SLee Jones 				BIT(1), 0);
4532d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 1);
45482b0f4b7SLee Jones 
4555dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", bases[CLKRST6_INDEX],
45682b0f4b7SLee Jones 				BIT(2), 0);
4572d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 2);
45882b0f4b7SLee Jones 
4595dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", bases[CLKRST6_INDEX],
46082b0f4b7SLee Jones 				BIT(3), 0);
4612d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 3);
46282b0f4b7SLee Jones 
4635dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", bases[CLKRST6_INDEX],
46482b0f4b7SLee Jones 				BIT(4), 0);
4652d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 4);
46682b0f4b7SLee Jones 
4675dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", bases[CLKRST6_INDEX],
46882b0f4b7SLee Jones 				BIT(5), 0);
4692d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 5);
47082b0f4b7SLee Jones 
4715dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", bases[CLKRST6_INDEX],
47282b0f4b7SLee Jones 				BIT(6), 0);
4732d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 6);
47482b0f4b7SLee Jones 
4755dc0fe19SLinus Walleij 	clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", bases[CLKRST6_INDEX],
47682b0f4b7SLee Jones 				BIT(7), 0);
4772d080300SLee Jones 	PRCC_PCLK_STORE(clk, 6, 7);
47882b0f4b7SLee Jones 
47982b0f4b7SLee Jones 	/* PRCC K-clocks
48082b0f4b7SLee Jones 	 *
48182b0f4b7SLee Jones 	 * FIXME: Some drivers requires PERPIH[n| to be automatically enabled
48282b0f4b7SLee Jones 	 * by enabling just the K-clock, even if it is not a valid parent to
48382b0f4b7SLee Jones 	 * the K-clock. Until drivers get fixed we might need some kind of
48482b0f4b7SLee Jones 	 * "parent muxed join".
48582b0f4b7SLee Jones 	 */
48682b0f4b7SLee Jones 
48782b0f4b7SLee Jones 	/* Periph1 */
48882b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk",
4895dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(0), CLK_SET_RATE_GATE);
49089da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 0);
49182b0f4b7SLee Jones 
49282b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk",
4935dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(1), CLK_SET_RATE_GATE);
49489da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 1);
49582b0f4b7SLee Jones 
49682b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk",
4975dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(2), CLK_SET_RATE_GATE);
49889da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 2);
49982b0f4b7SLee Jones 
50082b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk",
5015dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(3), CLK_SET_RATE_GATE);
50289da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 3);
50382b0f4b7SLee Jones 
50482b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk",
5055dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(4), CLK_SET_RATE_GATE);
50689da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 4);
50782b0f4b7SLee Jones 
50882b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk",
5095dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(5), CLK_SET_RATE_GATE);
51089da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 5);
51182b0f4b7SLee Jones 
51282b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk",
5135dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(6), CLK_SET_RATE_GATE);
51489da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 6);
51582b0f4b7SLee Jones 
51682b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk",
5175dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(8), CLK_SET_RATE_GATE);
51889da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 8);
51982b0f4b7SLee Jones 
52082b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk",
5215dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(9), CLK_SET_RATE_GATE);
52289da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 9);
52382b0f4b7SLee Jones 
52482b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk",
5255dc0fe19SLinus Walleij 			bases[CLKRST1_INDEX], BIT(10), CLK_SET_RATE_GATE);
52689da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 1, 10);
52782b0f4b7SLee Jones 
52882b0f4b7SLee Jones 	/* Periph2 */
52982b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk",
5305dc0fe19SLinus Walleij 			bases[CLKRST2_INDEX], BIT(0), CLK_SET_RATE_GATE);
53189da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 2, 0);
53282b0f4b7SLee Jones 
53382b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk",
5345dc0fe19SLinus Walleij 			bases[CLKRST2_INDEX], BIT(2), CLK_SET_RATE_GATE);
53589da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 2, 2);
53682b0f4b7SLee Jones 
53782b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk",
5385dc0fe19SLinus Walleij 			bases[CLKRST2_INDEX], BIT(3), CLK_SET_RATE_GATE);
53989da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 2, 3);
54082b0f4b7SLee Jones 
54182b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk",
5425dc0fe19SLinus Walleij 			bases[CLKRST2_INDEX], BIT(4), CLK_SET_RATE_GATE);
54389da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 2, 4);
54482b0f4b7SLee Jones 
54582b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk",
5465dc0fe19SLinus Walleij 			bases[CLKRST2_INDEX], BIT(5), CLK_SET_RATE_GATE);
54789da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 2, 5);
54882b0f4b7SLee Jones 
54982b0f4b7SLee Jones 	/* Note that rate is received from parent. */
55082b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk",
5515dc0fe19SLinus Walleij 			bases[CLKRST2_INDEX], BIT(6),
55282b0f4b7SLee Jones 			CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT);
55389da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 2, 6);
55489da2dfaSLee Jones 
55582b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk",
5565dc0fe19SLinus Walleij 			bases[CLKRST2_INDEX], BIT(7),
55782b0f4b7SLee Jones 			CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT);
55889da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 2, 7);
55982b0f4b7SLee Jones 
56082b0f4b7SLee Jones 	/* Periph3 */
56182b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk",
5625dc0fe19SLinus Walleij 			bases[CLKRST3_INDEX], BIT(1), CLK_SET_RATE_GATE);
56389da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 3, 1);
56482b0f4b7SLee Jones 
56582b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk",
5665dc0fe19SLinus Walleij 			bases[CLKRST3_INDEX], BIT(2), CLK_SET_RATE_GATE);
56789da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 3, 2);
56882b0f4b7SLee Jones 
56982b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk",
5705dc0fe19SLinus Walleij 			bases[CLKRST3_INDEX], BIT(3), CLK_SET_RATE_GATE);
57189da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 3, 3);
57282b0f4b7SLee Jones 
57382b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk",
5745dc0fe19SLinus Walleij 			bases[CLKRST3_INDEX], BIT(4), CLK_SET_RATE_GATE);
57589da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 3, 4);
57682b0f4b7SLee Jones 
57782b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k",
5785dc0fe19SLinus Walleij 			bases[CLKRST3_INDEX], BIT(5), CLK_SET_RATE_GATE);
57989da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 3, 5);
58082b0f4b7SLee Jones 
58182b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk",
5825dc0fe19SLinus Walleij 			bases[CLKRST3_INDEX], BIT(6), CLK_SET_RATE_GATE);
58389da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 3, 6);
58482b0f4b7SLee Jones 
58582b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk",
5865dc0fe19SLinus Walleij 			bases[CLKRST3_INDEX], BIT(7), CLK_SET_RATE_GATE);
58789da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 3, 7);
58882b0f4b7SLee Jones 
58982b0f4b7SLee Jones 	/* Periph6 */
59082b0f4b7SLee Jones 	clk = clk_reg_prcc_kclk("p3_rng_kclk", "rngclk",
5915dc0fe19SLinus Walleij 			bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE);
59289da2dfaSLee Jones 	PRCC_KCLK_STORE(clk, 6, 0);
593dec759d8SLee Jones 
594dec759d8SLee Jones 	for_each_child_of_node(np, child) {
595a8173c59SLinus Walleij 		if (of_node_name_eq(child, "prcmu-clock"))
596a8173c59SLinus Walleij 			of_clk_add_hw_provider(child, of_clk_hw_onecell_get,
597a8173c59SLinus Walleij 					       &u8500_prcmu_hw_clks);
598f9fcb8e8SLee Jones 
599*639d5661SLinus Walleij 		if (of_node_name_eq(child, "clkout-clock"))
600*639d5661SLinus Walleij 			of_clk_add_hw_provider(child, ux500_clkout_get, NULL);
601*639d5661SLinus Walleij 
60287ab1151SRob Herring 		if (of_node_name_eq(child, "prcc-periph-clock"))
6032d080300SLee Jones 			of_clk_add_provider(child, ux500_twocell_get, prcc_pclk);
60489da2dfaSLee Jones 
60587ab1151SRob Herring 		if (of_node_name_eq(child, "prcc-kernel-clock"))
60689da2dfaSLee Jones 			of_clk_add_provider(child, ux500_twocell_get, prcc_kclk);
607d625a730SLee Jones 
60887ab1151SRob Herring 		if (of_node_name_eq(child, "rtc32k-clock"))
609d625a730SLee Jones 			of_clk_add_provider(child, of_clk_src_simple_get, rtc_clk);
6104e334660SLee Jones 
61187ab1151SRob Herring 		if (of_node_name_eq(child, "smp-twd-clock"))
6124e334660SLee Jones 			of_clk_add_provider(child, of_clk_src_simple_get, twd_clk);
613b14cbdfdSLinus Walleij 
614b14cbdfdSLinus Walleij 		if (of_node_name_eq(child, "prcc-reset-controller"))
615b14cbdfdSLinus Walleij 			u8500_prcc_reset_init(child, rstc);
616dec759d8SLee Jones 	}
61782b0f4b7SLee Jones }
618269f1aacSArnd Bergmann CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init);
619