blob: e960d686d9db81ebf282cc37e09d2fde5b0317c2 [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>
Lee Jones82b0f4b2013-09-17 10:11:53 +010014#include "clk.h"
15
Lee Jones2d080302013-09-17 10:31:39 +010016#define PRCC_NUM_PERIPH_CLUSTERS 6
17#define PRCC_PERIPHS_PER_CLUSTER 32
18
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010019static struct clk *prcmu_clk[PRCMU_NUM_CLKS];
Lee Jones2d080302013-09-17 10:31:39 +010020static struct clk *prcc_pclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
Lee Jones89da2df2013-09-17 10:33:05 +010021static struct clk *prcc_kclk[(PRCC_NUM_PERIPH_CLUSTERS + 1) * PRCC_PERIPHS_PER_CLUSTER];
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010022
Lee Jonesb4bdc812013-07-22 13:13:01 +010023#define PRCC_SHOW(clk, base, bit) \
24 clk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit]
Lee Jones2d080302013-09-17 10:31:39 +010025#define PRCC_PCLK_STORE(clk, base, bit) \
26 prcc_pclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
Lee Jones89da2df2013-09-17 10:33:05 +010027#define PRCC_KCLK_STORE(clk, base, bit) \
28 prcc_kclk[(base * PRCC_PERIPHS_PER_CLUSTER) + bit] = clk
Lee Jonesb4bdc812013-07-22 13:13:01 +010029
Sachin Kamatc112c1d2014-01-15 11:13:26 +053030static struct clk *ux500_twocell_get(struct of_phandle_args *clkspec,
31 void *data)
Lee Jonesb4bdc812013-07-22 13:13:01 +010032{
33 struct clk **clk_data = data;
34 unsigned int base, bit;
35
36 if (clkspec->args_count != 2)
37 return ERR_PTR(-EINVAL);
38
39 base = clkspec->args[0];
40 bit = clkspec->args[1];
41
42 if (base != 1 && base != 2 && base != 3 && base != 5 && base != 6) {
43 pr_err("%s: invalid PRCC base %d\n", __func__, base);
44 return ERR_PTR(-EINVAL);
45 }
46
47 return PRCC_SHOW(clk_data, base, bit);
48}
49
Linus Walleij5dc0fe12015-07-30 15:19:25 +020050/* CLKRST4 is missing making it hard to index things */
51enum clkrst_index {
52 CLKRST1_INDEX = 0,
53 CLKRST2_INDEX,
54 CLKRST3_INDEX,
55 CLKRST5_INDEX,
56 CLKRST6_INDEX,
57 CLKRST_MAX,
58};
59
Arnd Bergmann269f1aa2016-06-20 22:47:53 +020060static void u8500_clk_init(struct device_node *np)
Lee Jones82b0f4b2013-09-17 10:11:53 +010061{
62 struct prcmu_fw_version *fw_version;
Lee Jonesdec759d2013-09-17 10:26:24 +010063 struct device_node *child = NULL;
Lee Jones82b0f4b2013-09-17 10:11:53 +010064 const char *sgaclk_parent = NULL;
Lee Jones4e334662013-09-17 10:35:00 +010065 struct clk *clk, *rtc_clk, *twd_clk;
Linus Walleij5dc0fe12015-07-30 15:19:25 +020066 u32 bases[CLKRST_MAX];
67 int i;
Lee Jones82b0f4b2013-09-17 10:11:53 +010068
Linus Walleij5dc0fe12015-07-30 15:19:25 +020069 for (i = 0; i < ARRAY_SIZE(bases); i++) {
70 struct resource r;
71
72 if (of_address_to_resource(np, i, &r))
73 /* Not much choice but to continue */
74 pr_err("failed to get CLKRST %d base address\n",
75 i + 1);
76 bases[i] = r.start;
77 }
Lee Jonesdec759d2013-09-17 10:26:24 +010078
Lee Jones82b0f4b2013-09-17 10:11:53 +010079 /* Clock sources */
80 clk = clk_reg_prcmu_gate("soc0_pll", NULL, PRCMU_PLLSOC0,
Stephen Boyd66f4ae72016-03-01 11:00:04 -080081 CLK_IGNORE_UNUSED);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010082 prcmu_clk[PRCMU_PLLSOC0] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +010083
84 clk = clk_reg_prcmu_gate("soc1_pll", NULL, PRCMU_PLLSOC1,
Stephen Boyd66f4ae72016-03-01 11:00:04 -080085 CLK_IGNORE_UNUSED);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010086 prcmu_clk[PRCMU_PLLSOC1] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +010087
88 clk = clk_reg_prcmu_gate("ddr_pll", NULL, PRCMU_PLLDDR,
Stephen Boyd66f4ae72016-03-01 11:00:04 -080089 CLK_IGNORE_UNUSED);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +010090 prcmu_clk[PRCMU_PLLDDR] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +010091
92 /* FIXME: Add sys, ulp and int clocks here. */
93
Lee Jonesd625a732013-09-17 10:34:24 +010094 rtc_clk = clk_register_fixed_rate(NULL, "rtc32k", "NULL",
Stephen Boyd66f4ae72016-03-01 11:00:04 -080095 CLK_IGNORE_UNUSED,
Lee Jones82b0f4b2013-09-17 10:11:53 +010096 32768);
97
98 /* PRCMU clocks */
99 fw_version = prcmu_get_fw_version();
100 if (fw_version != NULL) {
101 switch (fw_version->project) {
102 case PRCMU_FW_PROJECT_U8500_C2:
103 case PRCMU_FW_PROJECT_U8520:
104 case PRCMU_FW_PROJECT_U8420:
105 sgaclk_parent = "soc0_pll";
106 break;
107 default:
108 break;
109 }
110 }
111
112 if (sgaclk_parent)
113 clk = clk_reg_prcmu_gate("sgclk", sgaclk_parent,
114 PRCMU_SGACLK, 0);
115 else
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800116 clk = clk_reg_prcmu_gate("sgclk", NULL, PRCMU_SGACLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100117 prcmu_clk[PRCMU_SGACLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100118
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800119 clk = clk_reg_prcmu_gate("uartclk", NULL, PRCMU_UARTCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100120 prcmu_clk[PRCMU_UARTCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100121
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800122 clk = clk_reg_prcmu_gate("msp02clk", NULL, PRCMU_MSP02CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100123 prcmu_clk[PRCMU_MSP02CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100124
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800125 clk = clk_reg_prcmu_gate("msp1clk", NULL, PRCMU_MSP1CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100126 prcmu_clk[PRCMU_MSP1CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100127
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800128 clk = clk_reg_prcmu_gate("i2cclk", NULL, PRCMU_I2CCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100129 prcmu_clk[PRCMU_I2CCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100130
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800131 clk = clk_reg_prcmu_gate("slimclk", NULL, PRCMU_SLIMCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100132 prcmu_clk[PRCMU_SLIMCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100133
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800134 clk = clk_reg_prcmu_gate("per1clk", NULL, PRCMU_PER1CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100135 prcmu_clk[PRCMU_PER1CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100136
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800137 clk = clk_reg_prcmu_gate("per2clk", NULL, PRCMU_PER2CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100138 prcmu_clk[PRCMU_PER2CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100139
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800140 clk = clk_reg_prcmu_gate("per3clk", NULL, PRCMU_PER3CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100141 prcmu_clk[PRCMU_PER3CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100142
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800143 clk = clk_reg_prcmu_gate("per5clk", NULL, PRCMU_PER5CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100144 prcmu_clk[PRCMU_PER5CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100145
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800146 clk = clk_reg_prcmu_gate("per6clk", NULL, PRCMU_PER6CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100147 prcmu_clk[PRCMU_PER6CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100148
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800149 clk = clk_reg_prcmu_gate("per7clk", NULL, PRCMU_PER7CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100150 prcmu_clk[PRCMU_PER7CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100151
152 clk = clk_reg_prcmu_scalable("lcdclk", NULL, PRCMU_LCDCLK, 0,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800153 CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100154 prcmu_clk[PRCMU_LCDCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100155
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800156 clk = clk_reg_prcmu_opp_gate("bmlclk", NULL, PRCMU_BMLCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100157 prcmu_clk[PRCMU_BMLCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100158
159 clk = clk_reg_prcmu_scalable("hsitxclk", NULL, PRCMU_HSITXCLK, 0,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800160 CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100161 prcmu_clk[PRCMU_HSITXCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100162
163 clk = clk_reg_prcmu_scalable("hsirxclk", NULL, PRCMU_HSIRXCLK, 0,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800164 CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100165 prcmu_clk[PRCMU_HSIRXCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100166
167 clk = clk_reg_prcmu_scalable("hdmiclk", NULL, PRCMU_HDMICLK, 0,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800168 CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100169 prcmu_clk[PRCMU_HDMICLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100170
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800171 clk = clk_reg_prcmu_gate("apeatclk", NULL, PRCMU_APEATCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100172 prcmu_clk[PRCMU_APEATCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100173
Linus Walleija6ae41b2015-04-20 15:06:28 +0200174 clk = clk_reg_prcmu_scalable("apetraceclk", NULL, PRCMU_APETRACECLK, 0,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800175 CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100176 prcmu_clk[PRCMU_APETRACECLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100177
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800178 clk = clk_reg_prcmu_gate("mcdeclk", NULL, PRCMU_MCDECLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100179 prcmu_clk[PRCMU_MCDECLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100180
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800181 clk = clk_reg_prcmu_opp_gate("ipi2cclk", NULL, PRCMU_IPI2CCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100182 prcmu_clk[PRCMU_IPI2CCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100183
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800184 clk = clk_reg_prcmu_gate("dsialtclk", NULL, PRCMU_DSIALTCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100185 prcmu_clk[PRCMU_DSIALTCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100186
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800187 clk = clk_reg_prcmu_gate("dmaclk", NULL, PRCMU_DMACLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100188 prcmu_clk[PRCMU_DMACLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100189
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800190 clk = clk_reg_prcmu_gate("b2r2clk", NULL, PRCMU_B2R2CLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100191 prcmu_clk[PRCMU_B2R2CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100192
193 clk = clk_reg_prcmu_scalable("tvclk", NULL, PRCMU_TVCLK, 0,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800194 CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100195 prcmu_clk[PRCMU_TVCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100196
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800197 clk = clk_reg_prcmu_gate("sspclk", NULL, PRCMU_SSPCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100198 prcmu_clk[PRCMU_SSPCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100199
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800200 clk = clk_reg_prcmu_gate("rngclk", NULL, PRCMU_RNGCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100201 prcmu_clk[PRCMU_RNGCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100202
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800203 clk = clk_reg_prcmu_gate("uiccclk", NULL, PRCMU_UICCCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100204 prcmu_clk[PRCMU_UICCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100205
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800206 clk = clk_reg_prcmu_gate("timclk", NULL, PRCMU_TIMCLK, 0);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100207 prcmu_clk[PRCMU_TIMCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100208
209 clk = clk_reg_prcmu_opp_volt_scalable("sdmmcclk", NULL, PRCMU_SDMMCCLK,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800210 100000000, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100211 prcmu_clk[PRCMU_SDMMCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100212
213 clk = clk_reg_prcmu_scalable("dsi_pll", "hdmiclk",
214 PRCMU_PLLDSI, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100215 prcmu_clk[PRCMU_PLLDSI] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100216
217 clk = clk_reg_prcmu_scalable("dsi0clk", "dsi_pll",
218 PRCMU_DSI0CLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100219 prcmu_clk[PRCMU_DSI0CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100220
221 clk = clk_reg_prcmu_scalable("dsi1clk", "dsi_pll",
222 PRCMU_DSI1CLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100223 prcmu_clk[PRCMU_DSI1CLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100224
225 clk = clk_reg_prcmu_scalable("dsi0escclk", "tvclk",
226 PRCMU_DSI0ESCCLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100227 prcmu_clk[PRCMU_DSI0ESCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100228
229 clk = clk_reg_prcmu_scalable("dsi1escclk", "tvclk",
230 PRCMU_DSI1ESCCLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100231 prcmu_clk[PRCMU_DSI1ESCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100232
233 clk = clk_reg_prcmu_scalable("dsi2escclk", "tvclk",
234 PRCMU_DSI2ESCCLK, 0, CLK_SET_RATE_GATE);
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100235 prcmu_clk[PRCMU_DSI2ESCCLK] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100236
237 clk = clk_reg_prcmu_scalable_rate("armss", NULL,
Stephen Boyd66f4ae72016-03-01 11:00:04 -0800238 PRCMU_ARMSS, 0, CLK_IGNORE_UNUSED);
Lee Jones257015a2013-09-18 16:09:38 +0100239 prcmu_clk[PRCMU_ARMSS] = clk;
Lee Jones82b0f4b2013-09-17 10:11:53 +0100240
Lee Jones4e334662013-09-17 10:35:00 +0100241 twd_clk = clk_register_fixed_factor(NULL, "smp_twd", "armss",
Lee Jones82b0f4b2013-09-17 10:11:53 +0100242 CLK_IGNORE_UNUSED, 1, 2);
243
244 /*
245 * FIXME: Add special handled PRCMU clocks here:
246 * 1. clkout0yuv, use PRCMU as parent + need regulator + pinctrl.
247 * 2. ab9540_clkout1yuv, see clkout0yuv
248 */
249
250 /* PRCC P-clocks */
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200251 clk = clk_reg_prcc_pclk("p1_pclk0", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100252 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100253 PRCC_PCLK_STORE(clk, 1, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100254
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200255 clk = clk_reg_prcc_pclk("p1_pclk1", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100256 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100257 PRCC_PCLK_STORE(clk, 1, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100258
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200259 clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100260 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100261 PRCC_PCLK_STORE(clk, 1, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100262
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200263 clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100264 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100265 PRCC_PCLK_STORE(clk, 1, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100266
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200267 clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100268 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100269 PRCC_PCLK_STORE(clk, 1, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100270
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200271 clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100272 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100273 PRCC_PCLK_STORE(clk, 1, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100274
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200275 clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100276 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100277 PRCC_PCLK_STORE(clk, 1, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100278
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200279 clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100280 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100281 PRCC_PCLK_STORE(clk, 1, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100282
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200283 clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100284 BIT(8), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100285 PRCC_PCLK_STORE(clk, 1, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100286
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200287 clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100288 BIT(9), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100289 PRCC_PCLK_STORE(clk, 1, 9);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100290
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200291 clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100292 BIT(10), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100293 PRCC_PCLK_STORE(clk, 1, 10);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100294
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200295 clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", bases[CLKRST1_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100296 BIT(11), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100297 PRCC_PCLK_STORE(clk, 1, 11);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100298
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200299 clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100300 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100301 PRCC_PCLK_STORE(clk, 2, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100302
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200303 clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100304 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100305 PRCC_PCLK_STORE(clk, 2, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100306
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200307 clk = clk_reg_prcc_pclk("p2_pclk2", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100308 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100309 PRCC_PCLK_STORE(clk, 2, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100310
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200311 clk = clk_reg_prcc_pclk("p2_pclk3", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100312 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100313 PRCC_PCLK_STORE(clk, 2, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100314
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200315 clk = clk_reg_prcc_pclk("p2_pclk4", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100316 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100317 PRCC_PCLK_STORE(clk, 2, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100318
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200319 clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100320 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100321 PRCC_PCLK_STORE(clk, 2, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100322
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200323 clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100324 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100325 PRCC_PCLK_STORE(clk, 2, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100326
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200327 clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100328 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100329 PRCC_PCLK_STORE(clk, 2, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100330
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200331 clk = clk_reg_prcc_pclk("p2_pclk8", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100332 BIT(8), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100333 PRCC_PCLK_STORE(clk, 2, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100334
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200335 clk = clk_reg_prcc_pclk("p2_pclk9", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100336 BIT(9), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100337 PRCC_PCLK_STORE(clk, 2, 9);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100338
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200339 clk = clk_reg_prcc_pclk("p2_pclk10", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100340 BIT(10), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100341 PRCC_PCLK_STORE(clk, 2, 10);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100342
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200343 clk = clk_reg_prcc_pclk("p2_pclk11", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100344 BIT(11), 0);
Linus Walleijf5ff9a12013-10-18 10:56:14 +0200345 PRCC_PCLK_STORE(clk, 2, 11);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100346
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200347 clk = clk_reg_prcc_pclk("p2_pclk12", "per2clk", bases[CLKRST2_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100348 BIT(12), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100349 PRCC_PCLK_STORE(clk, 2, 12);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100350
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200351 clk = clk_reg_prcc_pclk("p3_pclk0", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100352 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100353 PRCC_PCLK_STORE(clk, 3, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100354
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200355 clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100356 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100357 PRCC_PCLK_STORE(clk, 3, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100358
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200359 clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100360 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100361 PRCC_PCLK_STORE(clk, 3, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100362
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200363 clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100364 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100365 PRCC_PCLK_STORE(clk, 3, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100366
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200367 clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100368 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100369 PRCC_PCLK_STORE(clk, 3, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100370
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200371 clk = clk_reg_prcc_pclk("p3_pclk5", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100372 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100373 PRCC_PCLK_STORE(clk, 3, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100374
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200375 clk = clk_reg_prcc_pclk("p3_pclk6", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100376 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100377 PRCC_PCLK_STORE(clk, 3, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100378
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200379 clk = clk_reg_prcc_pclk("p3_pclk7", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100380 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100381 PRCC_PCLK_STORE(clk, 3, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100382
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200383 clk = clk_reg_prcc_pclk("p3_pclk8", "per3clk", bases[CLKRST3_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100384 BIT(8), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100385 PRCC_PCLK_STORE(clk, 3, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100386
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200387 clk = clk_reg_prcc_pclk("p5_pclk0", "per5clk", bases[CLKRST5_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100388 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100389 PRCC_PCLK_STORE(clk, 5, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100390
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200391 clk = clk_reg_prcc_pclk("p5_pclk1", "per5clk", bases[CLKRST5_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100392 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100393 PRCC_PCLK_STORE(clk, 5, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100394
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200395 clk = clk_reg_prcc_pclk("p6_pclk0", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100396 BIT(0), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100397 PRCC_PCLK_STORE(clk, 6, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100398
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200399 clk = clk_reg_prcc_pclk("p6_pclk1", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100400 BIT(1), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100401 PRCC_PCLK_STORE(clk, 6, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100402
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200403 clk = clk_reg_prcc_pclk("p6_pclk2", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100404 BIT(2), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100405 PRCC_PCLK_STORE(clk, 6, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100406
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200407 clk = clk_reg_prcc_pclk("p6_pclk3", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100408 BIT(3), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100409 PRCC_PCLK_STORE(clk, 6, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100410
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200411 clk = clk_reg_prcc_pclk("p6_pclk4", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100412 BIT(4), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100413 PRCC_PCLK_STORE(clk, 6, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100414
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200415 clk = clk_reg_prcc_pclk("p6_pclk5", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100416 BIT(5), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100417 PRCC_PCLK_STORE(clk, 6, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100418
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200419 clk = clk_reg_prcc_pclk("p6_pclk6", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100420 BIT(6), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100421 PRCC_PCLK_STORE(clk, 6, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100422
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200423 clk = clk_reg_prcc_pclk("p6_pclk7", "per6clk", bases[CLKRST6_INDEX],
Lee Jones82b0f4b2013-09-17 10:11:53 +0100424 BIT(7), 0);
Lee Jones2d080302013-09-17 10:31:39 +0100425 PRCC_PCLK_STORE(clk, 6, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100426
427 /* PRCC K-clocks
428 *
429 * FIXME: Some drivers requires PERPIH[n| to be automatically enabled
430 * by enabling just the K-clock, even if it is not a valid parent to
431 * the K-clock. Until drivers get fixed we might need some kind of
432 * "parent muxed join".
433 */
434
435 /* Periph1 */
436 clk = clk_reg_prcc_kclk("p1_uart0_kclk", "uartclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200437 bases[CLKRST1_INDEX], BIT(0), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100438 PRCC_KCLK_STORE(clk, 1, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100439
440 clk = clk_reg_prcc_kclk("p1_uart1_kclk", "uartclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200441 bases[CLKRST1_INDEX], BIT(1), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100442 PRCC_KCLK_STORE(clk, 1, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100443
444 clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200445 bases[CLKRST1_INDEX], BIT(2), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100446 PRCC_KCLK_STORE(clk, 1, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100447
448 clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200449 bases[CLKRST1_INDEX], BIT(3), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100450 PRCC_KCLK_STORE(clk, 1, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100451
452 clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200453 bases[CLKRST1_INDEX], BIT(4), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100454 PRCC_KCLK_STORE(clk, 1, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100455
456 clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200457 bases[CLKRST1_INDEX], BIT(5), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100458 PRCC_KCLK_STORE(clk, 1, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100459
460 clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200461 bases[CLKRST1_INDEX], BIT(6), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100462 PRCC_KCLK_STORE(clk, 1, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100463
464 clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200465 bases[CLKRST1_INDEX], BIT(8), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100466 PRCC_KCLK_STORE(clk, 1, 8);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100467
468 clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200469 bases[CLKRST1_INDEX], BIT(9), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100470 PRCC_KCLK_STORE(clk, 1, 9);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100471
472 clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200473 bases[CLKRST1_INDEX], BIT(10), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100474 PRCC_KCLK_STORE(clk, 1, 10);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100475
476 /* Periph2 */
477 clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200478 bases[CLKRST2_INDEX], BIT(0), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100479 PRCC_KCLK_STORE(clk, 2, 0);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100480
481 clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200482 bases[CLKRST2_INDEX], BIT(2), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100483 PRCC_KCLK_STORE(clk, 2, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100484
485 clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200486 bases[CLKRST2_INDEX], BIT(3), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100487 PRCC_KCLK_STORE(clk, 2, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100488
489 clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200490 bases[CLKRST2_INDEX], BIT(4), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100491 PRCC_KCLK_STORE(clk, 2, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100492
493 clk = clk_reg_prcc_kclk("p2_sdi3_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200494 bases[CLKRST2_INDEX], BIT(5), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100495 PRCC_KCLK_STORE(clk, 2, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100496
497 /* Note that rate is received from parent. */
498 clk = clk_reg_prcc_kclk("p2_ssirx_kclk", "hsirxclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200499 bases[CLKRST2_INDEX], BIT(6),
Lee Jones82b0f4b2013-09-17 10:11:53 +0100500 CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT);
Lee Jones89da2df2013-09-17 10:33:05 +0100501 PRCC_KCLK_STORE(clk, 2, 6);
502
Lee Jones82b0f4b2013-09-17 10:11:53 +0100503 clk = clk_reg_prcc_kclk("p2_ssitx_kclk", "hsitxclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200504 bases[CLKRST2_INDEX], BIT(7),
Lee Jones82b0f4b2013-09-17 10:11:53 +0100505 CLK_SET_RATE_GATE|CLK_SET_RATE_PARENT);
Lee Jones89da2df2013-09-17 10:33:05 +0100506 PRCC_KCLK_STORE(clk, 2, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100507
508 /* Periph3 */
509 clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200510 bases[CLKRST3_INDEX], BIT(1), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100511 PRCC_KCLK_STORE(clk, 3, 1);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100512
513 clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200514 bases[CLKRST3_INDEX], BIT(2), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100515 PRCC_KCLK_STORE(clk, 3, 2);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100516
517 clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200518 bases[CLKRST3_INDEX], BIT(3), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100519 PRCC_KCLK_STORE(clk, 3, 3);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100520
521 clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200522 bases[CLKRST3_INDEX], BIT(4), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100523 PRCC_KCLK_STORE(clk, 3, 4);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100524
525 clk = clk_reg_prcc_kclk("p3_ske_kclk", "rtc32k",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200526 bases[CLKRST3_INDEX], BIT(5), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100527 PRCC_KCLK_STORE(clk, 3, 5);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100528
529 clk = clk_reg_prcc_kclk("p3_uart2_kclk", "uartclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200530 bases[CLKRST3_INDEX], BIT(6), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100531 PRCC_KCLK_STORE(clk, 3, 6);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100532
533 clk = clk_reg_prcc_kclk("p3_sdi5_kclk", "sdmmcclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200534 bases[CLKRST3_INDEX], BIT(7), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100535 PRCC_KCLK_STORE(clk, 3, 7);
Lee Jones82b0f4b2013-09-17 10:11:53 +0100536
537 /* Periph6 */
538 clk = clk_reg_prcc_kclk("p3_rng_kclk", "rngclk",
Linus Walleij5dc0fe12015-07-30 15:19:25 +0200539 bases[CLKRST6_INDEX], BIT(0), CLK_SET_RATE_GATE);
Lee Jones89da2df2013-09-17 10:33:05 +0100540 PRCC_KCLK_STORE(clk, 6, 0);
Lee Jonesdec759d2013-09-17 10:26:24 +0100541
542 for_each_child_of_node(np, child) {
Lee Jonesf9fcb8e2013-09-17 10:30:19 +0100543 static struct clk_onecell_data clk_data;
544
545 if (!of_node_cmp(child->name, "prcmu-clock")) {
546 clk_data.clks = prcmu_clk;
547 clk_data.clk_num = ARRAY_SIZE(prcmu_clk);
548 of_clk_add_provider(child, of_clk_src_onecell_get, &clk_data);
549 }
Lee Jones2d080302013-09-17 10:31:39 +0100550 if (!of_node_cmp(child->name, "prcc-periph-clock"))
551 of_clk_add_provider(child, ux500_twocell_get, prcc_pclk);
Lee Jones89da2df2013-09-17 10:33:05 +0100552
553 if (!of_node_cmp(child->name, "prcc-kernel-clock"))
554 of_clk_add_provider(child, ux500_twocell_get, prcc_kclk);
Lee Jonesd625a732013-09-17 10:34:24 +0100555
556 if (!of_node_cmp(child->name, "rtc32k-clock"))
557 of_clk_add_provider(child, of_clk_src_simple_get, rtc_clk);
Lee Jones4e334662013-09-17 10:35:00 +0100558
559 if (!of_node_cmp(child->name, "smp-twd-clock"))
560 of_clk_add_provider(child, of_clk_src_simple_get, twd_clk);
Lee Jonesdec759d2013-09-17 10:26:24 +0100561 }
Lee Jones82b0f4b2013-09-17 10:11:53 +0100562}
Arnd Bergmann269f1aa2016-06-20 22:47:53 +0200563CLK_OF_DECLARE(u8500_clks, "stericsson,u8500-clks", u8500_clk_init);