Skip to contentSkip to conversation

arm64: r8a77965 Salvator-X IPMMU environment prototype

PATCH/RFC Magnus Damm 1 participant 1 message Dec 20, 2017

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

From: Magnus Damm <[email protected]>

Here's a simple prototype to get a basic IPMMU environment going on the R-Car M3-N SoC on the r8a77965 Salvator-X board. IPMMU-MM and DS0/DS1 are used with SYS-DMAC that in turn may be used with SCIF for testing.

As based "renesas-drivers-next-2017-11-14-v4.14" is used with [PATCH/RFC] arm64: r8a77965 Salvator-X SoC/board support prototype

This patch includes the following commits from renesas-bsp @ kernel.org and in particular the recent "rcar-3.5.9.rc2" release:

3d6d07bafc20 soc: renesas: Add r8a77965 SYSC PM Domain Binding Definitions a537d04be7e5 soc: renesas: rcar-sysc: Add support for R-Car M3N power areas (*) 03dec5bca11a clk: renesas: r8a77965: Add SCIF clocks
46caaa3cafbb arm64: dts: r8a77965: Add SCIF-{0,1,3,4,5} device nodes 6959e5326b1f arm64: dts: r8a77965-salvator-x: Enable SCIF1 support (*) c226bdd7f896 clk: renesas: r8a77965: Add SYS-DMAC clocks c62337d81daf arm64: dts: r8a77965: Add SYS-DMAC device nodes (*) 9238f852983c arm64: dts: r8a77965: Enable SCIF DMA (*) ef1003d9e384 arm64: dts: r8a77965: Add IPMMU-MM device node e96d39682989 arm64: dts: r8a77965: Add IPMMU-DS0, DS1 device nodes 49b59f34d7fd arm64: dts: r8a77965: Hook up SYS-DMAC/Audio-DMAC to IPMMU (*)

Original authors of commits above are:

Commits marked with (*) above have been updated to fit on upstream

Since this is prototype code and not suitable for mainline merge as-is:

Not-Yet-Signed-off-by Magnus Damm <[email protected]>

---

 Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt |    1 
 arch/arm64/boot/dts/renesas/r8a77965-salvator-x.dts           |    5 
 arch/arm64/boot/dts/renesas/r8a77965.dtsi                     |  225 ++++++++++
 drivers/clk/renesas/r8a77965-cpg-mssr.c                       |    8 
 drivers/soc/renesas/Kconfig                                   |    5 
 drivers/soc/renesas/Makefile                                  |    1 
 drivers/soc/renesas/r8a77965-sysc.c                           |   38 +
 drivers/soc/renesas/rcar-sysc.c                               |    3 
 drivers/soc/renesas/rcar-sysc.h                               |    1 
 include/dt-bindings/power/r8a77965-sysc.h                     |   31 +
 10 files changed, 318 insertions(+)
Documentation/devicetree/bindings/power/renesas,rcar-sysc.txt +1 -0
@@ -17,6 +17,7 @@ Required properties:
       - "renesas,r8a7794-sysc" (R-Car E2)
       - "renesas,r8a7795-sysc" (R-Car H3)
       - "renesas,r8a7796-sysc" (R-Car M3-W)
+      - "renesas,r8a77965-sysc" (R-Car M3-N)
       - "renesas,r8a77970-sysc" (R-Car V3M)
       - "renesas,r8a77995-sysc" (R-Car D3)
   - reg: Address start and address range for the device.
arch/arm64/boot/dts/renesas/r8a77965-salvator-x.dts +5 -0
@@ -17,6 +17,7 @@
 
 	aliases {
 		serial0 = &scif2;
+		serial1 = &scif1;
 	};
 
 	chosen {
@@ -69,6 +70,10 @@
 	clock-frequency = <16666666>;
 };
 
+&scif1 {
+	status = "okay";
+};
+
 &scif2 {
 	status = "okay";
 };
arch/arm64/boot/dts/renesas/r8a77965.dtsi +225 -0

249 lines not on this page · raw message

drivers/clk/renesas/r8a77965-cpg-mssr.c +8 -0
@@ -96,6 +96,14 @@ static const struct cpg_core_clk r8a7796
 };
 
 static const struct mssr_mod_clk r8a77965_mod_clks[] __initconst = {
+	DEF_MOD("scif5",		 202,	R8A77965_CLK_S3D4),
+	DEF_MOD("scif4",		 203,	R8A77965_CLK_S3D4),
+	DEF_MOD("scif3",		 204,	R8A77965_CLK_S3D4),
+	DEF_MOD("scif1",		 206,	R8A77965_CLK_S3D4),
+	DEF_MOD("scif0",		 207,	R8A77965_CLK_S3D4),
+	DEF_MOD("sys-dmac2",		 217,	R8A77965_CLK_S0D3),
+	DEF_MOD("sys-dmac1",		 218,	R8A77965_CLK_S0D3),
+	DEF_MOD("sys-dmac0",		 219,	R8A77965_CLK_S0D3),
 	DEF_MOD("scif2",		 310,	R8A77965_CLK_S3D4),
 	DEF_MOD("intc-ap",		 408,	R8A77965_CLK_S3D1),
 };
drivers/soc/renesas/Kconfig +5 -0
@@ -14,6 +14,7 @@ config SOC_RENESAS
 	select SYSC_R8A7794 if ARCH_R8A7794
 	select SYSC_R8A7795 if ARCH_R8A7795
 	select SYSC_R8A7796 if ARCH_R8A7796
+	select SYSC_R8A77965 if ARCH_R8A77965
 	select SYSC_R8A77970 if ARCH_R8A77970
 	select SYSC_R8A77995 if ARCH_R8A77995
 
