Skip to contentSkip to conversation

arm64: Realtek RTD1295 reset controllers

PATCH In review Andreas Färber 3 participants 10 messages Aug 16, 2017 – Aug 17, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover arm64: Realtek RTD1295 reset controllers

Hello,

This series adds reset controllers for the Realtek RTD1295 SoC.

Since there is still no public source code for RTD1295, the individual resets were derived from reset-names in the vendor DT; the implementation was a guess.

More experimental patches at:
https://github.com/afaerber/linux/commits/rtd1295-next

Have a lot of fun!

Cheers,
Andreas

Cc Roc He <[email protected]>
Cc devicetree at vger.kernel.org

Andreas F?rber (5):
dt-bindings: reset: Add Realtek RTD1295
arm64: dts: realtek: Add RTD1295 reset controller nodes
reset: Add Realtek RTD1295 driver
arm64: dts: realtek: Add RTD1295 UART resets
arm64: dts: realtek: Adopt RTD1295 reset constants

 .../bindings/reset/realtek,rtd129x-reset.txt       |  18 ++++
 arch/arm64/boot/dts/realtek/rtd1295.dtsi           |  34 +++++++
 drivers/reset/Kconfig                              |   6 ++
 drivers/reset/Makefile                             |   1 +
 drivers/reset/reset-rtd129x.c                      | 100 ++++++++++++++++++
 include/dt-bindings/reset/realtek,rtd1295.h        | 112 +++++++++++++++++++++
 6 files changed, 271 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/realtek,rtd129x-reset.txt
 create mode 100644 drivers/reset/reset-rtd129x.c
 create mode 100644 include/dt-bindings/reset/realtek,rtd1295.h
Signature · 1 line
2.12.3
#1 lore raw

PATCH 1/5 dt-bindings: reset: Add Realtek RTD1295

Add binding for Realtek RTD1295 reset controller.

---
 .../bindings/reset/realtek,rtd129x-reset.txt       |  18 ++++
 include/dt-bindings/reset/realtek,rtd1295.h        | 112 +++++++++++++++++++++
 2 files changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/realtek,rtd129x-reset.txt
 create mode 100644 include/dt-bindings/reset/realtek,rtd1295.h
Documentation/devicetree/bindings/reset/realtek,rtd129x-reset.txt new file +18 -0
new file mode 100644
index 000000000000..79fb37feb0a2
@@ -0,0 +1,18 @@
+Realtek RTD129x Reset Controller
+================================
+
+Required properties:
+- compatible   :  Should be "realtek,rtd1295-reset"
+- reg          :  Should contain the register address and 4 as size.
+- #reset-cells :  Should be 1
+
+See reset.txt for common reset controller bindings.
+
+
+Example:
+
+	reset-controller at 98000000 {
+		compatible = "realtek,rtd1295-reset";
+		reg = <0x98000000 0x4>;
+		#reset-cells = <1>;
+	};
include/dt-bindings/reset/realtek,rtd1295.h new file +112 -0

112 lines not on this page · raw message

Signature · 1 line
2.12.3
maintainer Acked-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] dt-bindings: reset: Add Realtek RTD1295

Quoted 9 lines · Andreas F?rber

Add binding for Realtek RTD1295 reset controller.

---
 .../bindings/reset/realtek,rtd129x-reset.txt       |  18 ++++
 include/dt-bindings/reset/realtek,rtd1295.h        | 112 +++++++++++++++++++++
 2 files changed, 130 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/reset/realtek,rtd129x-reset.txt
 create mode 100644 include/dt-bindings/reset/realtek,rtd1295.h
#3 lore raw

PATCH 2/5 arm64: dts: realtek: Add RTD1295 reset controller nodes

In reply to Andreas Färber

Add nodes for the Realtek RTD1295 reset controllers.

---
 arch/arm64/boot/dts/realtek/rtd1295.dtsi | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
arch/arm64/boot/dts/realtek/rtd1295.dtsi +30 -0
index 43da91fce2b1..9f1dcd1fa8b3 100644
@@ -87,6 +87,36 @@
 		/* Exclude up to 2 GiB of RAM */
 		ranges = <0x80000000 0x80000000 0x80000000>;
 
