aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-shmobile
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2014-03-17 03:36:37 -0400
committerOlof Johansson <olof@lixom.net>2014-03-17 03:36:37 -0400
commit6020dd9b019e8350d926964260396a5bed948e09 (patch)
tree0b9f58ec75d13fcf58c7d43b793cb4c9fe7ba465 /arch/arm/mach-shmobile
parent63261d76c81ff89638d15a181d5ef5adb03c0e30 (diff)
parentdf55f6685a04a259cf59cd3fde02212b294461cc (diff)
Merge tag 'renesas-clock-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/drivers
Merge "Renesas ARM Based SoC Clock Updates for v3.15" from Simon Horman: * r7s72100 SoC (RZ/A1H) - Add clock for SH Ethernet - Add RSPI clocks * r8a7791 (R-Car M2) - Add QSPI and SDHI clocks * r8a7790 (R-Car H2) - Add audio clock - Remove legacy DT clocks - Correct SYS DMAC clock defines * tag 'renesas-clock-for-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: ARM: shmobile: Remove legacy r8a7790 DT clocks ARM: shmobile: Add r8a7791 legacy SDHI clocks ARM: shmobile: r8a7790: Correct SYS DMAC clock defines ARM: shmobile: r7s72100: Add clock for r7s72100-ether ARM: shmobile: r8a7791 clock: add QSPI clocks ARM: shmobile: r7s72100 clock: Add RSPI clocks for DT ARM: shmobile: r7s72100 clock: Add RSPI clocks ARM: shmobile: r8a7790: add audio clock ARM: shmobile: r8a7778: add audio clock in new style Signed-off-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'arch/arm/mach-shmobile')
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c30
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7778.c4
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c31
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7791.c62
4 files changed, 111 insertions, 16 deletions
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
index dd8ce87596de..f17a5db00221 100644
--- a/arch/arm/mach-shmobile/clock-r7s72100.c
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -22,12 +22,15 @@
22#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/r7s72100.h> 23#include <mach/r7s72100.h>
24 24
25/* registers */ 25/* Frequency Control Registers */
26#define FRQCR 0xfcfe0010 26#define FRQCR 0xfcfe0010
27#define FRQCR2 0xfcfe0014 27#define FRQCR2 0xfcfe0014
28/* Standby Control Registers */
28#define STBCR3 0xfcfe0420 29#define STBCR3 0xfcfe0420
29#define STBCR4 0xfcfe0424 30#define STBCR4 0xfcfe0424
31#define STBCR7 0xfcfe0430
30#define STBCR9 0xfcfe0438 32#define STBCR9 0xfcfe0438
33#define STBCR10 0xfcfe043c
31 34
32#define PLL_RATE 30 35#define PLL_RATE 30
33 36
@@ -145,15 +148,25 @@ struct clk div4_clks[DIV4_NR] = {
145 | CLK_ENABLE_ON_INIT), 148 | CLK_ENABLE_ON_INIT),
146}; 149};
147 150
148enum { MSTP97, MSTP96, MSTP95, MSTP94, 151enum {
152 MSTP107, MSTP106, MSTP105, MSTP104, MSTP103,
153 MSTP97, MSTP96, MSTP95, MSTP94,
154 MSTP74,
149 MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40, 155 MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40,
150 MSTP33, MSTP_NR }; 156 MSTP33, MSTP_NR
157};
151 158
152static struct clk mstp_clks[MSTP_NR] = { 159static struct clk mstp_clks[MSTP_NR] = {
160 [MSTP107] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 7, 0), /* RSPI0 */
161 [MSTP106] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 6, 0), /* RSPI1 */
162 [MSTP105] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 5, 0), /* RSPI2 */
163 [MSTP104] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 4, 0), /* RSPI3 */
164 [MSTP103] = SH_CLK_MSTP8(&peripheral1_clk, STBCR10, 3, 0), /* RSPI4 */
153 [MSTP97] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 7, 0), /* RIIC0 */ 165 [MSTP97] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 7, 0), /* RIIC0 */
154 [MSTP96] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 6, 0), /* RIIC1 */ 166 [MSTP96] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 6, 0), /* RIIC1 */
155 [MSTP95] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 5, 0), /* RIIC2 */ 167 [MSTP95] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 5, 0), /* RIIC2 */
156 [MSTP94] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 4, 0), /* RIIC3 */ 168 [MSTP94] = SH_CLK_MSTP8(&peripheral0_clk, STBCR9, 4, 0), /* RIIC3 */
169 [MSTP74] = SH_CLK_MSTP8(&peripheral1_clk, STBCR7, 4, 0), /* Ether */
157 [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */ 170 [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */
158 [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */ 171 [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */
159 [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */ 172 [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */
@@ -176,10 +189,21 @@ static struct clk_lookup lookups[] = {
176 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]), 189 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
177 190
178 /* MSTP clocks */ 191 /* MSTP clocks */
192 CLKDEV_DEV_ID("rspi-rz.0", &mstp_clks[MSTP107]),
193 CLKDEV_DEV_ID("rspi-rz.1", &mstp_clks[MSTP106]),
194 CLKDEV_DEV_ID("rspi-rz.2", &mstp_clks[MSTP105]),
195 CLKDEV_DEV_ID("rspi-rz.3", &mstp_clks[MSTP104]),
196 CLKDEV_DEV_ID("rspi-rz.4", &mstp_clks[MSTP103]),
197 CLKDEV_DEV_ID("e800c800.spi", &mstp_clks[MSTP107]),
198 CLKDEV_DEV_ID("e800d000.spi", &mstp_clks[MSTP106]),
199 CLKDEV_DEV_ID("e800d800.spi", &mstp_clks[MSTP105]),
200 CLKDEV_DEV_ID("e800e000.spi", &mstp_clks[MSTP104]),
201 CLKDEV_DEV_ID("e800e800.spi", &mstp_clks[MSTP103]),
179 CLKDEV_DEV_ID("fcfee000.i2c", &mstp_clks[MSTP97]), 202 CLKDEV_DEV_ID("fcfee000.i2c", &mstp_clks[MSTP97]),
180 CLKDEV_DEV_ID("fcfee400.i2c", &mstp_clks[MSTP96]), 203 CLKDEV_DEV_ID("fcfee400.i2c", &mstp_clks[MSTP96]),
181 CLKDEV_DEV_ID("fcfee800.i2c", &mstp_clks[MSTP95]), 204 CLKDEV_DEV_ID("fcfee800.i2c", &mstp_clks[MSTP95]),
182 CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]), 205 CLKDEV_DEV_ID("fcfeec00.i2c", &mstp_clks[MSTP94]),
206 CLKDEV_DEV_ID("r7s72100-ether", &mstp_clks[MSTP74]),
183 CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]), 207 CLKDEV_CON_ID("mtu2_fck", &mstp_clks[MSTP33]),
184 208
185 /* ICK */ 209 /* ICK */
diff --git a/arch/arm/mach-shmobile/clock-r8a7778.c b/arch/arm/mach-shmobile/clock-r8a7778.c
index 9783945f8bc7..2009a9bc6356 100644
--- a/arch/arm/mach-shmobile/clock-r8a7778.c
+++ b/arch/arm/mach-shmobile/clock-r8a7778.c
@@ -221,6 +221,10 @@ static struct clk_lookup lookups[] = {
221 CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */ 221 CLKDEV_DEV_ID("fffc6000.spi", &mstp_clks[MSTP007]), /* HSPI2 */
222 CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP008]), /* SRU */ 222 CLKDEV_DEV_ID("rcar_sound", &mstp_clks[MSTP008]), /* SRU */
223 223
224 CLKDEV_ICK_ID("clk_a", "rcar_sound", &audio_clk_a),
225 CLKDEV_ICK_ID("clk_b", "rcar_sound", &audio_clk_b),
226 CLKDEV_ICK_ID("clk_c", "rcar_sound", &audio_clk_c),
227 CLKDEV_ICK_ID("clk_i", "rcar_sound", &s1_clk),
224 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP012]), 228 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP012]),
225 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP011]), 229 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP011]),
226 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP010]), 230 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP010]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index 507073e9d455..02b940361a66 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -91,6 +91,15 @@ static struct clk main_clk = {
91 .ops = &followparent_clk_ops, 91 .ops = &followparent_clk_ops,
92}; 92};
93 93
94static struct clk audio_clk_a = {
95};
96
97static struct clk audio_clk_b = {
98};
99
100static struct clk audio_clk_c = {
101};
102
94/* 103/*
95 * clock ratio of these clock will be updated 104 * clock ratio of these clock will be updated
96 * on r8a7790_clock_init() 105 * on r8a7790_clock_init()
@@ -124,6 +133,9 @@ SH_FIXED_RATIO_CLK_SET(ddr_clk, pll3_clk, 1, 8);
124SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15); 133SH_FIXED_RATIO_CLK_SET(mp_clk, pll1_div2_clk, 1, 15);
125 134
126static struct clk *main_clks[] = { 135static struct clk *main_clks[] = {
136 &audio_clk_a,
137 &audio_clk_b,
138 &audio_clk_c,
127 &extal_clk, 139 &extal_clk,
128 &extal_div2_clk, 140 &extal_div2_clk,
129 &main_clk, 141 &main_clk,
@@ -267,6 +279,10 @@ static struct clk mstp_clks[MSTP_NR] = {
267static struct clk_lookup lookups[] = { 279static struct clk_lookup lookups[] = {
268 280
269 /* main clocks */ 281 /* main clocks */
282 CLKDEV_CON_ID("audio_clk_a", &audio_clk_a),
283 CLKDEV_CON_ID("audio_clk_b", &audio_clk_b),
284 CLKDEV_CON_ID("audio_clk_c", &audio_clk_c),
285 CLKDEV_CON_ID("audio_clk_internal", &m2_clk),
270 CLKDEV_CON_ID("extal", &extal_clk), 286 CLKDEV_CON_ID("extal", &extal_clk),
271 CLKDEV_CON_ID("extal_div2", &extal_div2_clk), 287 CLKDEV_CON_ID("extal_div2", &extal_div2_clk),
272 CLKDEV_CON_ID("main", &main_clk), 288 CLKDEV_CON_ID("main", &main_clk),
@@ -312,34 +328,23 @@ static struct clk_lookup lookups[] = {
312 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]), 328 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]),
313 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]), 329 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]),
314 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]), 330 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]),
315 CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]),
316 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]), 331 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]),
317 CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]),
318 CLKDEV_DEV_ID("i2c-rcar_gen2.1", &mstp_clks[MSTP930]), 332 CLKDEV_DEV_ID("i2c-rcar_gen2.1", &mstp_clks[MSTP930]),
319 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]),
320 CLKDEV_DEV_ID("i2c-rcar_gen2.2", &mstp_clks[MSTP929]), 333 CLKDEV_DEV_ID("i2c-rcar_gen2.2", &mstp_clks[MSTP929]),
321 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]),
322 CLKDEV_DEV_ID("i2c-rcar_gen2.3", &mstp_clks[MSTP928]), 334 CLKDEV_DEV_ID("i2c-rcar_gen2.3", &mstp_clks[MSTP928]),
323 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]), 335 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]),
324 CLKDEV_DEV_ID("r8a7790-vin.0", &mstp_clks[MSTP811]), 336 CLKDEV_DEV_ID("r8a7790-vin.0", &mstp_clks[MSTP811]),
325 CLKDEV_DEV_ID("r8a7790-vin.1", &mstp_clks[MSTP810]), 337 CLKDEV_DEV_ID("r8a7790-vin.1", &mstp_clks[MSTP810]),
326 CLKDEV_DEV_ID("r8a7790-vin.2", &mstp_clks[MSTP809]), 338 CLKDEV_DEV_ID("r8a7790-vin.2", &mstp_clks[MSTP809]),
327 CLKDEV_DEV_ID("r8a7790-vin.3", &mstp_clks[MSTP808]), 339 CLKDEV_DEV_ID("r8a7790-vin.3", &mstp_clks[MSTP808]),
328 CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]),
329 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 340 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
330 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP502]), 341 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP502]),
331 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP501]), 342 CLKDEV_DEV_ID("sh-dma-engine.1", &mstp_clks[MSTP501]),
332 CLKDEV_DEV_ID("ee200000.mmc", &mstp_clks[MSTP315]),
333 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]), 343 CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP315]),
334 CLKDEV_DEV_ID("ee100000.sd", &mstp_clks[MSTP314]),
335 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), 344 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
336 CLKDEV_DEV_ID("ee120000.sd", &mstp_clks[MSTP313]),
337 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), 345 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]),
338 CLKDEV_DEV_ID("ee140000.sd", &mstp_clks[MSTP312]),
339 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]), 346 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP312]),
340 CLKDEV_DEV_ID("ee160000.sd", &mstp_clks[MSTP311]),
341 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]), 347 CLKDEV_DEV_ID("sh_mobile_sdhi.3", &mstp_clks[MSTP311]),
342 CLKDEV_DEV_ID("ee220000.mmc", &mstp_clks[MSTP305]),
343 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), 348 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
344 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), 349 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
345 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]), 350 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
@@ -357,6 +362,10 @@ static struct clk_lookup lookups[] = {
357 CLKDEV_ICK_ID("du.0", "rcar-du-r8a7790", &mstp_clks[MSTP724]), 362 CLKDEV_ICK_ID("du.0", "rcar-du-r8a7790", &mstp_clks[MSTP724]),
358 CLKDEV_ICK_ID("du.1", "rcar-du-r8a7790", &mstp_clks[MSTP723]), 363 CLKDEV_ICK_ID("du.1", "rcar-du-r8a7790", &mstp_clks[MSTP723]),
359 CLKDEV_ICK_ID("du.2", "rcar-du-r8a7790", &mstp_clks[MSTP722]), 364 CLKDEV_ICK_ID("du.2", "rcar-du-r8a7790", &mstp_clks[MSTP722]),
365 CLKDEV_ICK_ID("clk_a", "rcar_sound", &audio_clk_a),
366 CLKDEV_ICK_ID("clk_b", "rcar_sound", &audio_clk_b),
367 CLKDEV_ICK_ID("clk_c", "rcar_sound", &audio_clk_c),
368 CLKDEV_ICK_ID("clk_i", "rcar_sound", &m2_clk),
360 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP1015]), 369 CLKDEV_ICK_ID("ssi.0", "rcar_sound", &mstp_clks[MSTP1015]),
361 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP1014]), 370 CLKDEV_ICK_ID("ssi.1", "rcar_sound", &mstp_clks[MSTP1014]),
362 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP1013]), 371 CLKDEV_ICK_ID("ssi.2", "rcar_sound", &mstp_clks[MSTP1013]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7791.c b/arch/arm/mach-shmobile/clock-r8a7791.c
index e4e4dfac85e9..3e1b6b699184 100644
--- a/arch/arm/mach-shmobile/clock-r8a7791.c
+++ b/arch/arm/mach-shmobile/clock-r8a7791.c
@@ -61,6 +61,7 @@
61 61
62#define MSTPSR1 IOMEM(0xe6150038) 62#define MSTPSR1 IOMEM(0xe6150038)
63#define MSTPSR2 IOMEM(0xe6150040) 63#define MSTPSR2 IOMEM(0xe6150040)
64#define MSTPSR3 IOMEM(0xe6150048)
64#define MSTPSR5 IOMEM(0xe615003c) 65#define MSTPSR5 IOMEM(0xe615003c)
65#define MSTPSR7 IOMEM(0xe61501c4) 66#define MSTPSR7 IOMEM(0xe61501c4)
66#define MSTPSR8 IOMEM(0xe61509a0) 67#define MSTPSR8 IOMEM(0xe61509a0)
@@ -69,8 +70,8 @@
69 70
70#define MODEMR 0xE6160060 71#define MODEMR 0xE6160060
71#define SDCKCR 0xE6150074 72#define SDCKCR 0xE6150074
72#define SD2CKCR 0xE6150078 73#define SD1CKCR 0xE6150078
73#define SD3CKCR 0xE615007C 74#define SD2CKCR 0xE615026c
74#define MMC0CKCR 0xE6150240 75#define MMC0CKCR 0xE6150240
75#define MMC1CKCR 0xE6150244 76#define MMC1CKCR 0xE6150244
76#define SSPCKCR 0xE6150248 77#define SSPCKCR 0xE6150248
@@ -101,6 +102,7 @@ static struct clk main_clk = {
101 */ 102 */
102SH_FIXED_RATIO_CLK_SET(pll1_clk, main_clk, 1, 1); 103SH_FIXED_RATIO_CLK_SET(pll1_clk, main_clk, 1, 1);
103SH_FIXED_RATIO_CLK_SET(pll3_clk, main_clk, 1, 1); 104SH_FIXED_RATIO_CLK_SET(pll3_clk, main_clk, 1, 1);
105SH_FIXED_RATIO_CLK_SET(qspi_clk, pll1_clk, 1, 1);
104 106
105/* fixed ratio clock */ 107/* fixed ratio clock */
106SH_FIXED_RATIO_CLK_SET(extal_div2_clk, extal_clk, 1, 2); 108SH_FIXED_RATIO_CLK_SET(extal_div2_clk, extal_clk, 1, 2);
@@ -124,6 +126,7 @@ static struct clk *main_clks[] = {
124 &pll3_clk, 126 &pll3_clk,
125 &hp_clk, 127 &hp_clk,
126 &p_clk, 128 &p_clk,
129 &qspi_clk,
127 &rclk_clk, 130 &rclk_clk,
128 &mp_clk, 131 &mp_clk,
129 &cp_clk, 132 &cp_clk,
@@ -132,15 +135,50 @@ static struct clk *main_clks[] = {
132 &zs_clk, 135 &zs_clk,
133}; 136};
134 137
138/* SDHI (DIV4) clock */
139static int divisors[] = { 2, 3, 4, 6, 8, 12, 16, 18, 24, 0, 36, 48, 10 };
140
141static struct clk_div_mult_table div4_div_mult_table = {
142 .divisors = divisors,
143 .nr_divisors = ARRAY_SIZE(divisors),
144};
145
146static struct clk_div4_table div4_table = {
147 .div_mult_table = &div4_div_mult_table,
148};
149
150enum {
151 DIV4_SDH, DIV4_SD0,
152 DIV4_NR
153};
154
155static struct clk div4_clks[DIV4_NR] = {
156 [DIV4_SDH] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 8, 0x0dff, CLK_ENABLE_ON_INIT),
157 [DIV4_SD0] = SH_CLK_DIV4(&pll1_clk, SDCKCR, 4, 0x1de0, CLK_ENABLE_ON_INIT),
158};
159
160/* DIV6 clocks */
161enum {
162 DIV6_SD1, DIV6_SD2,
163 DIV6_NR
164};
165
166static struct clk div6_clks[DIV6_NR] = {
167 [DIV6_SD1] = SH_CLK_DIV6(&pll1_div2_clk, SD1CKCR, 0),
168 [DIV6_SD2] = SH_CLK_DIV6(&pll1_div2_clk, SD2CKCR, 0),
169};
170
135/* MSTP */ 171/* MSTP */
136enum { 172enum {
137 MSTP931, MSTP930, MSTP929, MSTP928, MSTP927, MSTP925, 173 MSTP931, MSTP930, MSTP929, MSTP928, MSTP927, MSTP925,
174 MSTP917,
138 MSTP815, MSTP814, 175 MSTP815, MSTP814,
139 MSTP813, 176 MSTP813,
140 MSTP811, MSTP810, MSTP809, 177 MSTP811, MSTP810, MSTP809,
141 MSTP726, MSTP724, MSTP723, MSTP721, MSTP720, 178 MSTP726, MSTP724, MSTP723, MSTP721, MSTP720,
142 MSTP719, MSTP718, MSTP715, MSTP714, 179 MSTP719, MSTP718, MSTP715, MSTP714,
143 MSTP522, 180 MSTP522,
181 MSTP314, MSTP312, MSTP311,
144 MSTP216, MSTP207, MSTP206, 182 MSTP216, MSTP207, MSTP206,
145 MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107, 183 MSTP204, MSTP203, MSTP202, MSTP1105, MSTP1106, MSTP1107,
146 MSTP124, 184 MSTP124,
@@ -154,6 +192,7 @@ static struct clk mstp_clks[MSTP_NR] = {
154 [MSTP928] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */ 192 [MSTP928] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 28, MSTPSR9, 0), /* I2C3 */
155 [MSTP927] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 27, MSTPSR9, 0), /* I2C4 */ 193 [MSTP927] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 27, MSTPSR9, 0), /* I2C4 */
156 [MSTP925] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 25, MSTPSR9, 0), /* I2C5 */ 194 [MSTP925] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR9, 25, MSTPSR9, 0), /* I2C5 */
195 [MSTP917] = SH_CLK_MSTP32_STS(&qspi_clk, SMSTPCR9, 17, MSTPSR9, 0), /* QSPI */
157 [MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */ 196 [MSTP815] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 15, MSTPSR8, 0), /* SATA0 */
158 [MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */ 197 [MSTP814] = SH_CLK_MSTP32_STS(&zs_clk, SMSTPCR8, 14, MSTPSR8, 0), /* SATA1 */
159 [MSTP813] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR8, 13, MSTPSR8, 0), /* Ether */ 198 [MSTP813] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR8, 13, MSTPSR8, 0), /* Ether */
@@ -170,6 +209,9 @@ static struct clk mstp_clks[MSTP_NR] = {
170 [MSTP715] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 15, MSTPSR7, 0), /* SCIF4 */ 209 [MSTP715] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 15, MSTPSR7, 0), /* SCIF4 */
171 [MSTP714] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 14, MSTPSR7, 0), /* SCIF5 */ 210 [MSTP714] = SH_CLK_MSTP32_STS(&p_clk, SMSTPCR7, 14, MSTPSR7, 0), /* SCIF5 */
172 [MSTP522] = SH_CLK_MSTP32_STS(&extal_clk, SMSTPCR5, 22, MSTPSR5, 0), /* Thermal */ 211 [MSTP522] = SH_CLK_MSTP32_STS(&extal_clk, SMSTPCR5, 22, MSTPSR5, 0), /* Thermal */
212 [MSTP314] = SH_CLK_MSTP32_STS(&div4_clks[DIV4_SD0], SMSTPCR3, 14, MSTPSR3, 0), /* SDHI0 */
213 [MSTP312] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD1], SMSTPCR3, 12, MSTPSR3, 0), /* SDHI1 */
214 [MSTP311] = SH_CLK_MSTP32_STS(&div6_clks[DIV6_SD2], SMSTPCR3, 11, MSTPSR3, 0), /* SDHI2 */
173 [MSTP216] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 16, MSTPSR2, 0), /* SCIFB2 */ 215 [MSTP216] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 16, MSTPSR2, 0), /* SCIFB2 */
174 [MSTP207] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 7, MSTPSR2, 0), /* SCIFB1 */ 216 [MSTP207] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 7, MSTPSR2, 0), /* SCIFB1 */
175 [MSTP206] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 6, MSTPSR2, 0), /* SCIFB0 */ 217 [MSTP206] = SH_CLK_MSTP32_STS(&mp_clk, SMSTPCR2, 6, MSTPSR2, 0), /* SCIFB0 */
@@ -195,6 +237,7 @@ static struct clk_lookup lookups[] = {
195 CLKDEV_CON_ID("zs", &zs_clk), 237 CLKDEV_CON_ID("zs", &zs_clk),
196 CLKDEV_CON_ID("hp", &hp_clk), 238 CLKDEV_CON_ID("hp", &hp_clk),
197 CLKDEV_CON_ID("p", &p_clk), 239 CLKDEV_CON_ID("p", &p_clk),
240 CLKDEV_CON_ID("qspi", &qspi_clk),
198 CLKDEV_CON_ID("rclk", &rclk_clk), 241 CLKDEV_CON_ID("rclk", &rclk_clk),
199 CLKDEV_CON_ID("mp", &mp_clk), 242 CLKDEV_CON_ID("mp", &mp_clk),
200 CLKDEV_CON_ID("cp", &cp_clk), 243 CLKDEV_CON_ID("cp", &cp_clk),
@@ -219,7 +262,11 @@ static struct clk_lookup lookups[] = {
219 CLKDEV_DEV_ID("sh-sci.12", &mstp_clks[MSTP1105]), /* SCIFA3 */ 262 CLKDEV_DEV_ID("sh-sci.12", &mstp_clks[MSTP1105]), /* SCIFA3 */
220 CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1106]), /* SCIFA4 */ 263 CLKDEV_DEV_ID("sh-sci.13", &mstp_clks[MSTP1106]), /* SCIFA4 */
221 CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1107]), /* SCIFA5 */ 264 CLKDEV_DEV_ID("sh-sci.14", &mstp_clks[MSTP1107]), /* SCIFA5 */
265 CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]),
266 CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP312]),
267 CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]),
222 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]), 268 CLKDEV_DEV_ID("sh_cmt.0", &mstp_clks[MSTP124]),
269 CLKDEV_DEV_ID("qspi.0", &mstp_clks[MSTP917]),
223 CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]), 270 CLKDEV_DEV_ID("e61f0000.thermal", &mstp_clks[MSTP522]),
224 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 271 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
225 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]), 272 CLKDEV_DEV_ID("i2c-rcar_gen2.0", &mstp_clks[MSTP931]),
@@ -271,10 +318,21 @@ void __init r8a7791_clock_init(void)
271 break; 318 break;
272 } 319 }
273 320
321 if ((mode & (MD(3) | MD(2) | MD(1))) == MD(2))
322 SH_CLK_SET_RATIO(&qspi_clk_ratio, 1, 16);
323 else
324 SH_CLK_SET_RATIO(&qspi_clk_ratio, 1, 20);
325
274 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++) 326 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
275 ret = clk_register(main_clks[k]); 327 ret = clk_register(main_clks[k]);
276 328
277 if (!ret) 329 if (!ret)
330 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
331
332 if (!ret)
333 ret = sh_clk_div6_register(div6_clks, DIV6_NR);
334
335 if (!ret)
278 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR); 336 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
279 337
280 clkdev_add_table(lookups, ARRAY_SIZE(lookups)); 338 clkdev_add_table(lookups, ARRAY_SIZE(lookups));