aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorKevin Hilman <khilman@linaro.org>2013-10-10 18:33:39 -0400
committerKevin Hilman <khilman@linaro.org>2013-10-10 18:34:26 -0400
commit695e6044775daac00bac95901b597540fbf3108e (patch)
treefa71121d1602eb6ab13b646118bdfdaf6d9dbdba /arch
parenteea4fba5b3e33df88704691e02799305e3b91de1 (diff)
parent687c27b07050c21a62c4c975777c89e698649a6b (diff)
Merge tag 'renesas-soc2-for-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas into next/soc
From Simon Horman: Second Round of Renesas ARM based SoC updates for v3.13 * SMP support for r8a7791 SoC * r8a7779_init_irq_extpin() for DT for r8a7779 and r8a7778 SoCs * Add HPB-DMAC to r8a7779 and r8a7778 SoCs * Add r7s72100 SoC * Make use of ARCH timer workaround on r8a7791 SoC * Add IRQC platform device support to r8a7791 SoC * Add I2C clocks and aliases for the DT mode for r8a7790 SoC * Add MAC platform device to r8a73a4 SoC * tag 'renesas-soc2-for-v3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas: ARM: shmobile: r8a7791 SMP support ARM: shmobile: r8a7779: split r8a7779_init_irq_extpin() for DT ARM: shmobile: r8a7778: split r8a7778_init_irq_extpin() for DT ARM: shmobile: r7s72100 SCIF support ARM: shmobile: Initial r7s72100 SoC support ARM: shmobile: r8a7791 Arch timer workaround ARM: shmobile: r8a7791 IRQC platform device support ARM: shmobile: Introduce r8a7791_add_standard_devices() ARM: shmobile: Break out R-Car Gen2 setup code ARM: shmobile: r8a73a4: add a clock alias for the DMAC in DT mode ARM: shmobile: r8a7790: add I2C clocks and aliases for the DT mode ARM: shmobile: r8a7779: add HPB-DMAC support ARM: shmobile: r8a7778: add HPB-DMAC support ARM: shmobile: r8a73a4: add a DMAC platform device and clock for it ARM: shmobile: Remove #gpio-ranges-cells DT property gpio: rcar: Remove #gpio-range-cells DT property usage ARM: shmobile: armadillo: fixup ether pinctrl naming ARM: shmobile: Lager: add Micrel KSZ8041 PHY fixup ARM: shmobile: update SDHI DT compatibility string to the <unit>-<soc> format Signed-off-by: Kevin Hilman <khilman@linaro.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/boot/dts/r7s72100.dtsi36
-rw-r--r--arch/arm/boot/dts/r8a73a4.dtsi6
-rw-r--r--arch/arm/boot/dts/r8a7778.dtsi1
-rw-r--r--arch/arm/boot/dts/r8a7779.dtsi1
-rw-r--r--arch/arm/boot/dts/r8a7790.dtsi9
-rw-r--r--arch/arm/boot/dts/sh73a0.dtsi6
-rw-r--r--arch/arm/mach-shmobile/Kconfig6
-rw-r--r--arch/arm/mach-shmobile/Makefile6
-rw-r--r--arch/arm/mach-shmobile/board-armadillo800eva.c4
-rw-r--r--arch/arm/mach-shmobile/board-lager-reference.c2
-rw-r--r--arch/arm/mach-shmobile/board-lager.c29
-rw-r--r--arch/arm/mach-shmobile/clock-r7s72100.c202
-rw-r--r--arch/arm/mach-shmobile/clock-r8a73a4.c5
-rw-r--r--arch/arm/mach-shmobile/clock-r8a7790.c12
-rw-r--r--arch/arm/mach-shmobile/include/mach/r7s72100.h8
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a73a4.h9
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7778.h9
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7779.h8
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7790.h6
-rw-r--r--arch/arm/mach-shmobile/include/mach/r8a7791.h2
-rw-r--r--arch/arm/mach-shmobile/include/mach/rcar-gen2.h8
-rw-r--r--arch/arm/mach-shmobile/setup-r7s72100.c88
-rw-r--r--arch/arm/mach-shmobile/setup-r8a73a4.c91
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7778.c91
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7779.c160
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7790.c68
-rw-r--r--arch/arm/mach-shmobile/setup-r8a7791.c35
-rw-r--r--arch/arm/mach-shmobile/setup-rcar-gen2.c91
-rw-r--r--arch/arm/mach-shmobile/smp-r8a7791.c62
29 files changed, 967 insertions, 94 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/boot/dts/r8a73a4.dtsi b/arch/arm/boot/dts/r8a73a4.dtsi
index 6c26caa880f2..658fcc537576 100644
--- a/arch/arm/boot/dts/r8a73a4.dtsi
+++ b/arch/arm/boot/dts/r8a73a4.dtsi
@@ -193,7 +193,7 @@
193 }; 193 };
194 194
195 sdhi0: sdhi@ee100000 { 195 sdhi0: sdhi@ee100000 {
196 compatible = "renesas,r8a73a4-sdhi"; 196 compatible = "renesas,sdhi-r8a73a4";
197 reg = <0 0xee100000 0 0x100>; 197 reg = <0 0xee100000 0 0x100>;
198 interrupt-parent = <&gic>; 198 interrupt-parent = <&gic>;
199 interrupts = <0 165 4>; 199 interrupts = <0 165 4>;
@@ -202,7 +202,7 @@
202 }; 202 };
203 203
204 sdhi1: sdhi@ee120000 { 204 sdhi1: sdhi@ee120000 {
205 compatible = "renesas,r8a73a4-sdhi"; 205 compatible = "renesas,sdhi-r8a73a4";
206 reg = <0 0xee120000 0 0x100>; 206 reg = <0 0xee120000 0 0x100>;
207 interrupt-parent = <&gic>; 207 interrupt-parent = <&gic>;
208 interrupts = <0 166 4>; 208 interrupts = <0 166 4>;
@@ -211,7 +211,7 @@
211 }; 211 };
212 212
213 sdhi2: sdhi@ee140000 { 213 sdhi2: sdhi@ee140000 {
214 compatible = "renesas,r8a73a4-sdhi"; 214 compatible = "renesas,sdhi-r8a73a4";
215 reg = <0 0xee140000 0 0x100>; 215 reg = <0 0xee140000 0 0x100>;
216 interrupt-parent = <&gic>; 216 interrupt-parent = <&gic>;
217 interrupts = <0 167 4>; 217 interrupts = <0 167 4>;
diff --git a/arch/arm/boot/dts/r8a7778.dtsi b/arch/arm/boot/dts/r8a7778.dtsi
index 45ac404ab6d8..3577aba82583 100644
--- a/arch/arm/boot/dts/r8a7778.dtsi
+++ b/arch/arm/boot/dts/r8a7778.dtsi
@@ -96,6 +96,5 @@
96 pfc: pfc@fffc0000 { 96 pfc: pfc@fffc0000 {
97 compatible = "renesas,pfc-r8a7778"; 97 compatible = "renesas,pfc-r8a7778";
98 reg = <0xfffc000 0x118>; 98 reg = <0xfffc000 0x118>;
99 #gpio-range-cells = <3>;
100 }; 99 };
101}; 100};
diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index 23a62447359c..ebbe507fcbfa 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -188,7 +188,6 @@
188 pfc: pfc@fffc0000 { 188 pfc: pfc@fffc0000 {
189 compatible = "renesas,pfc-r8a7779"; 189 compatible = "renesas,pfc-r8a7779";
190 reg = <0xfffc0000 0x23c>; 190 reg = <0xfffc0000 0x23c>;
191 #gpio-range-cells = <3>;
192 }; 191 };
193 192
194 thermal@ffc48000 { 193 thermal@ffc48000 {
diff --git a/arch/arm/boot/dts/r8a7790.dtsi b/arch/arm/boot/dts/r8a7790.dtsi
index 3b879e7c697c..413b4c29e782 100644
--- a/arch/arm/boot/dts/r8a7790.dtsi
+++ b/arch/arm/boot/dts/r8a7790.dtsi
@@ -148,11 +148,10 @@
148 pfc: pfc@e6060000 { 148 pfc: pfc@e6060000 {
149 compatible = "renesas,pfc-r8a7790"; 149 compatible = "renesas,pfc-r8a7790";
150 reg = <0 0xe6060000 0 0x250>; 150 reg = <0 0xe6060000 0 0x250>;
151 #gpio-range-cells = <3>;
152 }; 151 };
153 152
154 sdhi0: sdhi@ee100000 { 153 sdhi0: sdhi@ee100000 {
155 compatible = "renesas,r8a7790-sdhi"; 154 compatible = "renesas,sdhi-r8a7790";
156 reg = <0 0xee100000 0 0x100>; 155 reg = <0 0xee100000 0 0x100>;
157 interrupt-parent = <&gic>; 156 interrupt-parent = <&gic>;
158 interrupts = <0 165 4>; 157 interrupts = <0 165 4>;
@@ -161,7 +160,7 @@
161 }; 160 };
162 161
163 sdhi1: sdhi@ee120000 { 162 sdhi1: sdhi@ee120000 {
164 compatible = "renesas,r8a7790-sdhi"; 163 compatible = "renesas,sdhi-r8a7790";
165 reg = <0 0xee120000 0 0x100>; 164 reg = <0 0xee120000 0 0x100>;
166 interrupt-parent = <&gic>; 165 interrupt-parent = <&gic>;
167 interrupts = <0 166 4>; 166 interrupts = <0 166 4>;
@@ -170,7 +169,7 @@
170 }; 169 };
171 170
172 sdhi2: sdhi@ee140000 { 171 sdhi2: sdhi@ee140000 {
173 compatible = "renesas,r8a7790-sdhi"; 172 compatible = "renesas,sdhi-r8a7790";
174 reg = <0 0xee140000 0 0x100>; 173 reg = <0 0xee140000 0 0x100>;
175 interrupt-parent = <&gic>; 174 interrupt-parent = <&gic>;
176 interrupts = <0 167 4>; 175 interrupts = <0 167 4>;
@@ -179,7 +178,7 @@
179 }; 178 };
180 179
181 sdhi3: sdhi@ee160000 { 180 sdhi3: sdhi@ee160000 {
182 compatible = "renesas,r8a7790-sdhi"; 181 compatible = "renesas,sdhi-r8a7790";
183 reg = <0 0xee160000 0 0x100>; 182 reg = <0 0xee160000 0 0x100>;
184 interrupt-parent = <&gic>; 183 interrupt-parent = <&gic>;
185 interrupts = <0 168 4>; 184 interrupts = <0 168 4>;
diff --git a/arch/arm/boot/dts/sh73a0.dtsi b/arch/arm/boot/dts/sh73a0.dtsi
index ba59a5875a10..3955c7606a6f 100644
--- a/arch/arm/boot/dts/sh73a0.dtsi
+++ b/arch/arm/boot/dts/sh73a0.dtsi
@@ -196,7 +196,7 @@
196 }; 196 };
197 197
198 sdhi0: sdhi@ee100000 { 198 sdhi0: sdhi@ee100000 {
199 compatible = "renesas,r8a7740-sdhi"; 199 compatible = "renesas,sdhi-r8a7740";
200 reg = <0xee100000 0x100>; 200 reg = <0xee100000 0x100>;
201 interrupt-parent = <&gic>; 201 interrupt-parent = <&gic>;
202 interrupts = <0 83 4 202 interrupts = <0 83 4
@@ -208,7 +208,7 @@
208 208
209 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */ 209 /* SDHI1 and SDHI2 have no CD pins, no need for CD IRQ */
210 sdhi1: sdhi@ee120000 { 210 sdhi1: sdhi@ee120000 {
211 compatible = "renesas,r8a7740-sdhi"; 211 compatible = "renesas,sdhi-r8a7740";
212 reg = <0xee120000 0x100>; 212 reg = <0xee120000 0x100>;
213 interrupt-parent = <&gic>; 213 interrupt-parent = <&gic>;
214 interrupts = <0 88 4 214 interrupts = <0 88 4
@@ -219,7 +219,7 @@
219 }; 219 };
220 220
221 sdhi2: sdhi@ee140000 { 221 sdhi2: sdhi@ee140000 {
222 compatible = "renesas,r8a7740-sdhi"; 222 compatible = "renesas,sdhi-r8a7740";
223 reg = <0xee140000 0x100>; 223 reg = <0xee140000 0x100>;
224 interrupt-parent = <&gic>; 224 interrupt-parent = <&gic>;
225 interrupts = <0 104 4 225 interrupts = <0 104 4
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 d30ec1a427ec..f2d40edadcc9 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -15,8 +15,10 @@ obj-$(CONFIG_ARCH_R8A7740) += setup-r8a7740.o
15obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o 15obj-$(CONFIG_ARCH_R8A7778) += setup-r8a7778.o
16obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o 16obj-$(CONFIG_ARCH_R8A7779) += setup-r8a7779.o
17obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o 17obj-$(CONFIG_ARCH_R8A7790) += setup-r8a7790.o
18obj-$(CONFIG_ARCH_R8A7791) += setup-r8a7791.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_EMEV2) += setup-emev2.o 20obj-$(CONFIG_ARCH_EMEV2) += setup-emev2.o
21obj-$(CONFIG_ARCH_R7S72100) += setup-r7s72100.o
20 22
21# Clock objects 23# Clock objects
22ifndef CONFIG_COMMON_CLK 24ifndef CONFIG_COMMON_CLK
@@ -30,6 +32,7 @@ obj-$(CONFIG_ARCH_R8A7779) += clock-r8a7779.o
30obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o 32obj-$(CONFIG_ARCH_R8A7790) += clock-r8a7790.o
31obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o 33obj-$(CONFIG_ARCH_R8A7791) += clock-r8a7791.o
32obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o 34obj-$(CONFIG_ARCH_EMEV2) += clock-emev2.o
35obj-$(CONFIG_ARCH_R7S72100) += clock-r7s72100.o
33endif 36endif
34 37
35# SMP objects 38# SMP objects
@@ -37,6 +40,7 @@ smp-y := platsmp.o headsmp.o
37smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o 40smp-$(CONFIG_ARCH_SH73A0) += smp-sh73a0.o headsmp-scu.o platsmp-scu.o
38smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o 41smp-$(CONFIG_ARCH_R8A7779) += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
39smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o platsmp-apmu.o 42smp-$(CONFIG_ARCH_R8A7790) += smp-r8a7790.o platsmp-apmu.o
43smp-$(CONFIG_ARCH_R8A7791) += smp-r8a7791.o platsmp-apmu.o
40smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o 44smp-$(CONFIG_ARCH_EMEV2) += smp-emev2.o headsmp-scu.o platsmp-scu.o
41 45
42# IRQ objects 46# IRQ objects
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva.c b/arch/arm/mach-shmobile/board-armadillo800eva.c
index 5bd1479d3deb..7f8f6076d360 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -1108,9 +1108,9 @@ static const struct pinctrl_map eva_pinctrl_map[] = {
1108 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-r8a7740", 1108 PIN_MAP_MUX_GROUP_DEFAULT("asoc-simple-card.1", "pfc-r8a7740",
1109 "fsib_mclk_in", "fsib"), 1109 "fsib_mclk_in", "fsib"),
1110 /* GETHER */ 1110 /* GETHER */
1111 PIN_MAP_MUX_GROUP_DEFAULT("sh-eth", "pfc-r8a7740", 1111 PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
1112 "gether_mii", "gether"), 1112 "gether_mii", "gether"),
1113 PIN_MAP_MUX_GROUP_DEFAULT("sh-eth", "pfc-r8a7740", 1113 PIN_MAP_MUX_GROUP_DEFAULT("r8a7740-gether", "pfc-r8a7740",
1114 "gether_int", "gether"), 1114 "gether_int", "gether"),
1115 /* HDMI */ 1115 /* HDMI */
1116 PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-r8a7740", 1116 PIN_MAP_MUX_GROUP_DEFAULT("sh-mobile-hdmi", "pfc-r8a7740",
diff --git a/arch/arm/mach-shmobile/board-lager-reference.c b/arch/arm/mach-shmobile/board-lager-reference.c
index d39a91b3ba48..1a1a4a888632 100644
--- a/arch/arm/mach-shmobile/board-lager-reference.c
+++ b/arch/arm/mach-shmobile/board-lager-reference.c
@@ -40,7 +40,7 @@ static const char *lager_boards_compat_dt[] __initdata = {
40DT_MACHINE_START(LAGER_DT, "lager") 40DT_MACHINE_START(LAGER_DT, "lager")
41 .smp = smp_ops(r8a7790_smp_ops), 41 .smp = smp_ops(r8a7790_smp_ops),
42 .init_early = r8a7790_init_early, 42 .init_early = r8a7790_init_early,
43 .init_time = rcar_gen2_timer_init,
43 .init_machine = lager_add_standard_devices, 44 .init_machine = lager_add_standard_devices,
44 .init_time = r8a7790_timer_init,
45 .dt_compat = lager_boards_compat_dt, 45 .dt_compat = lager_boards_compat_dt,
46MACHINE_END 46MACHINE_END
diff --git a/arch/arm/mach-shmobile/board-lager.c b/arch/arm/mach-shmobile/board-lager.c
index ef3baaa79e6d..4e040e4d1102 100644
--- a/arch/arm/mach-shmobile/board-lager.c
+++ b/arch/arm/mach-shmobile/board-lager.c
@@ -29,6 +29,7 @@
29#include <linux/pinctrl/machine.h> 29#include <linux/pinctrl/machine.h>
30#include <linux/platform_data/gpio-rcar.h> 30#include <linux/platform_data/gpio-rcar.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
32#include <linux/phy.h>
32#include <linux/regulator/fixed.h> 33#include <linux/regulator/fixed.h>
33#include <linux/regulator/machine.h> 34#include <linux/regulator/machine.h>
34#include <linux/sh_eth.h> 35#include <linux/sh_eth.h>
@@ -155,6 +156,30 @@ static void __init lager_add_standard_devices(void)
155 &ether_pdata, sizeof(ether_pdata)); 156 &ether_pdata, sizeof(ether_pdata));
156} 157}
157 158
159/*
160 * Ether LEDs on the Lager board are named LINK and ACTIVE which corresponds
161 * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits
162 * 14-15. We have to set them back to 01 from the default 00 value each time
163 * the PHY is reset. It's also important because the PHY's LED0 signal is
164 * connected to SoC's ETH_LINK signal and in the PHY's default mode it will
165 * bounce on and off after each packet, which we apparently want to avoid.
166 */
167static int lager_ksz8041_fixup(struct phy_device *phydev)
168{
169 u16 phyctrl1 = phy_read(phydev, 0x1e);
170
171 phyctrl1 &= ~0xc000;
172 phyctrl1 |= 0x4000;
173 return phy_write(phydev, 0x1e, phyctrl1);
174}
175
176static void __init lager_init(void)
177{
178 lager_add_standard_devices();
179
180 phy_register_fixup_for_id("r8a7790-ether-ff:01", lager_ksz8041_fixup);
181}
182
158static const char *lager_boards_compat_dt[] __initdata = { 183static const char *lager_boards_compat_dt[] __initdata = {
159 "renesas,lager", 184 "renesas,lager",
160 NULL, 185 NULL,
@@ -163,7 +188,7 @@ static const char *lager_boards_compat_dt[] __initdata = {
163DT_MACHINE_START(LAGER_DT, "lager") 188DT_MACHINE_START(LAGER_DT, "lager")
164 .smp = smp_ops(r8a7790_smp_ops), 189 .smp = smp_ops(r8a7790_smp_ops),
165 .init_early = r8a7790_init_early, 190 .init_early = r8a7790_init_early,
166 .init_time = r8a7790_timer_init, 191 .init_time = rcar_gen2_timer_init,
167 .init_machine = lager_add_standard_devices, 192 .init_machine = lager_init,
168 .dt_compat = lager_boards_compat_dt, 193 .dt_compat = lager_boards_compat_dt,
169MACHINE_END 194MACHINE_END
diff --git a/arch/arm/mach-shmobile/clock-r7s72100.c b/arch/arm/mach-shmobile/clock-r7s72100.c
new file mode 100644
index 000000000000..4aba20ca127e
--- /dev/null
+++ b/arch/arm/mach-shmobile/clock-r7s72100.c
@@ -0,0 +1,202 @@
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 CLKDEV_ICK_ID("sci_fck", "sh-sci.0", &mstp_clks[MSTP47]),
174 CLKDEV_ICK_ID("sci_fck", "sh-sci.1", &mstp_clks[MSTP46]),
175 CLKDEV_ICK_ID("sci_fck", "sh-sci.2", &mstp_clks[MSTP45]),
176 CLKDEV_ICK_ID("sci_fck", "sh-sci.3", &mstp_clks[MSTP44]),
177 CLKDEV_ICK_ID("sci_fck", "sh-sci.4", &mstp_clks[MSTP43]),
178 CLKDEV_ICK_ID("sci_fck", "sh-sci.5", &mstp_clks[MSTP42]),
179 CLKDEV_ICK_ID("sci_fck", "sh-sci.6", &mstp_clks[MSTP41]),
180 CLKDEV_ICK_ID("sci_fck", "sh-sci.7", &mstp_clks[MSTP40]),
181};
182
183void __init r7s72100_clock_init(void)
184{
185 int k, ret = 0;
186
187 for (k = 0; !ret && (k < ARRAY_SIZE(main_clks)); k++)
188 ret = clk_register(main_clks[k]);
189
190 clkdev_add_table(lookups, ARRAY_SIZE(lookups));
191
192 if (!ret)
193 ret = sh_clk_div4_register(div4_clks, DIV4_NR, &div4_table);
194
195 if (!ret)
196 ret = sh_clk_mstp_register(mstp_clks, MSTP_NR);
197
198 if (!ret)
199 shmobile_clk_init();
200 else
201 panic("failed to setup rza1 clocks\n");
202}
diff --git a/arch/arm/mach-shmobile/clock-r8a73a4.c b/arch/arm/mach-shmobile/clock-r8a73a4.c
index 5bd2e851e3c7..571409b611d3 100644
--- a/arch/arm/mach-shmobile/clock-r8a73a4.c
+++ b/arch/arm/mach-shmobile/clock-r8a73a4.c
@@ -504,7 +504,7 @@ static struct clk div6_clks[DIV6_NR] = {
504 504
505/* MSTP */ 505/* MSTP */
506enum { 506enum {
507 MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, 507 MSTP218, MSTP217, MSTP216, MSTP207, MSTP206, MSTP204, MSTP203,
508 MSTP329, MSTP323, MSTP318, MSTP317, MSTP316, 508 MSTP329, MSTP323, MSTP318, MSTP317, MSTP316,
509 MSTP315, MSTP314, MSTP313, MSTP312, MSTP305, MSTP300, 509 MSTP315, MSTP314, MSTP313, MSTP312, MSTP305, MSTP300,
510 MSTP411, MSTP410, MSTP409, 510 MSTP411, MSTP410, MSTP409,
@@ -519,6 +519,7 @@ static struct clk mstp_clks[MSTP_NR] = {
519 [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 7, 0), /* SCIFB1 */ 519 [MSTP207] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 7, 0), /* SCIFB1 */
520 [MSTP216] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 16, 0), /* SCIFB2 */ 520 [MSTP216] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 16, 0), /* SCIFB2 */
521 [MSTP217] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 17, 0), /* SCIFB3 */ 521 [MSTP217] = SH_CLK_MSTP32(&div6_clks[DIV6_MP], SMSTPCR2, 17, 0), /* SCIFB3 */
522 [MSTP218] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR2, 18, 0), /* DMAC */
522 [MSTP300] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 0, 0), /* IIC2 */ 523 [MSTP300] = SH_CLK_MSTP32(&div4_clks[DIV4_HP], SMSTPCR3, 0, 0), /* IIC2 */
523 [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1],SMSTPCR3, 5, 0), /* MMCIF1 */ 524 [MSTP305] = SH_CLK_MSTP32(&div6_clks[DIV6_MMC1],SMSTPCR3, 5, 0), /* MMCIF1 */
524 [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI2],SMSTPCR3, 12, 0), /* SDHI2 */ 525 [MSTP312] = SH_CLK_MSTP32(&div6_clks[DIV6_SDHI2],SMSTPCR3, 12, 0), /* SDHI2 */
@@ -578,6 +579,8 @@ static struct clk_lookup lookups[] = {
578 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]), 579 CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]),
579 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]), 580 CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]),
580 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]), 581 CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP217]),
582 CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]),
583 CLKDEV_DEV_ID("e6700020.dma-controller", &mstp_clks[MSTP218]),
581 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 584 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
582 CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]), 585 CLKDEV_DEV_ID("e6520000.i2c", &mstp_clks[MSTP300]),
583 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]), 586 CLKDEV_DEV_ID("sh_mmcif.1", &mstp_clks[MSTP305]),
diff --git a/arch/arm/mach-shmobile/clock-r8a7790.c b/arch/arm/mach-shmobile/clock-r8a7790.c
index d99b87bc76ea..a64f965c7da1 100644
--- a/arch/arm/mach-shmobile/clock-r8a7790.c
+++ b/arch/arm/mach-shmobile/clock-r8a7790.c
@@ -52,6 +52,7 @@
52#define SMSTPCR5 0xe6150144 52#define SMSTPCR5 0xe6150144
53#define SMSTPCR7 0xe615014c 53#define SMSTPCR7 0xe615014c
54#define SMSTPCR8 0xe6150990 54#define SMSTPCR8 0xe6150990
55#define SMSTPCR9 0xe6150994
55 56
56#define SDCKCR 0xE6150074 57#define SDCKCR 0xE6150074
57#define SD2CKCR 0xE6150078 58#define SD2CKCR 0xE6150078
@@ -181,6 +182,7 @@ static struct clk div6_clks[DIV6_NR] = {
181 182
182/* MSTP */ 183/* MSTP */
183enum { 184enum {
185 MSTP931, MSTP930, MSTP929, MSTP928,
184 MSTP813, 186 MSTP813,
185 MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720, 187 MSTP726, MSTP725, MSTP724, MSTP723, MSTP722, MSTP721, MSTP720,
186 MSTP717, MSTP716, 188 MSTP717, MSTP716,
@@ -192,6 +194,10 @@ enum {
192}; 194};
193 195
194static struct clk mstp_clks[MSTP_NR] = { 196static struct clk mstp_clks[MSTP_NR] = {
197 [MSTP931] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 31, 0), /* I2C0 */
198 [MSTP930] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 30, 0), /* I2C1 */
199 [MSTP929] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 29, 0), /* I2C2 */
200 [MSTP928] = SH_CLK_MSTP32(&hp_clk, SMSTPCR9, 28, 0), /* I2C3 */
195 [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */ 201 [MSTP813] = SH_CLK_MSTP32(&p_clk, SMSTPCR8, 13, 0), /* Ether */
196 [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */ 202 [MSTP726] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 26, 0), /* LVDS0 */
197 [MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */ 203 [MSTP725] = SH_CLK_MSTP32(&zx_clk, SMSTPCR7, 25, 0), /* LVDS1 */
@@ -271,6 +277,10 @@ static struct clk_lookup lookups[] = {
271 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]), 277 CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]),
272 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]), 278 CLKDEV_DEV_ID("sh-sci.8", &mstp_clks[MSTP717]),
273 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]), 279 CLKDEV_DEV_ID("sh-sci.9", &mstp_clks[MSTP716]),
280 CLKDEV_DEV_ID("e6508000.i2c", &mstp_clks[MSTP931]),
281 CLKDEV_DEV_ID("e6518000.i2c", &mstp_clks[MSTP930]),
282 CLKDEV_DEV_ID("e6530000.i2c", &mstp_clks[MSTP929]),
283 CLKDEV_DEV_ID("e6540000.i2c", &mstp_clks[MSTP928]),
274 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]), 284 CLKDEV_DEV_ID("r8a7790-ether", &mstp_clks[MSTP813]),
275 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]), 285 CLKDEV_DEV_ID("rcar_thermal", &mstp_clks[MSTP522]),
276 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]), 286 CLKDEV_DEV_ID("ee200000.mmcif", &mstp_clks[MSTP315]),
@@ -300,7 +310,7 @@ static struct clk_lookup lookups[] = {
300 310
301void __init r8a7790_clock_init(void) 311void __init r8a7790_clock_init(void)
302{ 312{
303 u32 mode = r8a7790_read_mode_pins(); 313 u32 mode = rcar_gen2_read_mode_pins();
304 int k, ret = 0; 314 int k, ret = 0;
305 315
306 switch (mode & (MD(14) | MD(13))) { 316 switch (mode & (MD(14) | MD(13))) {
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..5f34b20ecd4a
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/r7s72100.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_R7S72100_H__
2#define __ASM_R7S72100_H__
3
4void r7s72100_add_dt_devices(void);
5void r7s72100_clock_init(void);
6void r7s72100_init_early(void);
7
8#endif /* __ASM_R7S72100_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a73a4.h b/arch/arm/mach-shmobile/include/mach/r8a73a4.h
index 5214338a6a47..ce8bdd1d8a8a 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a73a4.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a73a4.h
@@ -1,6 +1,15 @@
1#ifndef __ASM_R8A73A4_H__ 1#ifndef __ASM_R8A73A4_H__
2#define __ASM_R8A73A4_H__ 2#define __ASM_R8A73A4_H__
3 3
4/* DMA slave IDs */
5enum {
6 SHDMA_SLAVE_INVALID,
7 SHDMA_SLAVE_MMCIF0_TX,
8 SHDMA_SLAVE_MMCIF0_RX,
9 SHDMA_SLAVE_MMCIF1_TX,
10 SHDMA_SLAVE_MMCIF1_RX,
11};
12
4void r8a73a4_add_standard_devices(void); 13void r8a73a4_add_standard_devices(void);
5void r8a73a4_add_dt_devices(void); 14void r8a73a4_add_dt_devices(void);
6void r8a73a4_clock_init(void); 15void r8a73a4_clock_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7778.h b/arch/arm/mach-shmobile/include/mach/r8a7778.h
index ea1dca6880f4..dbe221a484d5 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7778.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7778.h
@@ -1,6 +1,7 @@
1/* 1/*
2 * Copyright (C) 2013 Renesas Solutions Corp. 2 * Copyright (C) 2013 Renesas Solutions Corp.
3 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 3 * Copyright (C) 2013 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
4 * Copyright (C) 2013 Cogent Embedded, Inc.
4 * 5 *
5 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
@@ -21,6 +22,13 @@
21#include <linux/sh_eth.h> 22#include <linux/sh_eth.h>
22#include <linux/platform_data/camera-rcar.h> 23#include <linux/platform_data/camera-rcar.h>
23 24
25/* HPB-DMA slave IDs */
26enum {
27 HPBDMA_SLAVE_DUMMY,
28 HPBDMA_SLAVE_SDHI0_TX,
29 HPBDMA_SLAVE_SDHI0_RX,
30};
31
24extern void r8a7778_add_standard_devices(void); 32extern void r8a7778_add_standard_devices(void);
25extern void r8a7778_add_standard_devices_dt(void); 33extern void r8a7778_add_standard_devices_dt(void);
26extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata); 34extern void r8a7778_add_ether_device(struct sh_eth_plat_data *pdata);
@@ -33,6 +41,7 @@ extern void r8a7778_init_delay(void);
33extern void r8a7778_init_irq_dt(void); 41extern void r8a7778_init_irq_dt(void);
34extern void r8a7778_clock_init(void); 42extern void r8a7778_clock_init(void);
35extern void r8a7778_init_irq_extpin(int irlm); 43extern void r8a7778_init_irq_extpin(int irlm);
44extern void r8a7778_init_irq_extpin_dt(int irlm);
36extern void r8a7778_pinmux_init(void); 45extern void r8a7778_pinmux_init(void);
37 46
38extern int r8a7778_usb_phy_power(bool enable); 47extern int r8a7778_usb_phy_power(bool enable);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7779.h b/arch/arm/mach-shmobile/include/mach/r8a7779.h
index 11c740047e14..17af34ed89c8 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7779.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7779.h
@@ -6,6 +6,13 @@
6#include <linux/sh_eth.h> 6#include <linux/sh_eth.h>
7#include <linux/platform_data/camera-rcar.h> 7#include <linux/platform_data/camera-rcar.h>
8 8
9/* HPB-DMA slave IDs */
10enum {
11 HPBDMA_SLAVE_DUMMY,
12 HPBDMA_SLAVE_SDHI0_TX,
13 HPBDMA_SLAVE_SDHI0_RX,
14};
15
9struct platform_device; 16struct platform_device;
10 17
11struct r8a7779_pm_ch { 18struct r8a7779_pm_ch {
@@ -26,6 +33,7 @@ static inline struct r8a7779_pm_ch *to_r8a7779_ch(struct generic_pm_domain *d)
26 33
27extern void r8a7779_init_delay(void); 34extern void r8a7779_init_delay(void);
28extern void r8a7779_init_irq_extpin(int irlm); 35extern void r8a7779_init_irq_extpin(int irlm);
36extern void r8a7779_init_irq_extpin_dt(int irlm);
29extern void r8a7779_init_irq_dt(void); 37extern void r8a7779_init_irq_dt(void);
30extern void r8a7779_map_io(void); 38extern void r8a7779_map_io(void);
31extern void r8a7779_earlytimer_init(void); 39extern void r8a7779_earlytimer_init(void);
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7790.h b/arch/arm/mach-shmobile/include/mach/r8a7790.h
index 79e731c83e50..5fbfa28b40b6 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7790.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7790.h
@@ -1,15 +1,13 @@
1#ifndef __ASM_R8A7790_H__ 1#ifndef __ASM_R8A7790_H__
2#define __ASM_R8A7790_H__ 2#define __ASM_R8A7790_H__
3 3
4#include <mach/rcar-gen2.h>
5
4void r8a7790_add_standard_devices(void); 6void r8a7790_add_standard_devices(void);
5void r8a7790_add_dt_devices(void); 7void r8a7790_add_dt_devices(void);
6void r8a7790_clock_init(void); 8void r8a7790_clock_init(void);
7void r8a7790_pinmux_init(void); 9void r8a7790_pinmux_init(void);
8void r8a7790_init_early(void); 10void r8a7790_init_early(void);
9void r8a7790_timer_init(void);
10extern struct smp_operations r8a7790_smp_ops; 11extern struct smp_operations r8a7790_smp_ops;
11 12
12#define MD(nr) BIT(nr)
13u32 r8a7790_read_mode_pins(void);
14
15#endif /* __ASM_R8A7790_H__ */ 13#endif /* __ASM_R8A7790_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/r8a7791.h b/arch/arm/mach-shmobile/include/mach/r8a7791.h
index 2e6d66131083..051ead3c286e 100644
--- a/arch/arm/mach-shmobile/include/mach/r8a7791.h
+++ b/arch/arm/mach-shmobile/include/mach/r8a7791.h
@@ -1,8 +1,10 @@
1#ifndef __ASM_R8A7791_H__ 1#ifndef __ASM_R8A7791_H__
2#define __ASM_R8A7791_H__ 2#define __ASM_R8A7791_H__
3 3
4void r8a7791_add_standard_devices(void);
4void r8a7791_add_dt_devices(void); 5void r8a7791_add_dt_devices(void);
5void r8a7791_clock_init(void); 6void r8a7791_clock_init(void);
6void r8a7791_init_early(void); 7void r8a7791_init_early(void);
8extern struct smp_operations r8a7791_smp_ops;
7 9
8#endif /* __ASM_R8A7791_H__ */ 10#endif /* __ASM_R8A7791_H__ */
diff --git a/arch/arm/mach-shmobile/include/mach/rcar-gen2.h b/arch/arm/mach-shmobile/include/mach/rcar-gen2.h
new file mode 100644
index 000000000000..43f606eb2d82
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/rcar-gen2.h
@@ -0,0 +1,8 @@
1#ifndef __ASM_RCAR_GEN2_H__
2#define __ASM_RCAR_GEN2_H__
3
4void rcar_gen2_timer_init(void);
5#define MD(nr) BIT(nr)
6u32 rcar_gen2_read_mode_pins(void);
7
8#endif /* __ASM_RCAR_GEN2_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..d4eb509a1c87
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-r7s72100.c
@@ -0,0 +1,88 @@
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 <linux/serial_sci.h>
25#include <mach/common.h>
26#include <mach/irqs.h>
27#include <mach/r7s72100.h>
28#include <asm/mach/arch.h>
29
30#define SCIF_DATA(index, baseaddr, irq) \
31[index] = { \
32 .type = PORT_SCIF, \
33 .regtype = SCIx_SH2_SCIF_FIFODATA_REGTYPE, \
34 .flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP, \
35 .scbrr_algo_id = SCBRR_ALGO_2, \
36 .scscr = SCSCR_RIE | SCSCR_TIE | SCSCR_RE | SCSCR_TE | \
37 SCSCR_REIE, \
38 .mapbase = baseaddr, \
39 .irqs = { irq + 1, irq + 2, irq + 3, irq }, \
40}
41
42enum { SCIF0, SCIF1, SCIF2, SCIF3, SCIF4, SCIF5, SCIF6, SCIF7 };
43
44static const struct plat_sci_port scif[] __initconst = {
45 SCIF_DATA(SCIF0, 0xe8007000, gic_iid(221)), /* SCIF0 */
46 SCIF_DATA(SCIF1, 0xe8007800, gic_iid(225)), /* SCIF1 */
47 SCIF_DATA(SCIF2, 0xe8008000, gic_iid(229)), /* SCIF2 */
48 SCIF_DATA(SCIF3, 0xe8008800, gic_iid(233)), /* SCIF3 */
49 SCIF_DATA(SCIF4, 0xe8009000, gic_iid(237)), /* SCIF4 */
50 SCIF_DATA(SCIF5, 0xe8009800, gic_iid(241)), /* SCIF5 */
51 SCIF_DATA(SCIF6, 0xe800a000, gic_iid(245)), /* SCIF6 */
52 SCIF_DATA(SCIF7, 0xe800a800, gic_iid(249)), /* SCIF7 */
53};
54
55static inline void r7s72100_register_scif(int idx)
56{
57 platform_device_register_data(&platform_bus, "sh-sci", idx, &scif[idx],
58 sizeof(struct plat_sci_port));
59}
60
61void __init r7s72100_add_dt_devices(void)
62{
63 r7s72100_register_scif(SCIF0);
64 r7s72100_register_scif(SCIF1);
65 r7s72100_register_scif(SCIF2);
66 r7s72100_register_scif(SCIF3);
67 r7s72100_register_scif(SCIF4);
68 r7s72100_register_scif(SCIF5);
69 r7s72100_register_scif(SCIF6);
70 r7s72100_register_scif(SCIF7);
71}
72
73void __init r7s72100_init_early(void)
74{
75 shmobile_setup_delay(400, 1, 3); /* Cortex-A9 @ 400MHz */
76}
77
78#ifdef CONFIG_USE_OF
79static const char *r7s72100_boards_compat_dt[] __initdata = {
80 "renesas,r7s72100",
81 NULL,
82};
83
84DT_MACHINE_START(R7S72100_DT, "Generic R7S72100 (Flattened Device Tree)")
85 .init_early = r7s72100_init_early,
86 .dt_compat = r7s72100_boards_compat_dt,
87MACHINE_END
88#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a73a4.c b/arch/arm/mach-shmobile/setup-r8a73a4.c
index 53a896275cae..b0f2749071be 100644
--- a/arch/arm/mach-shmobile/setup-r8a73a4.c
+++ b/arch/arm/mach-shmobile/setup-r8a73a4.c
@@ -22,8 +22,10 @@
22#include <linux/of_platform.h> 22#include <linux/of_platform.h>
23#include <linux/platform_data/irq-renesas-irqc.h> 23#include <linux/platform_data/irq-renesas-irqc.h>
24#include <linux/serial_sci.h> 24#include <linux/serial_sci.h>
25#include <linux/sh_dma.h>
25#include <linux/sh_timer.h> 26#include <linux/sh_timer.h>
26#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/dma-register.h>
27#include <mach/irqs.h> 29#include <mach/irqs.h>
28#include <mach/r8a73a4.h> 30#include <mach/r8a73a4.h>
29#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
@@ -199,12 +201,101 @@ void __init r8a73a4_add_dt_devices(void)
199 r8a7790_register_cmt(10); 201 r8a7790_register_cmt(10);
200} 202}
201 203
204/* DMA */
205static const struct sh_dmae_slave_config dma_slaves[] = {
206 {
207 .slave_id = SHDMA_SLAVE_MMCIF0_TX,
208 .addr = 0xee200034,
209 .chcr = CHCR_TX(XMIT_SZ_32BIT),
210 .mid_rid = 0xd1,
211 }, {
212 .slave_id = SHDMA_SLAVE_MMCIF0_RX,
213 .addr = 0xee200034,
214 .chcr = CHCR_RX(XMIT_SZ_32BIT),
215 .mid_rid = 0xd2,
216 }, {
217 .slave_id = SHDMA_SLAVE_MMCIF1_TX,
218 .addr = 0xee220034,
219 .chcr = CHCR_TX(XMIT_SZ_32BIT),
220 .mid_rid = 0xe1,
221 }, {
222 .slave_id = SHDMA_SLAVE_MMCIF1_RX,
223 .addr = 0xee220034,
224 .chcr = CHCR_RX(XMIT_SZ_32BIT),
225 .mid_rid = 0xe2,
226 },
227};
228
229#define DMAE_CHANNEL(a, b) \
230 { \
231 .offset = (a) - 0x20, \
232 .dmars = (a) - 0x20 + 0x40, \
233 .chclr_bit = (b), \
234 .chclr_offset = 0x80 - 0x20, \
235 }
236
237static const struct sh_dmae_channel dma_channels[] = {
238 DMAE_CHANNEL(0x8000, 0),
239 DMAE_CHANNEL(0x8080, 1),
240 DMAE_CHANNEL(0x8100, 2),
241 DMAE_CHANNEL(0x8180, 3),
242 DMAE_CHANNEL(0x8200, 4),
243 DMAE_CHANNEL(0x8280, 5),
244 DMAE_CHANNEL(0x8300, 6),
245 DMAE_CHANNEL(0x8380, 7),
246 DMAE_CHANNEL(0x8400, 8),
247 DMAE_CHANNEL(0x8480, 9),
248 DMAE_CHANNEL(0x8500, 10),
249 DMAE_CHANNEL(0x8580, 11),
250 DMAE_CHANNEL(0x8600, 12),
251 DMAE_CHANNEL(0x8680, 13),
252 DMAE_CHANNEL(0x8700, 14),
253 DMAE_CHANNEL(0x8780, 15),
254 DMAE_CHANNEL(0x8800, 16),
255 DMAE_CHANNEL(0x8880, 17),
256 DMAE_CHANNEL(0x8900, 18),
257 DMAE_CHANNEL(0x8980, 19),
258};
259
260static const struct sh_dmae_pdata dma_pdata = {
261 .slave = dma_slaves,
262 .slave_num = ARRAY_SIZE(dma_slaves),
263 .channel = dma_channels,
264 .channel_num = ARRAY_SIZE(dma_channels),
265 .ts_low_shift = TS_LOW_SHIFT,
266 .ts_low_mask = TS_LOW_BIT << TS_LOW_SHIFT,
267 .ts_high_shift = TS_HI_SHIFT,
268 .ts_high_mask = TS_HI_BIT << TS_HI_SHIFT,
269 .ts_shift = dma_ts_shift,
270 .ts_shift_num = ARRAY_SIZE(dma_ts_shift),
271 .dmaor_init = DMAOR_DME,
272 .chclr_present = 1,
273 .chclr_bitwise = 1,
274};
275
276static struct resource dma_resources[] = {
277 DEFINE_RES_MEM(0xe6700020, 0x89e0),
278 DEFINE_RES_IRQ_NAMED(gic_spi(220), "error_irq"),
279 {
280 /* IRQ for channels 0-19 */
281 .start = gic_spi(200),
282 .end = gic_spi(219),
283 .flags = IORESOURCE_IRQ,
284 },
285};
286
287#define r8a73a4_register_dmac() \
288 platform_device_register_resndata(&platform_bus, "sh-dma-engine", 0, \
289 dma_resources, ARRAY_SIZE(dma_resources), \
290 &dma_pdata, sizeof(dma_pdata))
291
202void __init r8a73a4_add_standard_devices(void) 292void __init r8a73a4_add_standard_devices(void)
203{ 293{
204 r8a73a4_add_dt_devices(); 294 r8a73a4_add_dt_devices();
205 r8a73a4_register_irqc(0); 295 r8a73a4_register_irqc(0);
206 r8a73a4_register_irqc(1); 296 r8a73a4_register_irqc(1);
207 r8a73a4_register_thermal(); 297 r8a73a4_register_thermal();
298 r8a73a4_register_dmac();
208} 299}
209 300
210void __init r8a73a4_init_early(void) 301void __init r8a73a4_init_early(void)
diff --git a/arch/arm/mach-shmobile/setup-r8a7778.c b/arch/arm/mach-shmobile/setup-r8a7778.c
index e484d1420a01..16d49aa8b5db 100644
--- a/arch/arm/mach-shmobile/setup-r8a7778.c
+++ b/arch/arm/mach-shmobile/setup-r8a7778.c
@@ -24,6 +24,7 @@
24#include <linux/irqchip/arm-gic.h> 24#include <linux/irqchip/arm-gic.h>
25#include <linux/of.h> 25#include <linux/of.h>
26#include <linux/of_platform.h> 26#include <linux/of_platform.h>
27#include <linux/platform_data/dma-rcar-hpbdma.h>
27#include <linux/platform_data/gpio-rcar.h> 28#include <linux/platform_data/gpio-rcar.h>
28#include <linux/platform_data/irq-renesas-intc-irqpin.h> 29#include <linux/platform_data/irq-renesas-intc-irqpin.h>
29#include <linux/platform_device.h> 30#include <linux/platform_device.h>
@@ -356,6 +357,88 @@ void __init r8a7778_add_dt_devices(void)
356 r8a7778_register_tmu(1); 357 r8a7778_register_tmu(1);
357} 358}
358 359
360/* HPB-DMA */
361
362/* Asynchronous mode register (ASYNCMDR) bits */
363#define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(2) /* SDHI0 */
364#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(2) /* SDHI0 */
365#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */
366#define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(1) /* SDHI0 */
367#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(1) /* SDHI0 */
368#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
369
370static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
371 {
372 .id = HPBDMA_SLAVE_SDHI0_TX,
373 .addr = 0xffe4c000 + 0x30,
374 .dcr = HPB_DMAE_DCR_SPDS_16BIT |
375 HPB_DMAE_DCR_DMDL |
376 HPB_DMAE_DCR_DPDS_16BIT,
377 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
378 HPB_DMAE_ASYNCRSTR_ASRST22 |
379 HPB_DMAE_ASYNCRSTR_ASRST23,
380 .mdr = HPB_DMAE_ASYNCMDR_ASMD21_MULTI,
381 .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK,
382 .port = 0x0D0C,
383 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
384 .dma_ch = 21,
385 }, {
386 .id = HPBDMA_SLAVE_SDHI0_RX,
387 .addr = 0xffe4c000 + 0x30,
388 .dcr = HPB_DMAE_DCR_SMDL |
389 HPB_DMAE_DCR_SPDS_16BIT |
390 HPB_DMAE_DCR_DPDS_16BIT,
391 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
392 HPB_DMAE_ASYNCRSTR_ASRST22 |
393 HPB_DMAE_ASYNCRSTR_ASRST23,
394 .mdr = HPB_DMAE_ASYNCMDR_ASMD22_MULTI,
395 .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK,
396 .port = 0x0D0C,
397 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
398 .dma_ch = 22,
399 },
400};
401
402static const struct hpb_dmae_channel hpb_dmae_channels[] = {
403 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
404 HPB_DMAE_CHANNEL(0x7e, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
405};
406
407static struct hpb_dmae_pdata dma_platform_data __initdata = {
408 .slaves = hpb_dmae_slaves,
409 .num_slaves = ARRAY_SIZE(hpb_dmae_slaves),
410 .channels = hpb_dmae_channels,
411 .num_channels = ARRAY_SIZE(hpb_dmae_channels),
412 .ts_shift = {
413 [XMIT_SZ_8BIT] = 0,
414 [XMIT_SZ_16BIT] = 1,
415 [XMIT_SZ_32BIT] = 2,
416 },
417 .num_hw_channels = 39,
418};
419
420static struct resource hpb_dmae_resources[] __initdata = {
421 /* Channel registers */
422 DEFINE_RES_MEM(0xffc08000, 0x1000),
423 /* Common registers */
424 DEFINE_RES_MEM(0xffc09000, 0x170),
425 /* Asynchronous reset registers */
426 DEFINE_RES_MEM(0xffc00300, 4),
427 /* Asynchronous mode registers */
428 DEFINE_RES_MEM(0xffc00400, 4),
429 /* IRQ for DMA channels */
430 DEFINE_RES_NAMED(gic_iid(0x7b), 5, NULL, IORESOURCE_IRQ),
431};
432
433static void __init r8a7778_register_hpb_dmae(void)
434{
435 platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
436 hpb_dmae_resources,
437 ARRAY_SIZE(hpb_dmae_resources),
438 &dma_platform_data,
439 sizeof(dma_platform_data));
440}
441
359void __init r8a7778_add_standard_devices(void) 442void __init r8a7778_add_standard_devices(void)
360{ 443{
361 r8a7778_add_dt_devices(); 444 r8a7778_add_dt_devices();
@@ -366,6 +449,8 @@ void __init r8a7778_add_standard_devices(void)
366 r8a7778_register_hspi(0); 449 r8a7778_register_hspi(0);
367 r8a7778_register_hspi(1); 450 r8a7778_register_hspi(1);
368 r8a7778_register_hspi(2); 451 r8a7778_register_hspi(2);
452
453 r8a7778_register_hpb_dmae();
369} 454}
370 455
371void __init r8a7778_init_late(void) 456void __init r8a7778_init_late(void)
@@ -391,7 +476,7 @@ static struct resource irqpin_resources[] __initdata = {
391 DEFINE_RES_IRQ(gic_iid(0x3e)), /* IRQ3 */ 476 DEFINE_RES_IRQ(gic_iid(0x3e)), /* IRQ3 */
392}; 477};
393 478
394void __init r8a7778_init_irq_extpin(int irlm) 479void __init r8a7778_init_irq_extpin_dt(int irlm)
395{ 480{
396 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); 481 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
397 unsigned long tmp; 482 unsigned long tmp;
@@ -409,7 +494,11 @@ void __init r8a7778_init_irq_extpin(int irlm)
409 tmp |= (1 << 21); /* LVLMODE = 1 */ 494 tmp |= (1 << 21); /* LVLMODE = 1 */
410 iowrite32(tmp, icr0); 495 iowrite32(tmp, icr0);
411 iounmap(icr0); 496 iounmap(icr0);
497}
412 498
499void __init r8a7778_init_irq_extpin(int irlm)
500{
501 r8a7778_init_irq_extpin_dt(irlm);
413 if (irlm) 502 if (irlm)
414 platform_device_register_resndata( 503 platform_device_register_resndata(
415 &platform_bus, "renesas_intc_irqpin", -1, 504 &platform_bus, "renesas_intc_irqpin", -1,
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index ecd0148ee1e1..13049e9d691c 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -25,6 +25,7 @@
25#include <linux/irqchip.h> 25#include <linux/irqchip.h>
26#include <linux/irqchip/arm-gic.h> 26#include <linux/irqchip/arm-gic.h>
27#include <linux/of_platform.h> 27#include <linux/of_platform.h>
28#include <linux/platform_data/dma-rcar-hpbdma.h>
28#include <linux/platform_data/gpio-rcar.h> 29#include <linux/platform_data/gpio-rcar.h>
29#include <linux/platform_data/irq-renesas-intc-irqpin.h> 30#include <linux/platform_data/irq-renesas-intc-irqpin.h>
30#include <linux/platform_device.h> 31#include <linux/platform_device.h>
@@ -97,7 +98,7 @@ static struct resource irqpin0_resources[] __initdata = {
97 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */ 98 DEFINE_RES_IRQ(gic_spi(30)), /* IRQ3 */
98}; 99};
99 100
100void __init r8a7779_init_irq_extpin(int irlm) 101void __init r8a7779_init_irq_extpin_dt(int irlm)
101{ 102{
102 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE); 103 void __iomem *icr0 = ioremap_nocache(0xfe780000, PAGE_SIZE);
103 u32 tmp; 104 u32 tmp;
@@ -115,7 +116,11 @@ void __init r8a7779_init_irq_extpin(int irlm)
115 tmp |= (1 << 21); /* LVLMODE = 1 */ 116 tmp |= (1 << 21); /* LVLMODE = 1 */
116 iowrite32(tmp, icr0); 117 iowrite32(tmp, icr0);
117 iounmap(icr0); 118 iounmap(icr0);
119}
118 120
121void __init r8a7779_init_irq_extpin(int irlm)
122{
123 r8a7779_init_irq_extpin_dt(irlm);
119 if (irlm) 124 if (irlm)
120 platform_device_register_resndata( 125 platform_device_register_resndata(
121 &platform_bus, "renesas_intc_irqpin", -1, 126 &platform_bus, "renesas_intc_irqpin", -1,
@@ -632,6 +637,158 @@ static struct platform_device_info *vin_info_table[] __initdata = {
632 &vin3_info, 637 &vin3_info,
633}; 638};
634 639
640/* HPB-DMA */
641
642/* Asynchronous mode register bits */
643#define HPB_DMAE_ASYNCMDR_ASMD43_MASK BIT(23) /* MMC1 */
644#define HPB_DMAE_ASYNCMDR_ASMD43_SINGLE BIT(23) /* MMC1 */
645#define HPB_DMAE_ASYNCMDR_ASMD43_MULTI 0 /* MMC1 */
646#define HPB_DMAE_ASYNCMDR_ASBTMD43_MASK BIT(22) /* MMC1 */
647#define HPB_DMAE_ASYNCMDR_ASBTMD43_BURST BIT(22) /* MMC1 */
648#define HPB_DMAE_ASYNCMDR_ASBTMD43_NBURST 0 /* MMC1 */
649#define HPB_DMAE_ASYNCMDR_ASMD24_MASK BIT(21) /* MMC0 */
650#define HPB_DMAE_ASYNCMDR_ASMD24_SINGLE BIT(21) /* MMC0 */
651#define HPB_DMAE_ASYNCMDR_ASMD24_MULTI 0 /* MMC0 */
652#define HPB_DMAE_ASYNCMDR_ASBTMD24_MASK BIT(20) /* MMC0 */
653#define HPB_DMAE_ASYNCMDR_ASBTMD24_BURST BIT(20) /* MMC0 */
654#define HPB_DMAE_ASYNCMDR_ASBTMD24_NBURST 0 /* MMC0 */
655#define HPB_DMAE_ASYNCMDR_ASMD41_MASK BIT(19) /* SDHI3 */
656#define HPB_DMAE_ASYNCMDR_ASMD41_SINGLE BIT(19) /* SDHI3 */
657#define HPB_DMAE_ASYNCMDR_ASMD41_MULTI 0 /* SDHI3 */
658#define HPB_DMAE_ASYNCMDR_ASBTMD41_MASK BIT(18) /* SDHI3 */
659#define HPB_DMAE_ASYNCMDR_ASBTMD41_BURST BIT(18) /* SDHI3 */
660#define HPB_DMAE_ASYNCMDR_ASBTMD41_NBURST 0 /* SDHI3 */
661#define HPB_DMAE_ASYNCMDR_ASMD40_MASK BIT(17) /* SDHI3 */
662#define HPB_DMAE_ASYNCMDR_ASMD40_SINGLE BIT(17) /* SDHI3 */
663#define HPB_DMAE_ASYNCMDR_ASMD40_MULTI 0 /* SDHI3 */
664#define HPB_DMAE_ASYNCMDR_ASBTMD40_MASK BIT(16) /* SDHI3 */
665#define HPB_DMAE_ASYNCMDR_ASBTMD40_BURST BIT(16) /* SDHI3 */
666#define HPB_DMAE_ASYNCMDR_ASBTMD40_NBURST 0 /* SDHI3 */
667#define HPB_DMAE_ASYNCMDR_ASMD39_MASK BIT(15) /* SDHI3 */
668#define HPB_DMAE_ASYNCMDR_ASMD39_SINGLE BIT(15) /* SDHI3 */
669#define HPB_DMAE_ASYNCMDR_ASMD39_MULTI 0 /* SDHI3 */
670#define HPB_DMAE_ASYNCMDR_ASBTMD39_MASK BIT(14) /* SDHI3 */
671#define HPB_DMAE_ASYNCMDR_ASBTMD39_BURST BIT(14) /* SDHI3 */
672#define HPB_DMAE_ASYNCMDR_ASBTMD39_NBURST 0 /* SDHI3 */
673#define HPB_DMAE_ASYNCMDR_ASMD27_MASK BIT(13) /* SDHI2 */
674#define HPB_DMAE_ASYNCMDR_ASMD27_SINGLE BIT(13) /* SDHI2 */
675#define HPB_DMAE_ASYNCMDR_ASMD27_MULTI 0 /* SDHI2 */
676#define HPB_DMAE_ASYNCMDR_ASBTMD27_MASK BIT(12) /* SDHI2 */
677#define HPB_DMAE_ASYNCMDR_ASBTMD27_BURST BIT(12) /* SDHI2 */
678#define HPB_DMAE_ASYNCMDR_ASBTMD27_NBURST 0 /* SDHI2 */
679#define HPB_DMAE_ASYNCMDR_ASMD26_MASK BIT(11) /* SDHI2 */
680#define HPB_DMAE_ASYNCMDR_ASMD26_SINGLE BIT(11) /* SDHI2 */
681#define HPB_DMAE_ASYNCMDR_ASMD26_MULTI 0 /* SDHI2 */
682#define HPB_DMAE_ASYNCMDR_ASBTMD26_MASK BIT(10) /* SDHI2 */
683#define HPB_DMAE_ASYNCMDR_ASBTMD26_BURST BIT(10) /* SDHI2 */
684#define HPB_DMAE_ASYNCMDR_ASBTMD26_NBURST 0 /* SDHI2 */
685#define HPB_DMAE_ASYNCMDR_ASMD25_MASK BIT(9) /* SDHI2 */
686#define HPB_DMAE_ASYNCMDR_ASMD25_SINGLE BIT(9) /* SDHI2 */
687#define HPB_DMAE_ASYNCMDR_ASMD25_MULTI 0 /* SDHI2 */
688#define HPB_DMAE_ASYNCMDR_ASBTMD25_MASK BIT(8) /* SDHI2 */
689#define HPB_DMAE_ASYNCMDR_ASBTMD25_BURST BIT(8) /* SDHI2 */
690#define HPB_DMAE_ASYNCMDR_ASBTMD25_NBURST 0 /* SDHI2 */
691#define HPB_DMAE_ASYNCMDR_ASMD23_MASK BIT(7) /* SDHI0 */
692#define HPB_DMAE_ASYNCMDR_ASMD23_SINGLE BIT(7) /* SDHI0 */
693#define HPB_DMAE_ASYNCMDR_ASMD23_MULTI 0 /* SDHI0 */
694#define HPB_DMAE_ASYNCMDR_ASBTMD23_MASK BIT(6) /* SDHI0 */
695#define HPB_DMAE_ASYNCMDR_ASBTMD23_BURST BIT(6) /* SDHI0 */
696#define HPB_DMAE_ASYNCMDR_ASBTMD23_NBURST 0 /* SDHI0 */
697#define HPB_DMAE_ASYNCMDR_ASMD22_MASK BIT(5) /* SDHI0 */
698#define HPB_DMAE_ASYNCMDR_ASMD22_SINGLE BIT(5) /* SDHI0 */
699#define HPB_DMAE_ASYNCMDR_ASMD22_MULTI 0 /* SDHI0 */
700#define HPB_DMAE_ASYNCMDR_ASBTMD22_MASK BIT(4) /* SDHI0 */
701#define HPB_DMAE_ASYNCMDR_ASBTMD22_BURST BIT(4) /* SDHI0 */
702#define HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST 0 /* SDHI0 */
703#define HPB_DMAE_ASYNCMDR_ASMD21_MASK BIT(3) /* SDHI0 */
704#define HPB_DMAE_ASYNCMDR_ASMD21_SINGLE BIT(3) /* SDHI0 */
705#define HPB_DMAE_ASYNCMDR_ASMD21_MULTI 0 /* SDHI0 */
706#define HPB_DMAE_ASYNCMDR_ASBTMD21_MASK BIT(2) /* SDHI0 */
707#define HPB_DMAE_ASYNCMDR_ASBTMD21_BURST BIT(2) /* SDHI0 */
708#define HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST 0 /* SDHI0 */
709#define HPB_DMAE_ASYNCMDR_ASMD20_MASK BIT(1) /* SDHI1 */
710#define HPB_DMAE_ASYNCMDR_ASMD20_SINGLE BIT(1) /* SDHI1 */
711#define HPB_DMAE_ASYNCMDR_ASMD20_MULTI 0 /* SDHI1 */
712#define HPB_DMAE_ASYNCMDR_ASBTMD20_MASK BIT(0) /* SDHI1 */
713#define HPB_DMAE_ASYNCMDR_ASBTMD20_BURST BIT(0) /* SDHI1 */
714#define HPB_DMAE_ASYNCMDR_ASBTMD20_NBURST 0 /* SDHI1 */
715
716static const struct hpb_dmae_slave_config hpb_dmae_slaves[] = {
717 {
718 .id = HPBDMA_SLAVE_SDHI0_TX,
719 .addr = 0xffe4c000 + 0x30,
720 .dcr = HPB_DMAE_DCR_SPDS_16BIT |
721 HPB_DMAE_DCR_DMDL |
722 HPB_DMAE_DCR_DPDS_16BIT,
723 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
724 HPB_DMAE_ASYNCRSTR_ASRST22 |
725 HPB_DMAE_ASYNCRSTR_ASRST23,
726 .mdr = HPB_DMAE_ASYNCMDR_ASMD21_SINGLE |
727 HPB_DMAE_ASYNCMDR_ASBTMD21_NBURST,
728 .mdm = HPB_DMAE_ASYNCMDR_ASMD21_MASK |
729 HPB_DMAE_ASYNCMDR_ASBTMD21_MASK,
730 .port = 0x0D0C,
731 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
732 .dma_ch = 21,
733 }, {
734 .id = HPBDMA_SLAVE_SDHI0_RX,
735 .addr = 0xffe4c000 + 0x30,
736 .dcr = HPB_DMAE_DCR_SMDL |
737 HPB_DMAE_DCR_SPDS_16BIT |
738 HPB_DMAE_DCR_DPDS_16BIT,
739 .rstr = HPB_DMAE_ASYNCRSTR_ASRST21 |
740 HPB_DMAE_ASYNCRSTR_ASRST22 |
741 HPB_DMAE_ASYNCRSTR_ASRST23,
742 .mdr = HPB_DMAE_ASYNCMDR_ASMD22_SINGLE |
743 HPB_DMAE_ASYNCMDR_ASBTMD22_NBURST,
744 .mdm = HPB_DMAE_ASYNCMDR_ASMD22_MASK |
745 HPB_DMAE_ASYNCMDR_ASBTMD22_MASK,
746 .port = 0x0D0C,
747 .flags = HPB_DMAE_SET_ASYNC_RESET | HPB_DMAE_SET_ASYNC_MODE,
748 .dma_ch = 22,
749 },
750};
751
752static const struct hpb_dmae_channel hpb_dmae_channels[] = {
753 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_TX), /* ch. 21 */
754 HPB_DMAE_CHANNEL(0x93, HPBDMA_SLAVE_SDHI0_RX), /* ch. 22 */
755};
756
757static struct hpb_dmae_pdata dma_platform_data __initdata = {
758 .slaves = hpb_dmae_slaves,
759 .num_slaves = ARRAY_SIZE(hpb_dmae_slaves),
760 .channels = hpb_dmae_channels,
761 .num_channels = ARRAY_SIZE(hpb_dmae_channels),
762 .ts_shift = {
763 [XMIT_SZ_8BIT] = 0,
764 [XMIT_SZ_16BIT] = 1,
765 [XMIT_SZ_32BIT] = 2,
766 },
767 .num_hw_channels = 44,
768};
769
770static struct resource hpb_dmae_resources[] __initdata = {
771 /* Channel registers */
772 DEFINE_RES_MEM(0xffc08000, 0x1000),
773 /* Common registers */
774 DEFINE_RES_MEM(0xffc09000, 0x170),
775 /* Asynchronous reset registers */
776 DEFINE_RES_MEM(0xffc00300, 4),
777 /* Asynchronous mode registers */
778 DEFINE_RES_MEM(0xffc00400, 4),
779 /* IRQ for DMA channels */
780 DEFINE_RES_NAMED(gic_iid(0x8e), 12, NULL, IORESOURCE_IRQ),
781};
782
783static void __init r8a7779_register_hpb_dmae(void)
784{
785 platform_device_register_resndata(&platform_bus, "hpb-dma-engine", -1,
786 hpb_dmae_resources,
787 ARRAY_SIZE(hpb_dmae_resources),
788 &dma_platform_data,
789 sizeof(dma_platform_data));
790}
791
635static struct platform_device *r8a7779_devices_dt[] __initdata = { 792static struct platform_device *r8a7779_devices_dt[] __initdata = {
636 &scif0_device, 793 &scif0_device,
637 &scif1_device, 794 &scif1_device,
@@ -665,6 +822,7 @@ void __init r8a7779_add_standard_devices(void)
665 ARRAY_SIZE(r8a7779_devices_dt)); 822 ARRAY_SIZE(r8a7779_devices_dt));
666 platform_add_devices(r8a7779_standard_devices, 823 platform_add_devices(r8a7779_standard_devices,
667 ARRAY_SIZE(r8a7779_standard_devices)); 824 ARRAY_SIZE(r8a7779_standard_devices));
825 r8a7779_register_hpb_dmae();
668} 826}
669 827
670void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata) 828void __init r8a7779_add_ether_device(struct sh_eth_plat_data *pdata)
diff --git a/arch/arm/mach-shmobile/setup-r8a7790.c b/arch/arm/mach-shmobile/setup-r8a7790.c
index c7e24eff9ba2..c47bcebbcb00 100644
--- a/arch/arm/mach-shmobile/setup-r8a7790.c
+++ b/arch/arm/mach-shmobile/setup-r8a7790.c
@@ -18,7 +18,6 @@
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */ 19 */
20 20
21#include <linux/clocksource.h>
22#include <linux/irq.h> 21#include <linux/irq.h>
23#include <linux/kernel.h> 22#include <linux/kernel.h>
24#include <linux/of_platform.h> 23#include <linux/of_platform.h>
@@ -203,71 +202,6 @@ void __init r8a7790_add_standard_devices(void)
203 r8a7790_register_thermal(); 202 r8a7790_register_thermal();
204} 203}
205 204
206#define MODEMR 0xe6160060
207
208u32 __init r8a7790_read_mode_pins(void)
209{
210 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
211 u32 mode;
212
213 BUG_ON(!modemr);
214 mode = ioread32(modemr);
215 iounmap(modemr);
216
217 return mode;
218}
219
220#define CNTCR 0
221#define CNTFID0 0x20
222
223void __init r8a7790_timer_init(void)
224{
225#ifdef CONFIG_ARM_ARCH_TIMER
226 u32 mode = r8a7790_read_mode_pins();
227 void __iomem *base;
228 int extal_mhz = 0;
229 u32 freq;
230
231 /* At Linux boot time the r8a7790 arch timer comes up
232 * with the counter disabled. Moreover, it may also report
233 * a potentially incorrect fixed 13 MHz frequency. To be
234 * correct these registers need to be updated to use the
235 * frequency EXTAL / 2 which can be determined by the MD pins.
236 */
237
238 switch (mode & (MD(14) | MD(13))) {
239 case 0:
240 extal_mhz = 15;
241 break;
242 case MD(13):
243 extal_mhz = 20;
244 break;
245 case MD(14):
246 extal_mhz = 26;
247 break;
248 case MD(13) | MD(14):
249 extal_mhz = 30;
250 break;
251 }
252
253 /* The arch timer frequency equals EXTAL / 2 */
254 freq = extal_mhz * (1000000 / 2);
255
256 /* Remap "armgcnt address map" space */
257 base = ioremap(0xe6080000, PAGE_SIZE);
258
259 /* Update registers with correct frequency */
260 iowrite32(freq, base + CNTFID0);
261 asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
262
263 /* make sure arch timer is started by setting bit 0 of CNTCR */
264 iowrite32(1, base + CNTCR);
265 iounmap(base);
266#endif /* CONFIG_ARM_ARCH_TIMER */
267
268 clocksource_of_init();
269}
270
271void __init r8a7790_init_early(void) 205void __init r8a7790_init_early(void)
272{ 206{
273#ifndef CONFIG_ARM_ARCH_TIMER 207#ifndef CONFIG_ARM_ARCH_TIMER
@@ -285,7 +219,7 @@ static const char * const r8a7790_boards_compat_dt[] __initconst = {
285DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)") 219DT_MACHINE_START(R8A7790_DT, "Generic R8A7790 (Flattened Device Tree)")
286 .smp = smp_ops(r8a7790_smp_ops), 220 .smp = smp_ops(r8a7790_smp_ops),
287 .init_early = r8a7790_init_early, 221 .init_early = r8a7790_init_early,
288 .init_time = r8a7790_timer_init, 222 .init_time = rcar_gen2_timer_init,
289 .dt_compat = r8a7790_boards_compat_dt, 223 .dt_compat = r8a7790_boards_compat_dt,
290MACHINE_END 224MACHINE_END
291#endif /* CONFIG_USE_OF */ 225#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-r8a7791.c b/arch/arm/mach-shmobile/setup-r8a7791.c
index b56399d2e1de..d9393d61ee27 100644
--- a/arch/arm/mach-shmobile/setup-r8a7791.c
+++ b/arch/arm/mach-shmobile/setup-r8a7791.c
@@ -22,11 +22,13 @@
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/kernel.h> 23#include <linux/kernel.h>
24#include <linux/of_platform.h> 24#include <linux/of_platform.h>
25#include <linux/platform_data/irq-renesas-irqc.h>
25#include <linux/serial_sci.h> 26#include <linux/serial_sci.h>
26#include <linux/sh_timer.h> 27#include <linux/sh_timer.h>
27#include <mach/common.h> 28#include <mach/common.h>
28#include <mach/irqs.h> 29#include <mach/irqs.h>
29#include <mach/r8a7791.h> 30#include <mach/r8a7791.h>
31#include <mach/rcar-gen2.h>
30#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
31 33
32#define SCIF_COMMON(scif_type, baseaddr, irq) \ 34#define SCIF_COMMON(scif_type, baseaddr, irq) \
@@ -109,6 +111,31 @@ static const struct resource cmt00_resources[] __initconst = {
109 &cmt##idx##_platform_data, \ 111 &cmt##idx##_platform_data, \
110 sizeof(struct sh_timer_config)) 112 sizeof(struct sh_timer_config))
111 113
114static struct renesas_irqc_config irqc0_data = {
115 .irq_base = irq_pin(0), /* IRQ0 -> IRQ9 */
116};
117
118static struct resource irqc0_resources[] = {
119 DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */
120 DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */
121 DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */
122 DEFINE_RES_IRQ(gic_spi(2)), /* IRQ2 */
123 DEFINE_RES_IRQ(gic_spi(3)), /* IRQ3 */
124 DEFINE_RES_IRQ(gic_spi(12)), /* IRQ4 */
125 DEFINE_RES_IRQ(gic_spi(13)), /* IRQ5 */
126 DEFINE_RES_IRQ(gic_spi(14)), /* IRQ6 */
127 DEFINE_RES_IRQ(gic_spi(15)), /* IRQ7 */
128 DEFINE_RES_IRQ(gic_spi(16)), /* IRQ8 */
129 DEFINE_RES_IRQ(gic_spi(17)), /* IRQ9 */
130};
131
132#define r8a7791_register_irqc(idx) \
133 platform_device_register_resndata(&platform_bus, "renesas_irqc", \
134 idx, irqc##idx##_resources, \
135 ARRAY_SIZE(irqc##idx##_resources), \
136 &irqc##idx##_data, \
137 sizeof(struct renesas_irqc_config))
138
112void __init r8a7791_add_dt_devices(void) 139void __init r8a7791_add_dt_devices(void)
113{ 140{
114 r8a7791_register_scif(SCIFA0); 141 r8a7791_register_scif(SCIFA0);
@@ -129,6 +156,12 @@ void __init r8a7791_add_dt_devices(void)
129 r8a7791_register_cmt(00); 156 r8a7791_register_cmt(00);
130} 157}
131 158
159void __init r8a7791_add_standard_devices(void)
160{
161 r8a7791_add_dt_devices();
162 r8a7791_register_irqc(0);
163}
164
132void __init r8a7791_init_early(void) 165void __init r8a7791_init_early(void)
133{ 166{
134#ifndef CONFIG_ARM_ARCH_TIMER 167#ifndef CONFIG_ARM_ARCH_TIMER
@@ -143,7 +176,9 @@ static const char *r8a7791_boards_compat_dt[] __initdata = {
143}; 176};
144 177
145DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)") 178DT_MACHINE_START(R8A7791_DT, "Generic R8A7791 (Flattened Device Tree)")
179 .smp = smp_ops(r8a7791_smp_ops),
146 .init_early = r8a7791_init_early, 180 .init_early = r8a7791_init_early,
181 .init_time = rcar_gen2_timer_init,
147 .dt_compat = r8a7791_boards_compat_dt, 182 .dt_compat = r8a7791_boards_compat_dt,
148MACHINE_END 183MACHINE_END
149#endif /* CONFIG_USE_OF */ 184#endif /* CONFIG_USE_OF */
diff --git a/arch/arm/mach-shmobile/setup-rcar-gen2.c b/arch/arm/mach-shmobile/setup-rcar-gen2.c
new file mode 100644
index 000000000000..5734c24bf6c7
--- /dev/null
+++ b/arch/arm/mach-shmobile/setup-rcar-gen2.c
@@ -0,0 +1,91 @@
1/*
2 * R-Car Generation 2 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/clocksource.h>
22#include <linux/io.h>
23#include <linux/kernel.h>
24#include <mach/common.h>
25#include <mach/rcar-gen2.h>
26#include <asm/mach/arch.h>
27
28#define MODEMR 0xe6160060
29
30u32 __init rcar_gen2_read_mode_pins(void)
31{
32 void __iomem *modemr = ioremap_nocache(MODEMR, 4);
33 u32 mode;
34
35 BUG_ON(!modemr);
36 mode = ioread32(modemr);
37 iounmap(modemr);
38
39 return mode;
40}
41
42#define CNTCR 0
43#define CNTFID0 0x20
44
45void __init rcar_gen2_timer_init(void)
46{
47#ifdef CONFIG_ARM_ARCH_TIMER
48 u32 mode = rcar_gen2_read_mode_pins();
49 void __iomem *base;
50 int extal_mhz = 0;
51 u32 freq;
52
53 /* At Linux boot time the r8a7790 arch timer comes up
54 * with the counter disabled. Moreover, it may also report
55 * a potentially incorrect fixed 13 MHz frequency. To be
56 * correct these registers need to be updated to use the
57 * frequency EXTAL / 2 which can be determined by the MD pins.
58 */
59
60 switch (mode & (MD(14) | MD(13))) {
61 case 0:
62 extal_mhz = 15;
63 break;
64 case MD(13):
65 extal_mhz = 20;
66 break;
67 case MD(14):
68 extal_mhz = 26;
69 break;
70 case MD(13) | MD(14):
71 extal_mhz = 30;
72 break;
73 }
74
75 /* The arch timer frequency equals EXTAL / 2 */
76 freq = extal_mhz * (1000000 / 2);
77
78 /* Remap "armgcnt address map" space */
79 base = ioremap(0xe6080000, PAGE_SIZE);
80
81 /* Update registers with correct frequency */
82 iowrite32(freq, base + CNTFID0);
83 asm volatile("mcr p15, 0, %0, c14, c0, 0" : : "r" (freq));
84
85 /* make sure arch timer is started by setting bit 0 of CNTCR */
86 iowrite32(1, base + CNTCR);
87 iounmap(base);
88#endif /* CONFIG_ARM_ARCH_TIMER */
89
90 clocksource_of_init();
91}
diff --git a/arch/arm/mach-shmobile/smp-r8a7791.c b/arch/arm/mach-shmobile/smp-r8a7791.c
new file mode 100644
index 000000000000..2df5bd190fe4
--- /dev/null
+++ b/arch/arm/mach-shmobile/smp-r8a7791.c
@@ -0,0 +1,62 @@
1/*
2 * SMP support for r8a7791
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#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/smp.h>
19#include <linux/io.h>
20#include <asm/smp_plat.h>
21#include <mach/common.h>
22#include <mach/r8a7791.h>
23
24#define RST 0xe6160000
25#define CA15BAR 0x0020
26#define CA15RESCNT 0x0040
27#define RAM 0xe6300000
28
29static void __init r8a7791_smp_prepare_cpus(unsigned int max_cpus)
30{
31 void __iomem *p;
32 u32 bar;
33
34 /* let APMU code install data related to shmobile_boot_vector */
35 shmobile_smp_apmu_prepare_cpus(max_cpus);
36
37 /* RAM for jump stub, because BAR requires 256KB aligned address */
38 p = ioremap_nocache(RAM, shmobile_boot_size);
39 memcpy_toio(p, shmobile_boot_vector, shmobile_boot_size);
40 iounmap(p);
41
42 /* setup reset vectors */
43 p = ioremap_nocache(RST, 0x63);
44 bar = (RAM >> 8) & 0xfffffc00;
45 writel_relaxed(bar, p + CA15BAR);
46 writel_relaxed(bar | 0x10, p + CA15BAR);
47
48 /* enable clocks to all CPUs */
49 writel_relaxed((readl_relaxed(p + CA15RESCNT) & ~0x0f) | 0xa5a50000,
50 p + CA15RESCNT);
51 iounmap(p);
52}
53
54struct smp_operations r8a7791_smp_ops __initdata = {
55 .smp_prepare_cpus = r8a7791_smp_prepare_cpus,
56 .smp_boot_secondary = shmobile_smp_apmu_boot_secondary,
57#ifdef CONFIG_HOTPLUG_CPU
58 .cpu_disable = shmobile_smp_cpu_disable,
59 .cpu_die = shmobile_smp_apmu_cpu_die,
60 .cpu_kill = shmobile_smp_apmu_cpu_kill,
61#endif
62};