blob: 271c09644652c72e3f057e8d90b2ebcb1d1f258c [file] [log] [blame]
Lee Jones82b0f4b2013-09-17 10:11:53 +01001/*
2 * Clock definitions for u8500 platform.
3 *
4 * Copyright (C) 2012 ST-Ericsson SA
5 * Author: Ulf Hansson <ulf.hansson@linaro.org>
6 *
7 * License terms: GNU General Public License (GPL) version 2
8 */
9
Lee Jonesdec759d2013-09-17 10:26:24 +010010#include <linux/of.h>
Linus Walleij5dc0fe12015-07-30 15:19:25 +020011#include <linux/of_address.h>
Lee Jones82b0f4b2013-09-17 10:11:53 +010012#include <linux/clk-provider.h>
13#include <linux/mfd/dbx500-prcmu.h>
14#include <linux/platform_data/clk-ux500.h>
15#include "clk.h"
16
Lee Jones2d080302013-09-17 10:31:39 +010017#define PRCC_NUM_PERIPH_CLUSTERS 6
18#define PRCC_PERIPHS_PER_CLUSTER 32
19
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010020static struct clk *prcmu_clk[PRCMU_NUM_CLKS];
Lee Jones2d080302013-09-17 10:31:39 +010021static struct clk *prcc_pclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
Lee Jones89da2df2013-09-17 10:33:05 +010022static struct clk *prcc_kclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010023
Lee Jonesb4bdc812013-07-22 13:13:01 +010024#define PRCC_SHOW(clk, base, bit) \
25 clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit]
Lee Jones2d080302013-09-17 10:31:39 +010026#define PRCC_PCLK_STORE(clk, base, bit) \
27 prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
Lee Jones89da2df2013-09-17 10:33:05 +010028#define PRCC_KCLK_STORE(clk, base, bit) \
29 prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
Lee Jonesb4bdc812013-07-22 13:13:01 +010030
Sachin Kamatc112c1d2014-01-15 11:13:26 +053031static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec,
32 void *data)
Lee Jonesb4bdc812013-07-22 13:13:01 +010033{
34 struct clk **clk_data = data;
35 unsigned int base, bit;
36
37 if (clkspec->args_count != 2)
38 return ERR_PTR(-EINVAL);
39
40 base = clkspec->args[0];
41 bit = clkspec->args[1];
42
43 if (base != 1 && base != 2 && base != 3 && base != 5 && base != 6) {
44 pr_err("%s: invalid PRCC base %d\n", __func__, base);
45 return ERR_PTR(-EINVAL);
46 }
47
48 return PRCC_SHOW(clk_data, base, bit);
49}
50
Lee Jonesdec759d2013-09-17 10:26:24 +010051static const struct of_device_id u8500_clk_of_match[] = {
52 { .compatible = "stericsson,u8500-clks", },
53 { },
54};
55
Linus Walleij5dc0fe12015-07-30 15:19:25 +020056/* CLKRST4 is missing making it hard to index things */
57enum clkrst_index {
58 CLKRST1_INDEX = 0,
59 CLKRST2_INDEX,
60 CLKRST3_INDEX,
61 CLKRST5_INDEX,
62 CLKRST6_INDEX,
63 CLKRST_MAX,
64};
65
66void u8500_clk_init(void)
Lee Jones82b0f4b2013-09-17 10:11:53 +010067{
68 struct prcmu_fw_version *fw_version;
Lee Jonesdec759d2013-09-17 10:26:24 +010069 struct device_node *np = NULL;
70 struct device_node *child = NULL;
Lee Jones82b0f4b2013-09-17 10:11:53 +010071 const char *sgaclk_parent = NULL;
Lee Jones4e334662013-09-17 10:35:00 +010072 struct clk *clk, *rtc_clk, *twd_clk;
Linus Walleij5dc0fe12015-07-30 15:19:25 +020073 u32 bases[CLKRST_MAX];
74 int i;
Lee Jones82b0f4b2013-09-17 10:11:53 +010075
Lee Jonesdec759d2013-09-17 10:26:24 +010076 if (of_have_populated_dt())
77 np = of_find_matching_node(NULL, u8500_clk_of_match);
78 if (!np) {
79 pr_err("Either DT or U8500 Clock node not found\n");
80 return;
81 }
Linus Walleij5dc0fe12015-07-30 15:19:25 +020082 for (i = 0; i < ARRAY_SIZE(bases); i++) {
83 struct resource r;
84
85 if (of_address_to_resource(np, i, &r))
86 /* Not much choice but to continue */
87 pr_err("failed to get CLKRST %d base address\n",
88 i + 1);
89 bases[i] = r.start;
90 }
Lee Jonesdec759d2013-09-17 10:26:24 +010091
Lee Jones82b0f4b2013-09-17 10:11:53 +010092 /* Clock sources */
93 clk = clk_reg_prcmu_gate("soc0_pll", NULL, PRCMU_PLLSOC0,
94 CLK_IS_ROOT|CLK_IGNORE_UNUSED);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010095 prcmu_clk[PRCMU_PLLSOC0] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +010096
97 clk = clk_reg_prcmu_gate("soc1_pll", NULL, PRCMU_PLLSOC1,
98 CLK_IS_ROOT|CLK_IGNORE_UNUSED);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010099 prcmu_clk[PRCMU_PLLSOC1] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100100
101 clk = clk_reg_prcmu_gate("ddr_pll", NULL, PRCMU_PLLDDR,
102 CLK_IS_ROOT|CLK_IGNORE_UNUSED);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100103 prcmu_clk[PRCMU_PLLDDR] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100104
105 /* FIXME: Add sys, ulp and int clocks here. */
106
Lee Jonesd625a732013-09-17 10:34:24 +0100107 rtc_clk = clk_register_fixed_rate(NULL, "rtc32k", "NULL",
Lee Jones82b0f4b2013-09-17 10:11:53 +0100108 CLK_IS_ROOT|CLK_IGNORE_UNUSED,
109 32768);
110
111 /* PRCMU clocks */
112 fw_version = prcmu_get_fw_version();
113 if (fw_version != NULL) {
114 switch (fw_version->project) {
115 case PRCMU_FW_PROJECT_U8500_C2:
116 case PRCMU_FW_PROJECT_U8520:
117 case PRCMU_FW_PROJECT_U8420:
118 sgaclk_parent = "soc0_pll";
119 break;
120 default:
121 break;
122 }
123 }
124
125 if (sgaclk_parent)
126 clk = clk_reg_prcmu_gate("sgclk", sgaclk_parent,
127 PRCMU_SGACLK, 0);
128 else
129 clk = clk_reg_prcmu_gate("sgclk", NULL,
130 PRCMU_SGACLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100131 prcmu_clk[PRCMU_SGACLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100132
133 clk = clk_reg_prcmu_gate("uartclk", NULL, PRCMU_UARTCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100134 prcmu_clk[PRCMU_UARTCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100135
136 clk = clk_reg_prcmu_gate("msp02clk", NULL, PRCMU_MSP02CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100137 prcmu_clk[PRCMU_MSP02CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100138
139 clk = clk_reg_prcmu_gate("msp1clk", NULL, PRCMU_MSP1CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100140 prcmu_clk[PRCMU_MSP1CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100141
142 clk = clk_reg_prcmu_gate("i2cclk", NULL, PRCMU_I2CCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100143 prcmu_clk[PRCMU_I2CCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100144
145 clk = clk_reg_prcmu_gate("slimclk", NULL, PRCMU_SLIMCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100146 prcmu_clk[PRCMU_SLIMCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100147
148 clk = clk_reg_prcmu_gate("per1clk", NULL, PRCMU_PER1CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100149 prcmu_clk[PRCMU_PER1CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100150
151 clk = clk_reg_prcmu_gate("per2clk", NULL, PRCMU_PER2CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100152 prcmu_clk[PRCMU_PER2CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100153
154 clk = clk_reg_prcmu_gate("per3clk", NULL, PRCMU_PER3CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100155 prcmu_clk[PRCMU_PER3CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100156
157 clk = clk_reg_prcmu_gate("per5clk", NULL, PRCMU_PER5CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100158 prcmu_clk[PRCMU_PER5CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100159
160 clk = clk_reg_prcmu_gate("per6clk", NULL, PRCMU_PER6CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100161 prcmu_clk[PRCMU_PER6CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100162
163 clk = clk_reg_prcmu_gate("per7clk", NULL, PRCMU_PER7CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100164 prcmu_clk[PRCMU_PER7CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100165
166 clk = clk_reg_prcmu_scalable("lcdclk", NULL, PRCMU_LCDCLK, 0,
167 CLK_IS_ROOT|CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100168 prcmu_clk[PRCMU_LCDCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100169
170 clk = clk_reg_prcmu_opp_gate("bmlclk", NULL, PRCMU_BMLCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100171 prcmu_clk[PRCMU_BMLCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100172
173 clk = clk_reg_prcmu_scalable("hsitxclk", NULL, PRCMU_HSITXCLK, 0,
174 CLK_IS_ROOT|CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100175 prcmu_clk[PRCMU_HSITXCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100176
177 clk = clk_reg_prcmu_scalable("hsirxclk", NULL, PRCMU_HSIRXCLK, 0,
178 CLK_IS_ROOT|CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100179 prcmu_clk[PRCMU_HSIRXCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100180
181 clk = clk_reg_prcmu_scalable("hdmiclk", NULL, PRCMU_HDMICLK, 0,
182 CLK_IS_ROOT|CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100183 prcmu_clk[PRCMU_HDMICLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100184
185 clk = clk_reg_prcmu_gate("apeatclk", NULL, PRCMU_APEATCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100186 prcmu_clk[PRCMU_APEATCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100187
Linus Walleija6ae41b2015-04-20 15:06:28 +0200188 clk = clk_reg_prcmu_scalable("apetraceclk", NULL, PRCMU_APETRACECLK, 0,
189 CLK_IS_ROOT|CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100190 prcmu_clk[PRCMU_APETRACECLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100191
192 clk = clk_reg_prcmu_gate("mcdeclk", NULL, PRCMU_MCDECLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100193 prcmu_clk[PRCMU_MCDECLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100194
195 clk = clk_reg_prcmu_opp_gate("ipi2cclk", NULL, PRCMU_IPI2CCLK,
196 CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100197 prcmu_clk[PRCMU_IPI2CCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100198
199 clk = clk_reg_prcmu_gate("dsialtclk", NULL, PRCMU_DSIALTCLK,
200 CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100201 prcmu_clk[PRCMU_DSIALTCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100202
203 clk = clk_reg_prcmu_gate("dmaclk", NULL, PRCMU_DMACLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100204 prcmu_clk[PRCMU_DMACLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100205
206 clk = clk_reg_prcmu_gate("b2r2clk", NULL, PRCMU_B2R2CLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100207 prcmu_clk[PRCMU_B2R2CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100208
209 clk = clk_reg_prcmu_scalable("tvclk", NULL, PRCMU_TVCLK, 0,
210 CLK_IS_ROOT|CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100211 prcmu_clk[PRCMU_TVCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100212
213 clk = clk_reg_prcmu_gate("sspclk", NULL, PRCMU_SSPCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100214 prcmu_clk[PRCMU_SSPCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100215
216 clk = clk_reg_prcmu_gate("rngclk", NULL, PRCMU_RNGCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100217 prcmu_clk[PRCMU_RNGCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100218
219 clk = clk_reg_prcmu_gate("uiccclk", NULL, PRCMU_UICCCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100220 prcmu_clk[PRCMU_UICCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100221
222 clk = clk_reg_prcmu_gate("timclk", NULL, PRCMU_TIMCLK, CLK_IS_ROOT);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100223 prcmu_clk[PRCMU_TIMCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100224
225 clk = clk_reg_prcmu_opp_volt_scalable("sdmmcclk", NULL, PRCMU_SDMMCCLK,
226 100000000,
227 CLK_IS_ROOT|CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100228 prcmu_clk[PRCMU_SDMMCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100229
230 clk = clk_reg_prcmu_scalable("dsi_pll", "hdmiclk",
231 PRCMU_PLLDSI, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100232 prcmu_clk[PRCMU_PLLDSI] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100233
234 clk = clk_reg_prcmu_scalable("dsi0clk", "dsi_pll",
235 PRCMU_DSI0CLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100236 prcmu_clk[PRCMU_DSI0CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100237
238 clk = clk_reg_prcmu_scalable("dsi1clk", "dsi_pll",
239 PRCMU_DSI1CLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100240 prcmu_clk[PRCMU_DSI1CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100241
242 clk = clk_reg_prcmu_scalable("dsi0escclk", "tvclk",
243 PRCMU_DSI0ESCCLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100244 prcmu_clk[PRCMU_DSI0ESCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100245
246 clk = clk_reg_prcmu_scalable("dsi1escclk", "tvclk",
247 PRCMU_DSI1ESCCLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100248 prcmu_clk[PRCMU_DSI1ESCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100249
250 clk = clk_reg_prcmu_scalable("dsi2escclk", "tvclk",
251 PRCMU_DSI2ESCCLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100252 prcmu_clk[PRCMU_DSI2ESCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100253
254 clk = clk_reg_prcmu_scalable_rate("armss", NULL,
255 PRCMU_ARMSS, 0, CLK_IS_ROOT|CLK_IGNORE_UNUSED);
Lee Jones257015a2013-09-18 16:09:38 +0100256 prcmu_clk[PRCMU_ARMSS] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100257
Lee Jones4e334662013-09-17 10:35:00 +0100258 twd_clk = clk_register_fixed_factor(NULL, "smp_twd", "armss",
Lee Jones82b0f4b2013-09-17 10:11:53 +0100259 CLK_IGNORE_UNUSED, 1, 2);
260
261 /*
262 * FIXME: Add special handled PRCMU clocks here:
263 * 1. clkout0yuv, use PRCMU as parent + need regulator + pinctrl.
264 * 2. ab9540_clkout1yuv, see clkout0yuv
265 */
266
267 /* PRCC P-clocks */
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200268 clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100269 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100270 PRCC_PCLK_STORE(clk, 1, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100271
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200272 clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100273 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100274 PRCC_PCLK_STORE(clk, 1, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100275
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200276 clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100277 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100278 PRCC_PCLK_STORE(clk, 1, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100279
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200280 clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100281 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100282 PRCC_PCLK_STORE(clk, 1, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100283
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200284 clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100285 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100286 PRCC_PCLK_STORE(clk, 1, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100287
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200288 clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100289 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100290 PRCC_PCLK_STORE(clk, 1, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100291
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200292 clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100293 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100294 PRCC_PCLK_STORE(clk, 1, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100295
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200296 clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100297 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100298 PRCC_PCLK_STORE(clk, 1, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100299
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200300 clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100301 BIT(8), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100302 PRCC_PCLK_STORE(clk, 1, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100303
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200304 clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100305 BIT(9), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100306 PRCC_PCLK_STORE(clk, 1, 9);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100307
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200308 clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100309 BIT(10), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100310 PRCC_PCLK_STORE(clk, 1, 10);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100311
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200312 clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100313 BIT(11), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100314 PRCC_PCLK_STORE(clk, 1, 11);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100315
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200316 clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100317 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100318 PRCC_PCLK_STORE(clk, 2, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100319
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200320 clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100321 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100322 PRCC_PCLK_STORE(clk, 2, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100323
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200324 clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100325 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100326 PRCC_PCLK_STORE(clk, 2, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100327
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200328 clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100329 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100330 PRCC_PCLK_STORE(clk, 2, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100331
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200332 clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100333 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100334 PRCC_PCLK_STORE(clk, 2, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100335
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200336 clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100337 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100338 PRCC_PCLK_STORE(clk, 2, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100339
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200340 clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100341 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100342 PRCC_PCLK_STORE(clk, 2, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100343
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200344 clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100345 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100346 PRCC_PCLK_STORE(clk, 2, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100347
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200348 clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100349 BIT(8), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100350 PRCC_PCLK_STORE(clk, 2, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100351
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200352 clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100353 BIT(9), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100354 PRCC_PCLK_STORE(clk, 2, 9);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100355
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200356 clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100357 BIT(10), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100358 PRCC_PCLK_STORE(clk, 2, 10);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100359
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200360 clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100361 BIT(11), 0);
Linus Walleijf5ff9a12013-10-18 10:56:14 +0200362 PRCC_PCLK_STORE(clk, 2, 11);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100363
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200364 clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100365 BIT(12), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100366 PRCC_PCLK_STORE(clk, 2, 12);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100367
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200368 clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100369 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100370 PRCC_PCLK_STORE(clk, 3, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100371
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200372 clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100373 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100374 PRCC_PCLK_STORE(clk, 3, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100375
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200376 clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100377 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100378 PRCC_PCLK_STORE(clk, 3, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100379
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200380 clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100381 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100382 PRCC_PCLK_STORE(clk, 3, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100383
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200384 clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100385 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100386 PRCC_PCLK_STORE(clk, 3, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100387
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200388 clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100389 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100390 PRCC_PCLK_STORE(clk, 3, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100391
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200392 clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100393 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100394 PRCC_PCLK_STORE(clk, 3, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100395
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200396 clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100397 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100398 PRCC_PCLK_STORE(clk, 3, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100399
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200400 clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100401 BIT(8), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100402 PRCC_PCLK_STORE(clk, 3, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100403
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200404 clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", bases[CLKRST5_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100405 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100406 PRCC_PCLK_STORE(clk, 5, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100407
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200408 clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", bases[CLKRST5_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100409 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100410 PRCC_PCLK_STORE(clk, 5, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100411
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200412 clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100413 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100414 PRCC_PCLK_STORE(clk, 6, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100415
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200416 clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100417 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100418 PRCC_PCLK_STORE(clk, 6, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100419
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200420 clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100421 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100422 PRCC_PCLK_STORE(clk, 6, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100423
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200424 clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100425 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100426 PRCC_PCLK_STORE(clk, 6, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100427
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200428 clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100429 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100430 PRCC_PCLK_STORE(clk, 6, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100431
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200432 clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100433 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100434 PRCC_PCLK_STORE(clk, 6, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100435
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200436 clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100437 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100438 PRCC_PCLK_STORE(clk, 6, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100439
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200440 clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100441 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100442 PRCC_PCLK_STORE(clk, 6, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100443
444 /* PRCC K-clocks
445 *
446 * FIXME: Some drivers requires PERPIH[n| to be automatically enabled
447 * by enabling just the K-clock, even if it is not a valid parent to
448 * the K-clock. Until drivers get fixed we might need some kind of
449 * "parent muxed join".
450 */
451
452 /* Periph1 */
453 clk = clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200454 bases[CLKRST1_INDEX], BIT(0), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100455 PRCC_KCLK_STORE(clk, 1, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100456
457 clk = clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200458 bases[CLKRST1_INDEX], BIT(1), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100459 PRCC_KCLK_STORE(clk, 1, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100460
461 clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200462 bases[CLKRST1_INDEX], BIT(2), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100463 PRCC_KCLK_STORE(clk, 1, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100464
465 clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200466 bases[CLKRST1_INDEX], BIT(3), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100467 PRCC_KCLK_STORE(clk, 1, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100468
469 clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200470 bases[CLKRST1_INDEX], BIT(4), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100471 PRCC_KCLK_STORE(clk, 1, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100472
473 clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200474 bases[CLKRST1_INDEX], BIT(5), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100475 PRCC_KCLK_STORE(clk, 1, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100476
477 clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200478 bases[CLKRST1_INDEX], BIT(6), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100479 PRCC_KCLK_STORE(clk, 1, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100480
481 clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200482 bases[CLKRST1_INDEX], BIT(8), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100483 PRCC_KCLK_STORE(clk, 1, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100484
485 clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200486 bases[CLKRST1_INDEX], BIT(9), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100487 PRCC_KCLK_STORE(clk, 1, 9);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100488
489 clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200490 bases[CLKRST1_INDEX], BIT(10), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100491 PRCC_KCLK_STORE(clk, 1, 10);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100492
493 /* Periph2 */
494 clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200495 bases[CLKRST2_INDEX], BIT(0), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100496 PRCC_KCLK_STORE(clk, 2, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100497
498 clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200499 bases[CLKRST2_INDEX], BIT(2), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100500 PRCC_KCLK_STORE(clk, 2, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100501
502 clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200503 bases[CLKRST2_INDEX], BIT(3), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100504 PRCC_KCLK_STORE(clk, 2, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100505
506 clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200507 bases[CLKRST2_INDEX], BIT(4), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100508 PRCC_KCLK_STORE(clk, 2, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100509
510 clk = clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200511 bases[CLKRST2_INDEX], BIT(5), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100512 PRCC_KCLK_STORE(clk, 2, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100513
514 /* Note that rate is received from parent. */
515 clk = clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200516 bases[CLKRST2_INDEX], BIT(6),
Lee Jones82b0f4b2013-09-17 10:11:53 +0100517 CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT);
Lee Jones89da2df2013-09-17 10:33:05 +0100518 PRCC_KCLK_STORE(clk, 2, 6);
519
Lee Jones82b0f4b2013-09-17 10:11:53 +0100520 clk = clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200521 bases[CLKRST2_INDEX], BIT(7),
Lee Jones82b0f4b2013-09-17 10:11:53 +0100522 CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT);
Lee Jones89da2df2013-09-17 10:33:05 +0100523 PRCC_KCLK_STORE(clk, 2, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100524
525 /* Periph3 */
526 clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200527 bases[CLKRST3_INDEX], BIT(1), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100528 PRCC_KCLK_STORE(clk, 3, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100529
530 clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200531 bases[CLKRST3_INDEX], BIT(2), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100532 PRCC_KCLK_STORE(clk, 3, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100533
534 clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200535 bases[CLKRST3_INDEX], BIT(3), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100536 PRCC_KCLK_STORE(clk, 3, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100537
538 clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200539 bases[CLKRST3_INDEX], BIT(4), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100540 PRCC_KCLK_STORE(clk, 3, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100541
542 clk = clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200543 bases[CLKRST3_INDEX], BIT(5), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100544 PRCC_KCLK_STORE(clk, 3, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100545
546 clk = clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200547 bases[CLKRST3_INDEX], BIT(6), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100548 PRCC_KCLK_STORE(clk, 3, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100549
550 clk = clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200551 bases[CLKRST3_INDEX], BIT(7), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100552 PRCC_KCLK_STORE(clk, 3, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100553
554 /* Periph6 */
555 clk = clk_reg_prcc_kclk("p3_rng_kclk", "rngclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200556 bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100557 PRCC_KCLK_STORE(clk, 6, 0);
Lee Jonesdec759d2013-09-17 10:26:24 +0100558
559 for_each_child_of_node(np, child) {
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100560 static struct clk_onecell_data clk_data;
561
562 if (!of_node_cmp(child->name, "prcmu-clock")) {
563 clk_data.clks = prcmu_clk;
564 clk_data.clk_num = ARRAY_SIZE(prcmu_clk);
565 of_clk_add_provider(child, of_clk_src_onecell_get, &clk_data);
566 }
Lee Jones2d080302013-09-17 10:31:39 +0100567 if (!of_node_cmp(child->name, "prcc-periph-clock"))
568 of_clk_add_provider(child, ux500_twocell_get, prcc_pclk);
Lee Jones89da2df2013-09-17 10:33:05 +0100569
570 if (!of_node_cmp(child->name, "prcc-kernel-clock"))
571 of_clk_add_provider(child, ux500_twocell_get, prcc_kclk);
Lee Jonesd625a732013-09-17 10:34:24 +0100572
573 if (!of_node_cmp(child->name, "rtc32k-clock"))
574 of_clk_add_provider(child, of_clk_src_simple_get, rtc_clk);
Lee Jones4e334662013-09-17 10:35:00 +0100575
576 if (!of_node_cmp(child->name, "smp-twd-clock"))
577 of_clk_add_provider(child, of_clk_src_simple_get, twd_clk);
Lee Jonesdec759d2013-09-17 10:26:24 +0100578 }
Lee Jones82b0f4b2013-09-17 10:11:53 +0100579}