linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board
@ 2018-04-10  8:30 Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 1/8] arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig Michel Pollet
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

This series adds the plain basic support for booting a bare
kernel on the RZ/N1D-DB Board. It's been trimmed to the strict
minimum as a 'base', further patches that will add the
rest of the support, pinctrl, clock architecture and quite
a few others.

Thanks for the comments on the previous versions!

v4:
 + Fixes for suggestions by Simon Horman
 + Fixes for suggestions by Jacopo Mondi
 + Fixes for suggestions by Geert Uytterhoeven
 + Renamed the r9a06g0xx.dtsi file, given up on trying to get a family
   common file in, so dropped potential RZ/N1S support and now only
   focus on RZ/N1D for this patchset.
 + Added 'always-on' to the architected timer node, because it is.
 + Added ARCH_R9A06G032, to match others patterns like RCAR
 + Sorted the .dts files, added empty lines as required.
 + Fixed patch prefixes to match git-log for bindings&dts
 + Merged board .dts & Makefile changes together
 + Rebased on next-20180410
v3:
 + Fixes for suggestions by Geert Uytterhoeven
 + Removed SoC Specific renesas,r9a06g032-xxx, as it's not needed for now.
 + Kept renesas,rzn1 as a family/generic for this family.
 + Fixed a couple of the commit messages.
 + Added Geert's Reviewed-By where appropriate.
v2:
 + Fixes for suggestions by Simon Horman
 + Fixes for suggestions by Rob Herring
 + Fixes for suggestions by Geert Uytterhoeven
 + Removed the mach file
 + Added a MFD base for the sysctrl block
 + Added a regmap based sub driver for the reboot handler
 + Renamed the files to match shmobile conventions
 + Adapted the compatible= strings to reflect 'family' vs 'part'
   distinction.
 + Removed the sysctrl.h file entirelly.
 + Fixed every warnings from the DTC compiler on W=12 mode.
 + Split the device-tree patches from the code.

Michel Pollet (8):
  arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig
  arm: shmobile: Add the RZ/N1D (R9A06G032) to the shmobile Kconfig
  dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node
  dt-bindings: reset: renesas,rzn1-reboot: document RZ/N1 reboot driver
  dt-bindings: arm: Document the RZN1D-DB board
  ARM: dts: Renesas RZ/N1 SoC base device tree file
  ARM: dts: Renesas RZN1D-DB Board base file
  reset: Renesas RZ/N1 reboot driver

 Documentation/devicetree/bindings/arm/shmobile.txt |   5 +-
 .../bindings/mfd/renesas,rzn1-sysctrl.txt          |  23 +++++
 .../bindings/power/renesas,rzn1-reboot.txt         |  23 +++++
 arch/arm/boot/dts/Makefile                         |   1 +
 arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts        |  29 ++++++
 arch/arm/boot/dts/r9a06g032.dtsi                   |  94 ++++++++++++++++++
 arch/arm/mach-shmobile/Kconfig                     |   9 ++
 drivers/power/reset/Kconfig                        |   7 ++
 drivers/power/reset/Makefile                       |   1 +
 drivers/power/reset/rzn1-reboot.c                  | 105 +++++++++++++++++++++
 10 files changed, 296 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
 create mode 100644 Documentation/devicetree/bindings/power/renesas,rzn1-reboot.txt
 create mode 100644 arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
 create mode 100644 arch/arm/boot/dts/r9a06g032.dtsi
 create mode 100644 drivers/power/reset/rzn1-reboot.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v4 1/8] arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  2018-04-12  8:00   ` Simon Horman
  2018-04-10  8:30 ` [PATCH v4 2/8] arm: shmobile: Add the RZ/N1D (R9A06G032) " Michel Pollet
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

Add the RZ/N1 Family (Part #R9A06G0xx) ARCH config to the rest of
the Renesas SoC collection.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 arch/arm/mach-shmobile/Kconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 280e731..221fbcb 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -110,6 +110,11 @@ config ARCH_R8A7794
 	bool "R-Car E2 (R8A77940)"
 	select ARCH_RCAR_GEN2
 
+config ARCH_RZN1
+	bool "RZ/N1 (R9A06G0xx) Family"
+	select ARM_AMBA
+	select CPU_V7
+
 config ARCH_SH73A0
 	bool "SH-Mobile AG5 (R8A73A00)"
 	select ARCH_RMOBILE
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v4 2/8] arm: shmobile: Add the RZ/N1D (R9A06G032) to the shmobile Kconfig
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 1/8] arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node Michel Pollet
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