+		reset1: reset-controller at 98000000 {
+			compatible = "realtek,rtd1295-reset";
+			reg = <0x98000000 0x4>;
+			#reset-cells = <1>;
+		};
+
+		reset2: reset-controller at 98000004 {
+			compatible = "realtek,rtd1295-reset";
+			reg = <0x98000004 0x4>;
+			#reset-cells = <1>;
+		};
+
+		reset3: reset-controller at 98000008 {
+			compatible = "realtek,rtd1295-reset";
+			reg = <0x98000008 0x4>;
+			#reset-cells = <1>;
+		};
+
+		reset4: reset-controller at 98000050 {
+			compatible = "realtek,rtd1295-reset";
+			reg = <0x98000050 0x4>;
+			#reset-cells = <1>;
+		};
+
+		iso_reset: reset-controller at 98007088 {
+			compatible = "realtek,rtd1295-reset";
+			reg = <0x98007088 0x4>;
+			#reset-cells = <1>;
+		};
+
 		uart0: serial at 98007800 {
 			compatible = "snps,dw-apb-uart";
 			reg = <0x98007800 0x400>;
Signature · 1 line
2.12.3
#4 lore raw

PATCH 3/5 reset: Add Realtek RTD1295 driver

In reply to Andreas Färber

Add a per-register reset controller driver. This deals with the fact that not all registers are adjoined.

---
 drivers/reset/Kconfig         |   6 +++
 drivers/reset/Makefile        |   1 +
 drivers/reset/reset-rtd129x.c | 100 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 107 insertions(+)
 create mode 100644 drivers/reset/reset-rtd129x.c
drivers/reset/Kconfig +6 -0
index 52d5251660b9..dbac75e3f82c 100644
@@ -68,6 +68,12 @@ config RESET_PISTACHIO
 	help
 	  This enables the reset driver for ImgTec Pistachio SoCs.
 
+config RESET_RTD129X
+	bool "Realtek RTD129x Reset Driver" if COMPILE_TEST
+	default ARCH_REALTEK if ARM64
+	help
+	  This enables the reset controller driver for Realtek RTD1295 SoC.
+
 config RESET_SOCFPGA
 	bool "SoCFPGA Reset Driver" if COMPILE_TEST
 	default ARCH_SOCFPGA
drivers/reset/Makefile +1 -0
index b62783f50fe5..bca900260a57 100644
@@ -11,6 +11,7 @@ obj-$(CONFIG_RESET_LPC18XX) += reset-lpc18xx.o
 obj-$(CONFIG_RESET_MESON) += reset-meson.o
 obj-$(CONFIG_RESET_OXNAS) += reset-oxnas.o
 obj-$(CONFIG_RESET_PISTACHIO) += reset-pistachio.o
+obj-$(CONFIG_RESET_RTD129X) += reset-rtd129x.o
 obj-$(CONFIG_RESET_SOCFPGA) += reset-socfpga.o
 obj-$(CONFIG_RESET_STM32) += reset-stm32.o
 obj-$(CONFIG_RESET_SUNXI) += reset-sunxi.o
drivers/reset/reset-rtd129x.c new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
2.12.3
maintainer
#5 lore raw

Re: [PATCH 3/5] reset: Add Realtek RTD1295 driver

Hi Andreas,

Quoted 2 lines · Andreas F?rber

Add a per-register reset controller driver. This deals with the fact that not all registers are adjoined.

the way you handle the non-contiguous reset registers, this looks like a candidate to join?the recently discussed reset-simple driver [1]. Could you check if that would fit?

regards
Philipp

#6 lore raw

Re: [PATCH 3/5] reset: Add Realtek RTD1295 driver

Hi Philipp,

Am 16.08.2017 um 11:44 schrieb Philipp Zabel:

Quoted 7 lines · Andreas F?rber
Quoted 2 lines

Add a per-register reset controller driver. This deals with the fact that not all registers are adjoined.

the way you handle the non-contiguous reset registers, this looks like a candidate to join the recently discussed reset-simple driver [1]. Could you check if that would fit?

Thanks, I appreciate the idea, and it looks like you already have the active-low logic in place.

Are you okay with keeping the first three as separate nodes, or would you rather want one node to cover the first three registers, plus two separate ones for the non-contiguous cases? Or is the simple driver supposed to cover gaps, too? Then we could go with just two nodes. (I found it weird to have reset and then reset4, so I went with separate ones as seen downstream.)

Regards,
Andreas

Signature · 3 lines
SUSE Linux GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany
GF: Felix Imend?rffer, Jane Smithard, Graham Norton
HRB 21284 (AG N?rnberg)
maintainer
#7 lore raw

Re: [PATCH 3/5] reset: Add Realtek RTD1295 driver

Quoted 13 lines · Andreas F?rber

Hi Philipp,

Am 16.08.2017 um 11:44 schrieb Philipp Zabel:

Quoted 9 lines · Andreas F?rber
Quoted 3 lines

Add a per-register reset controller driver. This deals with the fact
that not all registers are adjoined.

the way you handle the non-contiguous reset registers, this looks like
a candidate to join the recently discussed reset-simple driver [1]. Could you check if that would fit?

Quoted 6 lines

Thanks, I appreciate the idea, and it looks like you already have the active-low logic in place.

Are you okay with keeping the first three as separate nodes, or would you rather want one node to cover the first three registers, plus two separate ones for the non-contiguous cases?

I am fine with keeping them separate, if you think this best describes the hardware.

Quoted 3 lines

Or is the simple driver supposed to cover gaps, too? Then we could go with just two nodes. (I found it weird to have reset and then reset4, so I went with separate ones as seen downstream.)

I had declared gaps as out of scope of the simple reset controller driver, but if the implementation could be kept reasonably simple, we could think about supporting something like this, too:

		reset: reset-controller at 98000000 {
			compatible = "realtek,rtd1295-reset";
			reg = <0x98000000 0xc>, <0x98000050 0x4>;
			#reset-cells = <1>;
		};

regards
Philipp

#8 lore raw

PATCH 4/5 arm64: dts: realtek: Add RTD1295 UART resets

In reply to Andreas Färber

Associate the UART nodes with the corresponding reset controller bits.

---
 arch/arm64/boot/dts/realtek/rtd1295.dtsi | 3 +++
 1 file changed, 3 insertions(+)
arch/arm64/boot/dts/realtek/rtd1295.dtsi +3 -0
index 9f1dcd1fa8b3..e777200d84b9 100644
@@ -123,6 +123,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clock-frequency = <27000000>;
+			resets = <&iso_reset 8>;
 			status = "disabled";
 		};
 
