Skip to contentSkip to conversation

ARM: shmobile: r8a7790 SoC

PATCH New Magnus Damm 2 participants 6 messages Mar 27, 2013 – Apr 2, 2013

Subsystems (5)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

v2 cover ARM: shmobile: r8a7790 SoC

ARM: shmobile: r8a7790 SoC (V2)

[PATCH 01/04] ARM: shmobile: Initial r8a7790 SoC support [PATCH 02/04] ARM: shmobile: r8a7790 SCIF support [PATCH 03/04] ARM: shmobile: r8a7790 IRQC support [PATCH 04/04] ARM: shmobile: r8a7790 PFC support

This series is V2 of initial support for the r8a7790 SoC. The SoC is known as r8a7790 which is built around Cortex-A15 and makes use of SCIF for serial and IRQC interrupt controller for external IRQs.

Changes in V2:
- Added PFC platform device

Future r8a7790 PFC and Lager board series will depend on this one.

---

Written on top of renesas-next-20130327

 arch/arm/boot/dts/r8a7790.dtsi                |   63 +++++++++++
 arch/arm/mach-shmobile/Kconfig                |    9 +
 arch/arm/mach-shmobile/Makefile               |    1 
 arch/arm/mach-shmobile/clock-r8a7790.c        |   95 +++++++++++++++++
 arch/arm/mach-shmobile/include/mach/r8a7790.h |    8 +
 arch/arm/mach-shmobile/setup-r8a7790.c        |  137 +++++++++++++++++++++++++
 6 files changed, 312 insertions(+), 1 deletion(-)
author maintainer
#1 lore raw

PATCH v2 1/4 ARM: shmobile: Initial r8a7790 SoC support

From: Magnus Damm <[email protected]>

Add initial support for the r8a7790 SoC including:
- Single Cortex-A15 CPU Core
- GIC
- Architecture timer

No static virtual mappings are used, all the components make use of ioremap(). DT_MACHINE_START is still wrapped in CONFIG_USE_OF to match other mach-shmobile code.

---

 arch/arm/boot/dts/r8a7790.dtsi                |   54 ++++++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig                |    7 ++
 arch/arm/mach-shmobile/Makefile               |    1 
 arch/arm/mach-shmobile/clock-r8a7790.c        |   61 +++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/r8a7790.h |    7 ++
 arch/arm/mach-shmobile/setup-r8a7790.c        |   51 ++++++++++++++++++++
 6 files changed, 181 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi new file +54 -0
@@ -0,0 +1,54 @@
+/*
+ * Device Tree Source for the r8a7790 SoC
+ *
+ * Copyright (C) 2013 Renesas Solutions Corp.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "renesas,r8a7790";
+	interrupt-parent = <&gic>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu0: cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a15";
+			reg = <0>;
+			clock-frequency = <1300000000>;
+		};
+	};
+
+	gic: interrupt-controller at f1001000 {
+		compatible = "arm,cortex-a15-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		reg = <0xf1001000 0x1000>,
+			<0xf1002000 0x1000>,
+			<0xf1004000 0x2000>,
+			<0xf1006000 0x2000>;
+		interrupts = <1 9 0xf04>;
+
+		gic-cpuif at 4 {
+			compatible = "arm,gic-cpuif";
+			cpuif-id = <4>;
+			cpu = <&cpu0>;
+		};
+	};
+
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupts = <1 13 0xf08>,
+				<1 14 0xf08>,
+				<1 11 0xf08>,
+				<1 10 0xf08>;
+	};
+};
arch/arm/mach-shmobile/Kconfig +7 -0
@@ -43,6 +43,13 @@ config ARCH_R8A7779
 	select USB_ARCH_HAS_OHCI
 	select RENESAS_INTC_IRQPIN
 
+config ARCH_R8A7790
+	bool "R-Car H2 (R8A77900)"
+	select ARM_GIC
+	select CPU_V7
+	select ARM_ARCH_TIMER
+	select SH_CLK_CPG
+
 config ARCH_EMEV2
 	bool "Emma Mobile EV2"
 	select ARCH_WANT_OPTIONAL_GPIOLIB
arch/arm/mach-shmobile/Makefile +1 -0
@@ -11,6 +11,7 @@ obj-$(CONFIG_ARCH_SH73A0)	+= setup-sh73a
 obj-$(CONFIG_ARCH_R8A73A4)	+= setup-r8a73a4.o clock-r8a73a4.o
 obj-$(CONFIG_ARCH_R8A7740)	+= setup-r8a7740.o clock-r8a7740.o intc-r8a7740.o
 obj-$(CONFIG_ARCH_R8A7779)	+= setup-r8a7779.o clock-r8a7779.o intc-r8a7779.o
+obj-$(CONFIG_ARCH_R8A7790)	+= setup-r8a7790.o clock-r8a7790.o
 obj-$(CONFIG_ARCH_EMEV2)	+= setup-emev2.o clock-emev2.o
 
 # SMP objects
arch/arm/mach-shmobile/clock-r8a7790.c new file +61 -0

61 lines not on this page · raw message

arch/arm/mach-shmobile/include/mach/r8a7790.h new file +7 -0
@@ -0,0 +1,7 @@
+#ifndef __ASM_R8A7790_H__
+#define __ASM_R8A7790_H__
+
+void r8a7790_add_standard_devices(void);
+void r8a7790_clock_init(void);
+
+#endif /* __ASM_R8A7790_H__ */
arch/arm/mach-shmobile/setup-r8a7790.c new file +51 -0