Add the RZ/N1D SoC to the reset of the Renesas SoC Collection.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 arch/arm/mach-shmobile/Kconfig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 221fbcb..a80c0ed 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -110,6 +110,10 @@ config ARCH_R8A7794
 	bool "R-Car E2 (R8A77940)"
 	select ARCH_RCAR_GEN2
 
+config ARCH_R9A06G032
+	bool "RZ/N1D (R9A06G032)"
+	select ARCH_RZN1
+
 config ARCH_RZN1
 	bool "RZ/N1 (R9A06G0xx) Family"
 	select ARM_AMBA
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 1/8] arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 2/8] arm: shmobile: Add the RZ/N1D (R9A06G032) " Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  2018-04-13 18:05   ` Rob Herring
  2018-04-10  8:30 ` [PATCH v4 4/8] dt-bindings: reset: renesas,rzn1-reboot: document RZ/N1 reboot driver Michel Pollet
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

The Renesas RZ/N1 Family (Part #R9A06G0xx) has a multi-function
system controller. This documents the node used to encapsulate
it's sub drivers.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 .../bindings/mfd/renesas,rzn1-sysctrl.txt          | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt

diff --git a/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
new file mode 100644
index 0000000..9897f8f
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
@@ -0,0 +1,23 @@
+DT bindings for the Renesas RZ/N1 System Controller
+
+== System Controller Node ==
+
+The system controller node currently only hosts a single sub-node to handle
+the rebooting of the CPU. Eventually it will host the clock driver, SMP
+start handler, watchdog etc.
+
+See renesas,rzn1-reboot.txt for further details.
+
+Bindings:
++ Required:
+	compatible = "renesas,r9a06g032-sysctrl",
+			"renesas,rzn1-sysctrl",
+			"syscon", "simple-mfd";
+
+Example:
+	sysctrl: sysctrl@4000c000 {
+		compatible = "renesas,r9a06g032-sysctrl",
+				"renesas,rzn1-sysctrl",
+				"syscon", "simple-mfd";
+		reg = <0x4000c000 0x1000>;
+	};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v4 4/8] dt-bindings: reset: renesas,rzn1-reboot: document RZ/N1 reboot driver
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
                   ` (2 preceding siblings ...)
  2018-04-10  8:30 ` [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 5/8] dt-bindings: arm: Document the RZN1D-DB board Michel Pollet
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

The Renesas RZ/N1 Family (Part #R9A06G0xx) requires a driver
as part of the sysctrl MFD to handle rebooting the CA7 cores.
This documents the driver bindings.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 .../bindings/power/renesas,rzn1-reboot.txt         | 23 ++++++++++++++++++++++
 1 file changed, 23 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,rzn1-reboot.txt

diff --git a/Documentation/devicetree/bindings/power/renesas,rzn1-reboot.txt b/Documentation/devicetree/bindings/power/renesas,rzn1-reboot.txt
new file mode 100644
index 0000000..8516ab0
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/renesas,rzn1-reboot.txt
@@ -0,0 +1,23 @@
+DT bindings for the Renesas RZ/N1 Reboot Driver
+
+== Reboot Driver Node ==
+
+The reboot driver is always a subnode of the system controller node, see
+renesas,rzn1-sysctrl.txt for details.
+
+Bindings:
++ Required:
+	compatible = "renesas,r9a06g032-reboot", "renesas,rzn1-reboot";
+
+Example:
+	sysctrl: sysctrl@4000c000 {
+		compatible = "renesas,r9a06g032-sysctrl",
+				"renesas,rzn1-sysctrl",
+				"syscon", "simple-mfd";
+		reg = <0x4000c000 0x1000>;
+
+		reboot {
+			compatible = "renesas,r9a06g032-reboot",
+					"renesas,rzn1-reboot";
+		};
+	};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v4 5/8] dt-bindings: arm: Document the RZN1D-DB board
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
                   ` (3 preceding siblings ...)
  2018-04-10  8:30 ` [PATCH v4 4/8] dt-bindings: reset: renesas,rzn1-reboot: document RZ/N1 reboot driver Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  2018-04-13 18:32   ` Rob Herring
  2018-04-10  8:30 ` [PATCH v4 6/8] ARM: dts: Renesas RZ/N1 SoC base device tree file Michel Pollet
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

This documents the RZ/N1 bindings for the RZN1D-DB board.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 Documentation/devicetree/bindings/arm/shmobile.txt | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/shmobile.txt b/Documentation/devicetree/bindings/arm/shmobile.txt
index d3d1df9..024caf7 100644
--- a/Documentation/devicetree/bindings/arm/shmobile.txt
+++ b/Documentation/devicetree/bindings/arm/shmobile.txt
@@ -47,7 +47,8 @@ SoCs:
     compatible = "renesas,r8a77980"
   - R-Car D3 (R8A77995)
     compatible = "renesas,r8a77995"
-
+  - RZ/N1D (R9A06G032)
+    compatible = "renesas,r9a06g032", "renesas,rzn1"
 
 Boards:
 
@@ -104,6 +105,8 @@ Boards:
     compatible = "renesas,porter", "renesas,r8a7791"
   - RSKRZA1 (YR0K77210C000BE)
     compatible = "renesas,rskrza1", "renesas,r7s72100"
+  - RZN1D-DB (RZ/N1D Demo Board for the RZ/N1D 400 pins package)
+    compatible = "renesas,rzn1d400-db", "renesas,r9a06g032", "renesas,rzn1"
   - Salvator-X (RTP0RC7795SIPB0010S)
     compatible = "renesas,salvator-x", "renesas,r8a7795"
   - Salvator-X (RTP0RC7796SIPB0011S)
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v4 6/8] ARM: dts: Renesas RZ/N1 SoC base device tree file
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
                   ` (4 preceding siblings ...)
  2018-04-10  8:30 ` [PATCH v4 5/8] dt-bindings: arm: Document the RZN1D-DB board Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 7/8] ARM: dts: Renesas RZN1D-DB Board base file Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 8/8] reset: Renesas RZ/N1 reboot driver Michel Pollet
  7 siblings, 0 replies; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

This adds the Renesas RZ/N1D (Part #R9A06G032) SoC bare
bone support.

This currently only handles generic parts (gic, architected timer)
and a UART.
For simplicity sake, this also relies on the bootloader to set the
pinctrl and clocks.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 arch/arm/boot/dts/r9a06g032.dtsi | 94 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
 create mode 100644 arch/arm/boot/dts/r9a06g032.dtsi

diff --git a/arch/arm/boot/dts/r9a06g032.dtsi b/arch/arm/boot/dts/r9a06g032.dtsi
new file mode 100644
index 0000000..7d84b38
--- /dev/null
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Base Device Tree Source for the Renesas RZ/N1D (R9A06G032)
+ *
+ * Copyright (C) 2018 Renesas Electronics Europe Limited
+ *
+ */
+
+#include <dt-bindings/interrupt-controller/arm-gic.h>
+
+/ {
+	compatible = "renesas,r9a06g032", "renesas,rzn1";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	clkuarts: clkuarts {
+		#clock-cells = <0>;
+		compatible = "fixed-clock";
+		clock-frequency = <47619047>;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu@0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <0>;
+		};
+
+		cpu@1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a7";
+			reg = <1>;
+		};
+	};
+
+	soc {
+		compatible = "simple-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		interrupt-parent = <&gic>;
+		ranges;
+
+		sysctrl: sysctrl@4000c000 {
+			compatible = "renesas,r9a06g032-sysctrl",
+					"renesas,rzn1-sysctrl",
+					"syscon", "simple-mfd";
+			reg = <0x4000c000 0x1000>;
+
+			reboot {
+				compatible = "renesas,r9a06g032-reboot",
+						"renesas,rzn1-reboot";
+			};
+		};
+
+		uart0: serial@40060000 {
+			compatible = "snps,dw-apb-uart";
+			reg = <0x40060000 0x400>;
+			interrupts = <GIC_SPI 6 IRQ_TYPE_LEVEL_HIGH>;
+			reg-shift = <2>;
+			reg-io-width = <4>;
+			clocks = <&clkuarts>;
+			clock-names = "baudclk";
+			status = "disabled";
+		};
+
+		gic: gic@44101000 {
+			compatible = "arm,cortex-a7-gic", "arm,gic-400";
+			interrupt-controller;
+			#interrupt-cells = <3>;
+			reg = <0x44101000 0x1000>, /* Distributer */
+			      <0x44102000 0x2000>, /* CPU interface */
+			      <0x44104000 0x2000>, /* Virt interface control */
+			      <0x44106000 0x2000>; /* Virt CPU interface */
+			interrupts =
+				<GIC_PPI 9 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_HIGH)>;
+		};
+	};
+
+	timer {
+		compatible = "arm,cortex-a7-timer",
+			     "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		arm,cpu-registers-not-fw-configured;
+		always-on;
+		interrupts =
+			<GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
+			<GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
+			<GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>,
+			<GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>;
+	};
+};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v4 7/8] ARM: dts: Renesas RZN1D-DB Board base file
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
                   ` (5 preceding siblings ...)
  2018-04-10  8:30 ` [PATCH v4 6/8] ARM: dts: Renesas RZ/N1 SoC base device tree file Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  2018-04-10  8:30 ` [PATCH v4 8/8] reset: Renesas RZ/N1 reboot driver Michel Pollet
  7 siblings, 0 replies; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