@@ -56,6 +57,10 @@ config SYSC_R8A7796
 	bool "R-Car M3-W System Controller support" if COMPILE_TEST
 	select SYSC_RCAR
 
+config SYSC_R8A77965
+	bool "R-Car M3-N System Controller support" if COMPILE_TEST
+	select SYSC_RCAR
+
 config SYSC_R8A77970
 	bool "R-Car V3M System Controller support" if COMPILE_TEST
 	select SYSC_RCAR
drivers/soc/renesas/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_SYSC_R8A7792)	+= r8a7792-sy
 obj-$(CONFIG_SYSC_R8A7794)	+= r8a7794-sysc.o
 obj-$(CONFIG_SYSC_R8A7795)	+= r8a7795-sysc.o
 obj-$(CONFIG_SYSC_R8A7796)	+= r8a7796-sysc.o
+obj-$(CONFIG_SYSC_R8A77965)	+= r8a77965-sysc.o
 obj-$(CONFIG_SYSC_R8A77970)	+= r8a77970-sysc.o
 obj-$(CONFIG_SYSC_R8A77995)	+= r8a77995-sysc.o
 
drivers/soc/renesas/r8a77965-sysc.c new file +38 -0
@@ -0,0 +1,38 @@
+/*
+ * Renesas R-Car M3N System Controller
+ *
+ * Copyright (C) 2017 Renesas Electronics Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+
+#include <linux/bug.h>
+#include <linux/kernel.h>
+
+#include <dt-bindings/power/r8a77965-sysc.h>
+
+#include "rcar-sysc.h"
+
+static const struct rcar_sysc_area r8a77965_areas[] __initconst = {
+	{ "always-on",	    0, 0, R8A77965_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
+	{ "ca57-scu",	0x1c0, 0, R8A77965_PD_CA57_SCU,  R8A77965_PD_ALWAYS_ON,
+	  PD_SCU },
+	{ "ca57-cpu0",	 0x80, 0, R8A77965_PD_CA57_CPU0, R8A77965_PD_CA57_SCU,
+	  PD_CPU_NOCR },
+	{ "ca57-cpu1",	 0x80, 1, R8A77965_PD_CA57_CPU1, R8A77965_PD_CA57_SCU,
+	  PD_CPU_NOCR },
+	{ "cr7",	0x240, 0, R8A77965_PD_CR7,	R8A77965_PD_ALWAYS_ON },
+	{ "a3vp",	0x340, 0, R8A77965_PD_A3VP,	R8A77965_PD_ALWAYS_ON },
+	{ "a3vc",	0x380, 0, R8A77965_PD_A3VC,	R8A77965_PD_ALWAYS_ON },
+	{ "a2vc1",	0x3c0, 1, R8A77965_PD_A2VC1,	R8A77965_PD_A3VC },
+	{ "3dg-a",	0x100, 0, R8A77965_PD_3DG_A,	R8A77965_PD_ALWAYS_ON },
+	{ "3dg-b",	0x100, 1, R8A77965_PD_3DG_B,	R8A77965_PD_3DG_A },
+	{ "a3ir",	0x180, 0, R8A77965_PD_A3IR,	R8A77965_PD_ALWAYS_ON },
+};
+
+const struct rcar_sysc_info r8a77965_sysc_info __initconst = {
+	.areas = r8a77965_areas,
+	.num_areas = ARRAY_SIZE(r8a77965_areas),
+};
drivers/soc/renesas/rcar-sysc.c +3 -0
@@ -290,6 +290,9 @@ static const struct of_device_id rcar_sy
 #ifdef CONFIG_SYSC_R8A77995
 	{ .compatible = "renesas,r8a77995-sysc", .data = &r8a77995_sysc_info },
 #endif
+#ifdef CONFIG_ARCH_R8A77965
+	{ .compatible = "renesas,r8a77965-sysc", .data = &r8a77965_sysc_info },
+#endif
 	{ /* sentinel */ }
 };
 
drivers/soc/renesas/rcar-sysc.h +1 -0
@@ -58,6 +58,7 @@ extern const struct rcar_sysc_info r8a77
 extern const struct rcar_sysc_info r8a7794_sysc_info;
 extern const struct rcar_sysc_info r8a7795_sysc_info;
 extern const struct rcar_sysc_info r8a7796_sysc_info;
+extern const struct rcar_sysc_info r8a77965_sysc_info;
 extern const struct rcar_sysc_info r8a77970_sysc_info;
 extern const struct rcar_sysc_info r8a77995_sysc_info;
 
include/dt-bindings/power/r8a77965-sysc.h new file +31 -0
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2017 Renesas Electronics Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ */
+#ifndef __DT_BINDINGS_POWER_R8A77965_SYSC_H__
+#define __DT_BINDINGS_POWER_R8A77965_SYSC_H__
+
+/*
+ * These power domain indices match the numbers of the interrupt bits
+ * representing the power areas in the various Interrupt Registers
+ * (e.g. SYSCISR, Interrupt Status Register)
+ */
+
+#define R8A77965_PD_CA57_CPU0		 0
+#define R8A77965_PD_CA57_CPU1		 1
+#define R8A77965_PD_A3VP		 9
+#define R8A77965_PD_CA57_SCU		12
+#define R8A77965_PD_CR7			13
+#define R8A77965_PD_A3VC		14
+#define R8A77965_PD_3DG_A		17
+#define R8A77965_PD_3DG_B		18
+#define R8A77965_PD_A3IR		24
+#define R8A77965_PD_A2VC1		26
+
+/* Always-on power area */
+#define R8A77965_PD_ALWAYS_ON		32
+
+#endif /* __DT_BINDINGS_POWER_R8A77965_SYSC_H__ */