51 lines not on this page · raw message

author maintainer
#2 lore raw

PATCH v2 2/4 ARM: shmobile: r8a7790 SCIF support

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add SCIF serial port support to the r8a7790 SoC by adding platform devices for SCIFA0 -> SCIFA2 as well as SCIFB0 -> SCIFB2 and SCIF0 -> SCIF1 together with clock bindings. DT device description is excluded at this point since such bindings are still under development.

---

 arch/arm/mach-shmobile/clock-r8a7790.c |   34 +++++++++++++++++++
 arch/arm/mach-shmobile/setup-r8a7790.c |   55 ++++++++++++++++++++++++++++++++
 2 files changed, 88 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/clock-r8a7790.c +33 -1
@@ -27,19 +27,51 @@
 #define CPG_BASE 0xe6150000
 #define CPG_LEN 0x1000
 
+#define SMSTPCR2 0xe6150138
+#define SMSTPCR7 0xe615014c
+
 static struct clk_mapping cpg_mapping = {
 	.phys   = CPG_BASE,
 	.len    = CPG_LEN,
 };
 
+static struct clk p_clk = {
+	.rate	= 65000000, /* shortcut for now */
+	.mapping	= &cpg_mapping,
+};
+
+static struct clk mp_clk = {
+	.rate	= 52000000,  /* shortcut for now */
+	.mapping	= &cpg_mapping,
+};
+
 static struct clk *main_clks[] = {
+	&p_clk,
+	&mp_clk,
 };
 
-enum { MSTP_NR };
+enum { MSTP721, MSTP720,
+	MSTP216, MSTP207, MSTP206, MSTP204, MSTP203, MSTP202, MSTP_NR };
 static struct clk mstp_clks[MSTP_NR] = {
+	[MSTP721] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 21, 0), /* SCIF0 */
+	[MSTP720] = SH_CLK_MSTP32(&p_clk, SMSTPCR7, 20, 0), /* SCIF1 */
+	[MSTP216] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 16, 0), /* SCIFB2 */
+	[MSTP207] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 7, 0), /* SCIFB1 */
+	[MSTP206] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 6, 0), /* SCIFB0 */
+	[MSTP204] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 4, 0), /* SCIFA0 */
+	[MSTP203] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 3, 0), /* SCIFA1 */
+	[MSTP202] = SH_CLK_MSTP32(&mp_clk, SMSTPCR2, 2, 0), /* SCIFA2 */
 };
 
 static struct clk_lookup lookups[] = {
+	CLKDEV_DEV_ID("sh-sci.0", &mstp_clks[MSTP204]),
+	CLKDEV_DEV_ID("sh-sci.1", &mstp_clks[MSTP203]),
+	CLKDEV_DEV_ID("sh-sci.2", &mstp_clks[MSTP206]),
+	CLKDEV_DEV_ID("sh-sci.3", &mstp_clks[MSTP207]),
+	CLKDEV_DEV_ID("sh-sci.4", &mstp_clks[MSTP216]),
+	CLKDEV_DEV_ID("sh-sci.5", &mstp_clks[MSTP202]),
+	CLKDEV_DEV_ID("sh-sci.6", &mstp_clks[MSTP721]),
+	CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP720]),
 };
 
 void __init r8a7790_clock_init(void)
arch/arm/mach-shmobile/setup-r8a7790.c +55 -0

68 lines not on this page · raw message

author maintainer
#3 lore raw

PATCH v2 3/4 ARM: shmobile: r8a7790 IRQC support

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add IRQC interrupt controller support to r8a7790 by hooking up a single IRQC instances to handle 4 external IRQ signals. The IRQC controller is tied to SPIs of the GIC. On r8a7790 the external IRQ pins routing is handled by the PFC which is excluded from this patch.

Both platform devices and DT devices are added in this patch. The platform device versions are used to provide a static interrupt map configuration for board code written in C.

---

Depends on:
[PATCH] irqchip: Renesas IRQC driver
[PATCH] irqchip: irqc: Add DT support

 arch/arm/boot/dts/r8a7790.dtsi         |    9 +++++++++
 arch/arm/mach-shmobile/Kconfig         |    1 +
 arch/arm/mach-shmobile/setup-r8a7790.c |   21 +++++++++++++++++++++
 3 files changed, 31 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi +9 -0
@@ -51,4 +51,13 @@
 				<1 11 0xf08>,
 				<1 10 0xf08>;
 	};
+
+	irqc0: interrupt-controller at e61c0000 {
+		compatible = "renesas,irqc";
+		#interrupt-cells = <2>;
+		interrupt-controller;
+		reg = <0xe61c0000 0x200>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 0 4>, <0 1 4>, <0 2 4>,	<0 3 4>;
+	};
 };