This adds a base device tree file for the RZN1-DB board, with only the
basic support allowing the system to boot to a prompt. Only one UART is
used, with only a single CPU running.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 arch/arm/boot/dts/Makefile                  |  1 +
 arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts | 29 +++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)
 create mode 100644 arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 7e24249..53c9bf4 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -806,6 +806,7 @@ dtb-$(CONFIG_ARCH_RENESAS) += \
 	r8a7793-gose.dtb \
 	r8a7794-alt.dtb \
 	r8a7794-silk.dtb \
+	r9a06g032-rzn1d400-db.dtb \
 	sh73a0-kzm9g.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += \
 	rv1108-evb.dtb \
diff --git a/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts b/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
new file mode 100644
index 0000000..5fc2c40
--- /dev/null
+++ b/arch/arm/boot/dts/r9a06g032-rzn1d400-db.dts
@@ -0,0 +1,29 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Device Tree Source for the RZN1D-DB Board
+ *
+ * Copyright (C) 2018 Renesas Electronics Europe Limited
+ *
+ */
+
+/dts-v1/;
+
+#include "r9a06g032.dtsi"
+
+/ {
+	model = "RZN1D-DB Board";
+	compatible = "renesas,rzn1d400-db",
+			"renesas,r9a06g032", "renesas,rzn1";
+
+	chosen {
+		stdout-path = "serial0:115200n8";
+	};
+
+	aliases {
+		serial0 = &uart0;
+	};
+};
+
+&uart0 {
+	status = "okay";
+};
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH v4 8/8] reset: Renesas RZ/N1 reboot driver
  2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
                   ` (6 preceding siblings ...)
  2018-04-10  8:30 ` [PATCH v4 7/8] ARM: dts: Renesas RZN1D-DB Board base file Michel Pollet
