From ddaeb73de029d3d93200ff5758f2da89de0d30ce Mon Sep 17 00:00:00 2001
From: INAGAKI Hiroshi <musashino.open@gmail.com>
Date: Thu, 6 May 2021 19:40:04 +0900
Subject: [PATCH] realtek: update soc dtsi in 5.10 for backported drivers

this patch updates SoC dtsi (rtl838x.dtsi, rtl930x.dtsi) for the
following backported drivers:

- gpio-realtek-otto (5.13)
- spi-realtek-rtl (5.12)
- irq-realtek-rtl (5.12)

And, disable SoC GPIO node (gpio0) in rtl930x.dtsi in dts-5.10.
Currently, the upstreamed driver doesn't support the GPIO controller on
RTL930x SoC.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
---
 target/linux/realtek/dts-5.10/rtl838x.dtsi | 22 ++++++++++++++++---
 target/linux/realtek/dts-5.10/rtl930x.dtsi | 25 +++++++++++++++++++---
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/target/linux/realtek/dts-5.10/rtl838x.dtsi b/target/linux/realtek/dts-5.10/rtl838x.dtsi
index 315d34ac0c..1751c57e28 100644
--- a/target/linux/realtek/dts-5.10/rtl838x.dtsi
+++ b/target/linux/realtek/dts-5.10/rtl838x.dtsi
@@ -76,15 +76,30 @@
 	};
 
 	intc: rtlintc {
-		compatible = "realtek,rt8380-intc";
+		compatible = "realtek,rtl-intc";
 		reg = <0xb8003000 0x20>;
 		#address-cells = <0>;
 		#interrupt-cells = <1>;
 		interrupt-controller;
+		interrupt-map =
+			<31 &cpuintc 2>, /* UART0 */
+			<30 &cpuintc 1>, /* UART1 */
+			<29 &cpuintc 5>, /* TC0 */
+			<28 &cpuintc 1>, /* TC1 */
+			<27 &cpuintc 1>, /* OCPTO */
+			<26 &cpuintc 1>, /* HLXTO */
+			<25 &cpuintc 1>, /* SLXTO */
+			<24 &cpuintc 4>, /* NIC */
+			<23 &cpuintc 4>, /* GPIO_ABCD */
+			<22 &cpuintc 4>, /* GPIO_EFGH */
+			<21 &cpuintc 4>, /* RTC */
+			<20 &cpuintc 3>, /* SWCORE */
+			<19 &cpuintc 4>, /* WDT_IP1 */
+			<18 &cpuintc 5>; /* WDT_IP2 */
 	};
 
 	spi0: spi@b8001200 {
-		compatible = "realtek,rtl838x-nor";
+		compatible = "realtek,rtl8380-spi";
 		reg = <0xb8001200 0x100>;
 
 		#address-cells = <1>;
@@ -125,10 +140,11 @@
 	};
 
 	gpio0: gpio-controller@b8003500 {
-		compatible = "realtek,rtl838x-gpio";
+		compatible = "realtek,rtl8380-gpio", "realtek,otto-gpio";
 		reg = <0xb8003500 0x20>;
 		gpio-controller;
 		#gpio-cells = <2>;
+		ngpios = <24>;
 		interrupt-parent = <&intc>;
 		interrupts = <23>;
 	};
diff --git a/target/linux/realtek/dts-5.10/rtl930x.dtsi b/target/linux/realtek/dts-5.10/rtl930x.dtsi
index ea89fd2584..c0cb53af08 100644
--- a/target/linux/realtek/dts-5.10/rtl930x.dtsi
+++ b/target/linux/realtek/dts-5.10/rtl930x.dtsi
@@ -81,11 +81,23 @@
 	};
 
 	intc: rtlintc {
-		compatible = "realtek,rt9300-intc";
+		compatible = "realtek,rtl-intc";
 		reg = <0xb8003000 0x20>;
 		#address-cells = <0>;
 		#interrupt-cells = <1>;
 		interrupt-controller;
+		interrupt-map =
+			<31 &cpuintc 1>, /* UART1 */
+			<30 &cpuintc 2>, /* UART0 */
+			<28 &cpuintc 1>, /* USB_H2 */
+			<24 &cpuintc 4>, /* NIC */
+			<23 &cpuintc 3>, /* SWCORE */
+			<13 &cpuintc 4>, /* GPIO_ABCD */
+			<11 &cpuintc 1>, /* TC4 */
+			<10 &cpuintc 1>, /* TC3 */
+			<9 &cpuintc 1>,  /* TC2 */
+			<8 &cpuintc 1>,  /* TC1 */
+			<7 &cpuintc 5>;  /* TC0 */
 	};
 
 	osc: oscillator {
@@ -105,7 +117,7 @@
 	};
 
 	spi0: spi@b8001200 {
-		compatible = "realtek,rtl838x-nor";
+		compatible = "realtek,rtl8380-spi";
 		reg = <0xb8001200 0x100>;
 
 		#address-cells = <1>;
@@ -143,12 +155,19 @@
 	};
 
 	gpio0: gpio-controller@b8003500 {
-		compatible = "realtek,rtl838x-gpio";
+		compatible = "realtek,rtl8380-gpio", "realtek,otto-gpio";
 		reg = <0xb8003500 0x20>;
 		gpio-controller;
 		#gpio-cells = <2>;
+		ngpios = <32>;
 		interrupt-parent = <&intc>;
 		interrupts = <31>;
+
+		/*
+		 * currently, RTL930x GPIO is not supported in
+		 * upstreamed driver (gpio-realtek-otto)
+		 */
+		status = "disabled";
 	};
 
 	ethernet0: ethernet@bb00a300 {
-- 
2.30.2