aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi36
-rw-r--r--arch/arm/mach-shmobile/Kconfig6
-rw-r--r--arch/arm/mach-shmobile/Makefile2
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c194
-rw-r--r--arch/arm/mach-shmobile/include/mach/r7s72100.h7
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c43
6 files changed, 288 insertions, 0 deletions
diff --git a/arch/arm/boot/dts/r7s72100.dtsi b/arch/arm/boot/dts/r7s72100.dtsi
new file mode 100644
index 000000000000..46b82aa7dc4e
--- /dev/null
+++ b/arch/arm/boot/dts/r7s72100.dtsi
@@ -0,0 +1,36 @@
1/*
2 * Device Tree Source for the r7s72100 SoC
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/ {
12 compatible = "renesas,r7s72100";
13 interrupt-parent = <&gic>;
14 #address-cells = <1>;
15 #size-cells = <1>;
16
17 cpus {
18 #address-cells = <1>;
19 #size-cells = <0>;
20
21 cpu@0 {
22 device_type = "cpu";
23 compatible = "arm,cortex-a9";
24 reg = <0>;
25 };
26 };
27
28 gic: interrupt-controller@e8201000 {
29 compatible = "arm,cortex-a9-gic";
30 #interrupt-cells = <3>;
31 #address-cells = <0>;
32 interrupt-controller;
33 reg = <0xe8201000 0x1000>,
34 <0xe8202000 0x1000>;
35 };
36};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index b45240512ce0..5dd5f9f7897a 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -113,6 +113,12 @@ config ARCH_EMEV2
113 select ARM_GIC 113 select ARM_GIC
114 select CPU_V7 114 select CPU_V7
115 115
116config ARCH_R7S72100
117 bool "RZ/A1H (R7S72100)"
118 select ARM_GIC
119 select CPU_V7
120 select SH_CLK_CPG
121
116comment "SH-Mobile Board Type" 122comment "SH-Mobile Board Type"
117 123
118config MACH_APE6EVM 124config MACH_APE6EVM
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 3c37e8271dfe..95e48d129ddc 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
18obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o setup-rcar-gen2.o 18obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o setup-rcar-gen2.o
19obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o setup-rcar-gen2.o 19obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.o setup-rcar-gen2.o
20obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o 20obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
21 22
22# Clock objects 23# Clock objects
23ifndef CONFIG_COMMON_CLK 24ifndef CONFIG_COMMON_CLK
@@ -31,6 +32,7 @@ obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
31obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o 32obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o
32obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o 33obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
33obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o 34obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o
35obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o
34endif 36endif
35 37
36# SMP objects 38# SMP objects
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
new file mode 100644
index 000000000000..1e71094f809d
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -0,0 +1,194 @@
1/*
2 * r7a72100 clock framework support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2012 Phil Edworthy
6 * Copyright (C) 2011 Magnus Damm
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 */
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/io.h>
20#include <linux/sh_clk.h>
21#include <linux/clkdev.h>
22#include <mach/common.h>
23#include <mach/r7s72100.h>
24
25/* registers */
26#define FRQCR 0xfcfe0010
27#define FRQCR2 0xfcfe0014
28#define STBCR3 0xfcfe0420
29#define STBCR4 0xfcfe0424
30
31#define PLL_RATE 30
32
33static struct clk_mapping cpg_mapping = {
34 .phys = 0xfcfe0000,
35 .len = 0x1000,
36};
37
38/* Fixed 32 KHz root clock for RTC */
39static struct clk r_clk = {
40 .rate = 32768,
41};
42
43/*
44 * Default rate for the root input clock, reset this with clk_set_rate()
45 * from the platform code.
46 */
47static struct clk extal_clk = {
48 .rate = 13330000,
49 .mapping = &cpg_mapping,
50};
51
52static unsigned long pll_recalc(struct clk *clk)
53{
54 return clk->parent->rate * PLL_RATE;
55}
56
57static struct sh_clk_ops pll_clk_ops = {
58 .recalc = pll_recalc,
59};
60
61static struct clk pll_clk = {
62 .ops = &pll_clk_ops,
63 .parent = &extal_clk,
64 .flags = CLK_ENABLE_ON_INIT,
65};
66
67static unsigned long bus_recalc(struct clk *clk)
68{
69 return clk->parent->rate * 2 / 3;
70}
71
72static struct sh_clk_ops bus_clk_ops = {
73 .recalc = bus_recalc,
74};
75
76static struct clk bus_clk = {
77 .ops = &bus_clk_ops,
78 .parent = &pll_clk,
79 .flags = CLK_ENABLE_ON_INIT,
80};
81
82static unsigned long peripheral0_recalc(struct clk *clk)
83{
84 return clk->parent->rate / 12;
85}
86
87static struct sh_clk_ops peripheral0_clk_ops = {
88 .recalc = peripheral0_recalc,
89};
90
91static struct clk peripheral0_clk = {
92 .ops = &peripheral0_clk_ops,
93 .parent = &pll_clk,
94 .flags = CLK_ENABLE_ON_INIT,
95};
96
97static unsigned long peripheral1_recalc(struct clk *clk)
98{
99 return clk->parent->rate / 6;
100}
101
102static struct sh_clk_ops peripheral1_clk_ops = {
103 .recalc = peripheral1_recalc,
104};
105
106static struct clk peripheral1_clk = {
107 .ops = &peripheral1_clk_ops,
108 .parent = &pll_clk,
109 .flags = CLK_ENABLE_ON_INIT,
110};
111
112struct clk *main_clks[] = {
113 &r_clk,
114 &extal_clk,
115 &pll_clk,
116 &bus_clk,
117 &peripheral0_clk,
118 &peripheral1_clk,
119};
120
121static int div2[] = { 1, 3, 0, 3 }; /* 1, 2/3, reserve, 1/3 */
122static int multipliers[] = { 1, 2, 1, 1 };
123
124static struct clk_div_mult_table div4_div_mult_table = {
125 .divisors = div2,
126 .nr_divisors = ARRAY_SIZE(div2),
127 .multipliers = multipliers,
128 .nr_multipliers = ARRAY_SIZE(multipliers),
129};
130
131static struct clk_div4_table div4_table = {
132 .div_mult_table = &div4_div_mult_table,
133};
134
135enum { DIV4_I,
136 DIV4_NR };
137
138#define DIV4(_reg, _bit, _mask, _flags) \
139 SH_CLK_DIV4(&pll_clk, _reg, _bit, _mask, _flags)
140
141/* The mask field specifies the div2 entries that are valid */
142struct clk div4_clks[DIV4_NR] = {
143 [DIV4_I] = DIV4(FRQCR, 8, 0xB, CLK_ENABLE_REG_16BIT
144 | CLK_ENABLE_ON_INIT),
145};
146
147enum { MSTP47, MSTP46, MSTP45, MSTP44, MSTP43, MSTP42, MSTP41, MSTP40,
148 MSTP33, MSTP_NR };
149
150static struct clk mstp_clks[MSTP_NR] = {
151 [MSTP47] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 7, 0), /* SCIF0 */
152 [MSTP46] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 6, 0), /* SCIF1 */
153 [MSTP45] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 5, 0), /* SCIF2 */
154 [MSTP44] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 4, 0), /* SCIF3 */
155 [MSTP43] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 3, 0), /* SCIF4 */
156 [MSTP42] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 2, 0), /* SCIF5 */
157 [MSTP41] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 1, 0), /* SCIF6 */
158 [MSTP40] = SH_CLK_MSTP8(&peripheral1_clk, STBCR4, 0, 0), /* SCIF7 */
159 [MSTP33] = SH_CLK_MSTP8(&peripheral0_clk, STBCR3, 3, 0), /* MTU2 */
160};
161
162static struct clk_lookup lookups[] = {
163 /* main clocks */
164 CLKDEV_CON_ID("rclk", &r_clk),
165 CLKDEV_CON_ID("extal", &extal_clk),
166 CLKDEV_CON_ID("pll_clk", &pll_clk),
167 CLKDEV_CON_ID("peripheral_clk", &peripheral1_clk),
168
169 /* DIV4 clocks */
170 CLKDEV_CON_ID("cpu_clk", &div4_clks[DIV4_I]),
171
172 /* MSTP clocks */
173};
174
175void __init r7s72100_clock_init(void)
176{
177 int k, ret = 0;
178
179 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
180 ret = clk_register(main_clks[k]);
181
182 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
183
184 if (!ret)
185 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
186
187 if (!ret)
188 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
189
190 if (!ret)
191 shmobile_clk_init();
192 else
193 panic("failed to setup rza1 clocks\n");
194}
diff --git a/arch/arm/mach-shmobile/include/mach/r7s72100.h b/arch/arm/mach-shmobile/include/mach/r7s72100.h
new file mode 100644
index 000000000000..f78062e98bd4
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/r7s72100.h
@@ -0,0 +1,7 @@
1#ifndef __ASM_R7S72100_H__
2#define __ASM_R7S72100_H__
3
4void r7s72100_clock_init(void);
5void r7s72100_init_early(void);
6
7#endif /* __ASM_R7S72100_H__ */
diff --git a/arch/arm/mach-shmobile/setup-r7s72100.c b/arch/arm/mach-shmobile/setup-r7s72100.c
new file mode 100644
index 000000000000..c1aded0984a8
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -0,0 +1,43 @@
1/*
2 * r7s72100 processor support
3 *
4 * Copyright (C) 2013 Renesas Solutions Corp.
5 * Copyright (C) 2013 Magnus Damm
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/irq.h>
22#include <linux/kernel.h>
23#include <linux/of_platform.h>
24#include <mach/common.h>
25#include <mach/r7s72100.h>
26#include <asm/mach/arch.h>
27
28void __init r7s72100_init_early(void)
29{
30 shmobile_setup_delay(400, 1, 3); /* Cortex-A9 @ 400MHz */
31}
32
33#ifdef CONFIG_USE_OF
34static const char *r7s72100_boards_compat_dt[] __initdata = {
35 "renesas,r7s72100",
36 NULL,
37};
38
39DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)")
40 .init_early = r7s72100_init_early,
41 .dt_compat = r7s72100_boards_compat_dt,
42MACHINE_END
43#endif /* CONFIG_USE_OF */