@ 2018-04-10  8:30 ` Michel Pollet
  7 siblings, 0 replies; 14+ messages in thread
From: Michel Pollet @ 2018-04-10  8:30 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, buserror+upstream, Michel Pollet, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

The Renesas RZ/N1 Family (Part #R9A06G0xx) needs a small driver
to reboot the Cortex-A7 cores. This driver is a sub driver of
the sysctrl MFD.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 drivers/power/reset/Kconfig       |   7 +++
 drivers/power/reset/Makefile      |   1 +
 drivers/power/reset/rzn1-reboot.c | 105 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 113 insertions(+)
 create mode 100644 drivers/power/reset/rzn1-reboot.c

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index df58fc8..1416d88 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -144,6 +144,13 @@ config POWER_RESET_RESTART
 	  Instead they restart, and u-boot holds the SoC until the
 	  user presses a key. u-boot then boots into Linux.
 
+config POWER_RESET_RZN1
+	bool "Renesas RZ/N1 reboot driver"
+	depends on ARCH_RZN1
+	help
+	  This driver allows rebooting the CA7 cores of the
+	  Renesas RZ/N1 Family of SoC (Part # R9A06G0xx).
+
 config POWER_RESET_ST
 	bool "ST restart driver"
 	depends on ARCH_STI
diff --git a/drivers/power/reset/Makefile b/drivers/power/reset/Makefile
index 7778c74..bad9702 100644
--- a/drivers/power/reset/Makefile
+++ b/drivers/power/reset/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_POWER_RESET_PIIX4_POWEROFF) += piix4-poweroff.o
 obj-$(CONFIG_POWER_RESET_LTC2952) += ltc2952-poweroff.o
 obj-$(CONFIG_POWER_RESET_QNAP) += qnap-poweroff.o
 obj-$(CONFIG_POWER_RESET_RESTART) += restart-poweroff.o
+obj-$(CONFIG_POWER_RESET_RZN1) += rzn1-reboot.o
 obj-$(CONFIG_POWER_RESET_ST) += st-poweroff.o
 obj-$(CONFIG_POWER_RESET_VERSATILE) += arm-versatile-reboot.o
 obj-$(CONFIG_POWER_RESET_VEXPRESS) += vexpress-poweroff.o
diff --git a/drivers/power/reset/rzn1-reboot.c b/drivers/power/reset/rzn1-reboot.c
new file mode 100644
index 0000000..29b568c
--- /dev/null
+++ b/drivers/power/reset/rzn1-reboot.c
@@ -0,0 +1,105 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * RZ/N1 reboot driver
+ *
+ * Copyright (C) 2018 Renesas Electronics Europe Limited
+ *
+ * Michel Pollet <michel.pollet@bp.renesas.com>, <buserror@gmail.com>
+ * Derived from zx-reboot.c
+ */
+
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/mfd/syscon.h>
+#include <linux/module.h>
+#include <linux/notifier.h>
+#include <linux/platform_device.h>
+#include <linux/reboot.h>
+#include <linux/regmap.h>
+
+/* Definitions from the SDK rzn1-sysctrl.h autogenerated file */
+#define RZN1_SYSCTRL_REG_RSTEN			0x120
+#define RZN1_SYSCTRL_REG_RSTEN_MRESET_EN		0
+#define RZN1_SYSCTRL_REG_RSTEN_WDA7RST_EN		1
+#define RZN1_SYSCTRL_REG_RSTEN_WDA7RST_EN_MASK		0x6
+#define RZN1_SYSCTRL_REG_RSTEN_WDM3RST_EN		3
+#define RZN1_SYSCTRL_REG_RSTEN_CM3LOCKUPRST_EN		4
+#define RZN1_SYSCTRL_REG_RSTEN_CM3SYSRESET_EN		5
+#define RZN1_SYSCTRL_REG_RSTEN_SWRST_EN			6
+#define RZN1_SYSCTRL_REG_RSTCTRL		0x198
+#define RZN1_SYSCTRL_REG_RSTCTRL_WDA7RST_REQ		1
+#define RZN1_SYSCTRL_REG_RSTCTRL_WDA7RST_REQ_MASK	0x6
+#define RZN1_SYSCTRL_REG_RSTCTRL_WDM3RST_REQ		3
+#define RZN1_SYSCTRL_REG_RSTCTRL_CM3LOCKUPRST_REQ	4
+#define RZN1_SYSCTRL_REG_RSTCTRL_CM3SYSRESET_REQ	5
+#define RZN1_SYSCTRL_REG_RSTCTRL_SWRST_REQ		6
+
+static struct regmap *sysctrl;
+
+static int rzn1_reboot_handler(struct notifier_block *this,
+			      unsigned long mode, void *cmd)
+{
+	regmap_write_bits(sysctrl,
+			RZN1_SYSCTRL_REG_RSTEN,
+			BIT(RZN1_SYSCTRL_REG_RSTEN_SWRST_EN) |
+				BIT(RZN1_SYSCTRL_REG_RSTEN_MRESET_EN),
+			BIT(RZN1_SYSCTRL_REG_RSTEN_SWRST_EN) |
+				BIT(RZN1_SYSCTRL_REG_RSTEN_MRESET_EN));
+	regmap_write_bits(sysctrl,
+			RZN1_SYSCTRL_REG_RSTCTRL,
+			BIT(RZN1_SYSCTRL_REG_RSTCTRL_SWRST_REQ),
+			BIT(RZN1_SYSCTRL_REG_RSTCTRL_SWRST_REQ));
+
+	mdelay(50);
+	pr_emerg("Unable to restart system\n");
+
+	return NOTIFY_DONE;
+}
+
+static struct notifier_block rzn1_reboot_nb = {
+	.notifier_call = rzn1_reboot_handler,
+	.priority = 128,
+};
+
+static int rzn1_reboot_probe(struct platform_device *pdev)
+{
+	int err;
+	struct device *parent;
+
+	parent = pdev->dev.parent;
+	if (!parent || !parent->of_node) {
+		dev_err(&pdev->dev, "couldn't find sysctrl node\n");
+		return -ENODEV;
+	}
+	sysctrl = syscon_node_to_regmap(parent->of_node);
+	if (IS_ERR(sysctrl)) {
+		dev_err(&pdev->dev, "couldn't find find regmap\n");
+		return PTR_ERR(sysctrl);
+	}
+	err = register_restart_handler(&rzn1_reboot_nb);
+	if (err) {
+		dev_err(&pdev->dev, "register restart handler failed(err=%d)\n",
+			err);
+	}
+
+	return err;
+}
+
+static const struct of_device_id rzn1_reboot_of_match[] = {
+	{ .compatible = "renesas,rzn1-reboot" },
+	{}
+};
+MODULE_DEVICE_TABLE(of, rzn1_reboot_of_match);
+
+static struct platform_driver rzn1_reboot_driver = {
+	.probe = rzn1_reboot_probe,
+	.driver = {
+		.name = "rzn1-reboot",
+		.of_match_table = rzn1_reboot_of_match,
+	},
+};
+module_platform_driver(rzn1_reboot_driver);
+
+MODULE_DESCRIPTION("RZ/N1 reboot driver");
+MODULE_AUTHOR("Michel Pollet <michel.pollet@bp.renesas.com>, <buserror@gmail.com>");
+MODULE_LICENSE("GPL v2");
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v4 1/8] arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig
  2018-04-10  8:30 ` [PATCH v4 1/8] arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig Michel Pollet