arch/arm/mach-shmobile/Kconfig +1 -0
@@ -49,6 +49,7 @@ config ARCH_R8A7790
 	select CPU_V7
 	select ARM_ARCH_TIMER
 	select SH_CLK_CPG
+	select RENESAS_IRQC
 
 config ARCH_EMEV2
 	bool "Emma Mobile EV2"
arch/arm/mach-shmobile/setup-r8a7790.c +21 -0
@@ -23,6 +23,7 @@
 #include <linux/kernel.h>
 #include <linux/of_platform.h>
 #include <linux/serial_sci.h>
+#include <linux/platform_data/irq-renesas-irqc.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <mach/r8a7790.h>
@@ -74,6 +75,25 @@ static inline void r8a7790_register_scif
 				      sizeof(struct plat_sci_port));
 }
 
+static struct renesas_irqc_config irqc0_data = {
+	.irq_base = irq_pin(0), /* IRQ0 -> IRQ3 */
+};
+
+static struct resource irqc0_resources[] = {
+	DEFINE_RES_MEM(0xe61c0000, 0x200), /* IRQC Event Detector Block_0 */
+	DEFINE_RES_IRQ(gic_spi(0)), /* IRQ0 */
+	DEFINE_RES_IRQ(gic_spi(1)), /* IRQ1 */
+	DEFINE_RES_IRQ(gic_spi(2)), /* IRQ2 */
+	DEFINE_RES_IRQ(gic_spi(3)), /* IRQ3 */
+};
+
+#define r8a7790_register_irqc(idx)					\
+	platform_device_register_resndata(&platform_bus, "renesas_irqc", \
+					  idx, irqc##idx##_resources,	\
+					  ARRAY_SIZE(irqc##idx##_resources), \
+					  &irqc##idx##_data,		\
+					  sizeof(struct renesas_irqc_config))
+
 void __init r8a7790_add_standard_devices(void)
 {
 	r8a7790_register_scif(SCIFA0);
@@ -84,6 +104,7 @@ void __init r8a7790_add_standard_devices
 	r8a7790_register_scif(SCIFA2);
 	r8a7790_register_scif(SCIF0);
 	r8a7790_register_scif(SCIF1);
+	r8a7790_register_irqc(0);
 }
 
 #ifdef CONFIG_USE_OF
author maintainer
#4 lore raw

PATCH v2 4/4 ARM: shmobile: r8a7790 PFC support

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add a platform device for the r8a7790 PFC.

---

 arch/arm/mach-shmobile/Kconfig                |    1 +
 arch/arm/mach-shmobile/include/mach/r8a7790.h |    1 +
 arch/arm/mach-shmobile/setup-r8a7790.c        |   10 ++++++++++
 3 files changed, 12 insertions(+)
arch/arm/mach-shmobile/Kconfig +1 -0
@@ -45,6 +45,7 @@ config ARCH_R8A7779
 
 config ARCH_R8A7790
 	bool "R-Car H2 (R8A77900)"
+	select ARCH_WANT_OPTIONAL_GPIOLIB
 	select ARM_GIC
 	select CPU_V7
 	select ARM_ARCH_TIMER
arch/arm/mach-shmobile/include/mach/r8a7790.h +1 -0
@@ -3,5 +3,6 @@
 
 void r8a7790_add_standard_devices(void);
 void r8a7790_clock_init(void);
+void r8a7790_pinmux_init(void);
 
 #endif /* __ASM_R8A7790_H__ */
arch/arm/mach-shmobile/setup-r8a7790.c +10 -0
@@ -29,6 +29,16 @@
 #include <mach/r8a7790.h>
 #include <asm/mach/arch.h>
 
+static const struct resource pfc_resources[] = {
+	DEFINE_RES_MEM(0xe6060000, 0x250),
+};
+
+void __init r8a7790_pinmux_init(void)
+{
+	platform_device_register_simple("pfc-r8a7790", -1, pfc_resources,
+					ARRAY_SIZE(pfc_resources));
+}
+
 #define SCIF_COMMON(scif_type, baseaddr, irq)			\
 	.type		= scif_type,				\
 	.mapbase	= baseaddr,				\
#5 lore raw

v2 cover ARM: shmobile: r8a7790 SoC

In reply to Magnus Damm
Quoted 7 lines · Magnus Damm

ARM: shmobile: r8a7790 SoC (V2)

[PATCH 01/04] ARM: shmobile: Initial r8a7790 SoC support [PATCH 02/04] ARM: shmobile: r8a7790 SCIF support [PATCH 03/04] ARM: shmobile: r8a7790 IRQC support [PATCH 04/04] ARM: shmobile: r8a7790 PFC support

Quoted 8 lines

This series is V2 of initial support for the r8a7790 SoC. The SoC is known as r8a7790 which is built around Cortex-A15 and makes use of SCIF for serial and IRQC interrupt controller for external IRQs.

Changes in V2:
- Added PFC platform device

Future r8a7790 PFC and Lager board series will depend on this one.

Thanks, queued up for v3.10 in the soc branch.