@@ -132,6 +133,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clock-frequency = <432000000>;
+			resets = <&reset2 28>;
 			status = "disabled";
 		};
 
@@ -141,6 +143,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clock-frequency = <432000000>;
+			resets = <&reset2 27>;
 			status = "disabled";
 		};
 
Signature · 1 line
2.12.3
#9 lore raw

PATCH 5/5 arm64: dts: realtek: Adopt RTD1295 reset constants

In reply to Andreas Färber

Replace reset controller indices with constants.

---
 arch/arm64/boot/dts/realtek/rtd1295.dtsi | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
arch/arm64/boot/dts/realtek/rtd1295.dtsi +4 -3
index e777200d84b9..2d2d84b573e3 100644
@@ -7,6 +7,7 @@
  */
 
 #include <dt-bindings/interrupt-controller/arm-gic.h>
+#include <dt-bindings/reset/realtek,rtd1295.h>
 
 / {
 	compatible = "realtek,rtd1295";
@@ -123,7 +124,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clock-frequency = <27000000>;
-			resets = <&iso_reset 8>;
+			resets = <&iso_reset RTD1295_ISO_RSTN_UR0>;
 			status = "disabled";
 		};
 
@@ -133,7 +134,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clock-frequency = <432000000>;
-			resets = <&reset2 28>;
+			resets = <&reset2 RTD1295_RSTN_UR1>;
 			status = "disabled";
 		};
 
@@ -143,7 +144,7 @@
 			reg-shift = <2>;
 			reg-io-width = <4>;
 			clock-frequency = <432000000>;
-			resets = <&reset2 27>;
+			resets = <&reset2 RTD1295_RSTN_UR2>;
 			status = "disabled";
 		};
 
Signature · 1 line
2.12.3