@ 2018-04-12  8:00   ` Simon Horman
  0 siblings, 0 replies; 14+ messages in thread
From: Simon Horman @ 2018-04-12  8:00 UTC (permalink / raw)
  To: Michel Pollet
  Cc: linux-renesas-soc, phil.edworthy, buserror+upstream, Magnus Damm,
	Rob Herring, Mark Rutland, Lee Jones, Russell King,
	Sebastian Reichel, devicetree, linux-kernel, linux-arm-kernel,
	linux-pm

On Tue, Apr 10, 2018 at 09:30:01AM +0100, Michel Pollet wrote:
> Add the RZ/N1 Family (Part #R9A06G0xx) ARCH config to the rest of
> the Renesas SoC collection.
> 
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

This change has already been accepted for v4.18.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node
  2018-04-10  8:30 ` [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node Michel Pollet
@ 2018-04-13 18:05   ` Rob Herring
  2018-04-17  7:56     ` Michel Pollet
  0 siblings, 1 reply; 14+ messages in thread
From: Rob Herring @ 2018-04-13 18:05 UTC (permalink / raw)
  To: Michel Pollet
  Cc: linux-renesas-soc, Simon Horman, phil.edworthy,
	buserror+upstream, Magnus Damm, Mark Rutland, Lee Jones,
	Russell King, Sebastian Reichel, devicetree, linux-kernel,
	linux-arm-kernel, linux-pm

On Tue, Apr 10, 2018 at 09:30:03AM +0100, Michel Pollet wrote:
> The Renesas RZ/N1 Family (Part #R9A06G0xx) has a multi-function
> system controller. This documents the node used to encapsulate
> it's sub drivers.
> 
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> ---
>  .../bindings/mfd/renesas,rzn1-sysctrl.txt          | 23 ++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
> 
> diff --git a/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
> new file mode 100644
> index 0000000..9897f8f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
> @@ -0,0 +1,23 @@
> +DT bindings for the Renesas RZ/N1 System Controller
> +
> +== System Controller Node ==
> +
> +The system controller node currently only hosts a single sub-node to handle
> +the rebooting of the CPU. Eventually it will host the clock driver, SMP
> +start handler, watchdog etc.

Please submit a complete binding for the h/w block.

Again, if the only reason you have sub nodes is to define compatible 
strings and in turn enumerate drivers, then you don't need the nodes in 
DT. DT is not the only way to instantiate drivers.

Rob

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v4 5/8] dt-bindings: arm: Document the RZN1D-DB board
  2018-04-10  8:30 ` [PATCH v4 5/8] dt-bindings: arm: Document the RZN1D-DB board Michel Pollet
@ 2018-04-13 18:32   ` Rob Herring
  0 siblings, 0 replies; 14+ messages in thread
From: Rob Herring @ 2018-04-13 18:32 UTC (permalink / raw)
  To: Michel Pollet
  Cc: linux-renesas-soc, Simon Horman, phil.edworthy,
	buserror+upstream, Magnus Damm, Mark Rutland, Lee Jones,
	Russell King, Sebastian Reichel, devicetree, linux-kernel,
	linux-arm-kernel, linux-pm

On Tue, Apr 10, 2018 at 09:30:05AM +0100, Michel Pollet wrote:
> This documents the RZ/N1 bindings for the RZN1D-DB board.
> 
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> ---
>  Documentation/devicetree/bindings/arm/shmobile.txt | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Reviewed-by: Rob Herring <robh@kernel.org>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node
  2018-04-13 18:05   ` Rob Herring
@ 2018-04-17  7:56     ` Michel Pollet
  2018-04-17  8:31       ` Geert Uytterhoeven
  0 siblings, 1 reply; 14+ messages in thread
From: Michel Pollet @ 2018-04-17  7:56 UTC (permalink / raw)
  To: Rob Herring, Geert Uytterhoeven
  Cc: linux-renesas-soc, Simon Horman, Phil Edworthy,
	buserror+upstream, Magnus Damm, Mark Rutland, Lee Jones,
	Russell King, Sebastian Reichel, devicetree, linux-kernel,
	linux-arm-kernel, linux-pm

Hi Rob,

On 13 April 2018 19:06, Rob Herring:
> On Tue, Apr 10, 2018 at 09:30:03AM +0100, Michel Pollet wrote:
> > The Renesas RZ/N1 Family (Part #R9A06G0xx) has a multi-function system
> > controller. This documents the node used to encapsulate it's sub
> > drivers.
> >
> > Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> > ---
> >  .../bindings/mfd/renesas,rzn1-sysctrl.txt          | 23
> ++++++++++++++++++++++
> >  1 file changed, 23 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
> >
> > diff --git
> > a/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
> > b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
> > new file mode 100644
> > index 0000000..9897f8f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
> > @@ -0,0 +1,23 @@
> > +DT bindings for the Renesas RZ/N1 System Controller
> > +
> > +== System Controller Node ==
> > +
> > +The system controller node currently only hosts a single sub-node to
> > +handle the rebooting of the CPU. Eventually it will host the clock
> > +driver, SMP start handler, watchdog etc.
>
> Please submit a complete binding for the h/w block.
>
> Again, if the only reason you have sub nodes is to define compatible strings
> and in turn enumerate drivers, then you don't need the nodes in DT. DT is
> not the only way to instantiate drivers.

I can't document it before I have the code. There is 0.000% chance of my clock
driver for example to be upstreamed the way I would imagine making it -- in
fact pretty much any other driver will have to be reworked to fit, so documenting
bindings first is impossible.

So, if I understand correctly, you are telling me to make a 'sysctrl' driver and use
platform_device to instantiate my sub-drivers? Isn't that what machine files used
to do? And they are now banned?

Geert, any guidance here?

>
> Rob

Thanks!
Michel




Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node
  2018-04-17  7:56     ` Michel Pollet
@ 2018-04-17  8:31       ` Geert Uytterhoeven
  0 siblings, 0 replies; 14+ messages in thread
From: Geert Uytterhoeven @ 2018-04-17  8:31 UTC (permalink / raw)
  To: Michel Pollet
  Cc: Rob Herring, linux-renesas-soc, Simon Horman, Phil Edworthy,
	buserror+upstream, Magnus Damm, Mark Rutland, Lee Jones,
	Russell King, Sebastian Reichel, devicetree, linux-kernel,
	linux-arm-kernel, linux-pm

Hi Michel,

On Tue, Apr 17, 2018 at 9:56 AM, Michel Pollet
<michel.pollet@bp.renesas.com> wrote:
> On 13 April 2018 19:06, Rob Herring:
>> On Tue, Apr 10, 2018 at 09:30:03AM +0100, Michel Pollet wrote:
>> > The Renesas RZ/N1 Family (Part #R9A06G0xx) has a multi-function system
>> > controller. This documents the node used to encapsulate it's sub
>> > drivers.
>> >
>> > Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
>> > ---
>> >  .../bindings/mfd/renesas,rzn1-sysctrl.txt          | 23
>> ++++++++++++++++++++++
>> >  1 file changed, 23 insertions(+)
>> >  create mode 100644
>> > Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
>> >
>> > diff --git
>> > a/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
>> > b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
>> > new file mode 100644
>> > index 0000000..9897f8f
>> > --- /dev/null
>> > +++ b/Documentation/devicetree/bindings/mfd/renesas,rzn1-sysctrl.txt
>> > @@ -0,0 +1,23 @@
>> > +DT bindings for the Renesas RZ/N1 System Controller
>> > +
>> > +== System Controller Node ==
>> > +
>> > +The system controller node currently only hosts a single sub-node to
>> > +handle the rebooting of the CPU. Eventually it will host the clock
>> > +driver, SMP start handler, watchdog etc.
>>
>> Please submit a complete binding for the h/w block.
>>
>> Again, if the only reason you have sub nodes is to define compatible strings
>> and in turn enumerate drivers, then you don't need the nodes in DT. DT is
>> not the only way to instantiate drivers.
>
> I can't document it before I have the code. There is 0.000% chance of my clock
> driver for example to be upstreamed the way I would imagine making it -- in
> fact pretty much any other driver will have to be reworked to fit, so documenting
> bindings first is impossible.
>
> So, if I understand correctly, you are telling me to make a 'sysctrl' driver and use
> platform_device to instantiate my sub-drivers? Isn't that what machine files used
> to do? And they are now banned?
>
> Geert, any guidance here?

It depends on how many and which subnodes you want to add to  the sysctrl
node. Without a complete binding for the block, we cannot know.
If the major part will be the clock driver, I would make that the main
driver for the sysctrl node. The clock driver can easily register
e.g. a simple reset handler.

Cfr. the renesas-cpg-mssr driver, which also handles (module) resets.
There are plenty of other examples of drivers providing multiple
functionalities (e.g. pinctrl drivers also registering GPIO controllers).

If a monolithic driver becomes too large, it can still be split using the
MFD framework.
E.g. the BD9571 PMIC driver is split in an MFD core driver, and 2 drivers
for different functionalities:

   drivers/gpio/gpio-bd9571mwv.c
   drivers/mfd/bd9571mwv.c
   drivers/regulator/bd9571mwv-regulator.c
   include/linux/mfd/bd9571mwv.h

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-04-17  8:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-10  8:30 [PATCH v4 0/8] arm: Base support for Renesas RZN1D-DB Board Michel Pollet
2018-04-10  8:30 ` [PATCH v4 1/8] arm: shmobile: Add the RZ/N1 arch to the shmobile Kconfig Michel Pollet
2018-04-12  8:00   ` Simon Horman
2018-04-10  8:30 ` [PATCH v4 2/8] arm: shmobile: Add the RZ/N1D (R9A06G032) " Michel Pollet
2018-04-10  8:30 ` [PATCH v4 3/8] dt-bindings: mfd: renesas,rzn1-sysctrl: document RZ/N1 sysctrl node Michel Pollet
2018-04-13 18:05   ` Rob Herring
2018-04-17  7:56     ` Michel Pollet
2018-04-17  8:31       ` Geert Uytterhoeven
2018-04-10  8:30 ` [PATCH v4 4/8] dt-bindings: reset: renesas,rzn1-reboot: document RZ/N1 reboot driver Michel Pollet
2018-04-10  8:30 ` [PATCH v4 5/8] dt-bindings: arm: Document the RZN1D-DB board Michel Pollet
2018-04-13 18:32   ` Rob Herring
2018-04-10  8:30 ` [PATCH v4 6/8] ARM: dts: Renesas RZ/N1 SoC base device tree file Michel Pollet
2018-04-10  8:30 ` [PATCH v4 7/8] ARM: dts: Renesas RZN1D-DB Board base file Michel Pollet
2018-04-10  8:30 ` [PATCH v4 8/8] reset: Renesas RZ/N1 reboot driver Michel Pollet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).