diff mbox series

[RFT,1/5] realtek: split DGS-1210-10P DTS

Message ID 20211005194024.31909-2-fercerpav@gmail.com
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series realtek: support boards similar to DGS-1210-10 | expand

Commit Message

Paul Fertser Oct. 5, 2021, 7:40 p.m. UTC
In preparations to add support for more similar boards the common part
is split into a DTSI.

The model that's currently supported is known to be revision F1 so mark
it accordingly and provide appropriate compatible string for sysupgrade
to work.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 ...0p.dts => rtl8380_d-link_dgs-1210-10.dtsi} | 60 -----------------
 .../rtl8380_d-link_dgs-1210-10p-f1.dts        | 66 +++++++++++++++++++
 target/linux/realtek/image/Makefile           |  7 +-
 3 files changed, 71 insertions(+), 62 deletions(-)
 rename target/linux/realtek/dts-5.10/{rtl8382_d-link_dgs-1210-10p.dts => rtl8380_d-link_dgs-1210-10.dtsi} (60%)
 create mode 100644 target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-f1.dts

Comments

Adrian Schmutzler Oct. 9, 2021, 5:45 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Paul Fertser
> Sent: Dienstag, 5. Oktober 2021 21:40
> To: openwrt-devel@lists.openwrt.org
> Cc: Paul Fertser <fercerpav@gmail.com>
> Subject: [RFT 1/5] realtek: split DGS-1210-10P DTS
> 
> In preparations to add support for more similar boards the common part is
> split into a DTSI.
> 
> The model that's currently supported is known to be revision F1 so mark it
> accordingly and provide appropriate compatible string for sysupgrade to
> work.

I'd say the device rename is way more important than the DTS split. It should be covered in the commit title.
Personally, I'd split these two changes (one for rename, one for shared DTSI and device recipe).

Best

Adrian

> 
> Signed-off-by: Paul Fertser <fercerpav@gmail.com>
> ---
>  ...0p.dts => rtl8380_d-link_dgs-1210-10.dtsi} | 60 -----------------
>  .../rtl8380_d-link_dgs-1210-10p-f1.dts        | 66 +++++++++++++++++++
>  target/linux/realtek/image/Makefile           |  7 +-
>  3 files changed, 71 insertions(+), 62 deletions(-)  rename
> target/linux/realtek/dts-5.10/{rtl8382_d-link_dgs-1210-10p.dts => rtl8380_d-
> link_dgs-1210-10.dtsi} (60%)  create mode 100644 target/linux/realtek/dts-
> 5.10/rtl8380_d-link_dgs-1210-10p-f1.dts
> 
> diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts
> b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
> similarity index 60%
> rename from target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts
> rename to target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
> index 119eaadc16e6..c465e7354872 100644
> --- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts
> +++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
> @@ -6,9 +6,6 @@
>  #include <dt-bindings/gpio/gpio.h>
> 
>  / {
> -	compatible = "d-link,dgs-1210-10p", "realtek,rtl838x-soc";
> -	model = "D-Link DGS-1210-10P";
> -
>  	aliases {
>  		led-boot = &led_power;
>  		led-failsafe = &led_power;
> @@ -20,11 +17,6 @@
>  		bootargs = "console=ttyS0,115200";
>  	};
> 
> -	memory@0 {
> -		device_type = "memory";
> -		reg = <0x0 0x8000000>;
> -	};
> -
>  	leds {
>  		pinctrl-names = "default";
>  		pinctrl-0 = <&pinmux_disable_sys_led>; @@ -50,58 +42,6
> @@
>  	};
>  };
> 
> -
> -&spi0 {
> -	status = "okay";
> -	flash@0 {
> -		compatible = "jedec,spi-nor";
> -		reg = <0>;
> -		spi-max-frequency = <10000000>;
> -
> -		partitions {
> -			compatible = "fixed-partitions";
> -			#address-cells = <1>;
> -			#size-cells = <1>;
> -
> -			partition@0 {
> -				label = "u-boot";
> -				reg = <0x00000000 0x80000>;
> -				read-only;
> -			};
> -			partition@80000 {
> -				label = "u-boot-env";
> -				reg = <0x00080000 0x40000>;
> -				read-only;
> -			};
> -			partition@c0000 {
> -				label = "u-boot-env2";
> -				reg = <0x000c0000 0x40000>;
> -			};
> -			partition@280000 {
> -				label = "firmware";
> -				compatible = "denx,uimage";
> -				reg = <0x00100000 0xd80000>;
> -			};
> -			partition@be80000 {
> -				label = "kernel2";
> -				reg = <0x00e80000 0x180000>;
> -			};
> -			partition@1000000 {
> -				label = "sysinfo";
> -				reg = <0x01000000 0x40000>;
> -			};
> -			partition@1040000 {
> -				label = "rootfs2";
> -				reg = <0x01040000 0xc00000>;
> -			};
> -			partition@1c40000 {
> -				label = "jffs2";
> -				reg = <0x01c40000 0x3c0000>;
> -			};
> -		};
> -	};
> -};
> -
>  &uart1 {
>  	status = "okay";
>  };
> diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-f1.dts
> b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-f1.dts
> new file mode 100644
> index 000000000000..9a301adb935c
> --- /dev/null
> +++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-f1.dts
> @@ -0,0 +1,66 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +
> +#include "rtl8380_d-link_dgs-1210-10.dtsi"
> +
> +/ {
> +	compatible = "d-link,dgs-1210-10p-f1", "realtek,rtl838x-soc";
> +	model = "D-Link DGS-1210-10P F1";
> +
> +	memory@0 {
> +		device_type = "memory";
> +		reg = <0x0 0x8000000>;
> +	};
> +};
> +
> +
> +&spi0 {
> +	status = "okay";
> +
> +	flash@0 {
> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <10000000>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "u-boot";
> +				reg = <0x00000000 0x80000>;
> +				read-only;
> +			};
> +			partition@80000 {
> +				label = "u-boot-env";
> +				reg = <0x00080000 0x40000>;
> +				read-only;
> +			};
> +			partition@c0000 {
> +				label = "u-boot-env2";
> +				reg = <0x000c0000 0x40000>;
> +			};
> +			partition@280000 {
> +				label = "firmware";
> +				compatible = "denx,uimage";
> +				reg = <0x00100000 0xd80000>;
> +			};
> +			partition@be80000 {
> +				label = "kernel2";
> +				reg = <0x00e80000 0x180000>;
> +			};
> +			partition@1000000 {
> +				label = "sysinfo";
> +				reg = <0x01000000 0x40000>;
> +			};
> +			partition@1040000 {
> +				label = "rootfs2";
> +				reg = <0x01040000 0xc00000>;
> +			};
> +			partition@1c40000 {
> +				label = "jffs2";
> +				reg = <0x01c40000 0x3c0000>;
> +			};
> +		};
> +	};
> +};
> diff --git a/target/linux/realtek/image/Makefile
> b/target/linux/realtek/image/Makefile
> index 5e4b4cde800d..c1e47f719f3a 100644
> --- a/target/linux/realtek/image/Makefile
> +++ b/target/linux/realtek/image/Makefile
> @@ -53,12 +53,15 @@ define Device/d-link_dgs-1210
>    DEVICE_VENDOR := D-Link
>  endef
> 
> -define Device/d-link_dgs-1210-10p
> +define Device/d-link_dgs-1210-10p-f1
>    $(Device/d-link_dgs-1210)
> +  SOC := rtl8380
>    DEVICE_MODEL := DGS-1210-10P
> +  DEVICE_VARIANT := F1
> +  SUPPORTED_DEVICES += d-link,dgs-1210-10p
>    DEVICE_PACKAGES += lua-rs232
>  endef
> -TARGET_DEVICES += d-link_dgs-1210-10p
> +TARGET_DEVICES += d-link_dgs-1210-10p-f1
> 
>  define Device/d-link_dgs-1210-16
>    $(Device/d-link_dgs-1210)
> --
> 2.17.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Adrian Schmutzler Oct. 9, 2021, 5:48 p.m. UTC | #2
> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Paul Fertser
> Sent: Dienstag, 5. Oktober 2021 21:40
> To: openwrt-devel@lists.openwrt.org
> Cc: Paul Fertser <fercerpav@gmail.com>
> Subject: [RFT 1/5] realtek: split DGS-1210-10P DTS
> 
> In preparations to add support for more similar boards the common part is
> split into a DTSI.
> 
> The model that's currently supported is known to be revision F1 so mark it
> accordingly and provide appropriate compatible string for sysupgrade to
> work.
> 

[...]

> diff --git a/target/linux/realtek/image/Makefile
> b/target/linux/realtek/image/Makefile
> index 5e4b4cde800d..c1e47f719f3a 100644
> --- a/target/linux/realtek/image/Makefile
> +++ b/target/linux/realtek/image/Makefile
> @@ -53,12 +53,15 @@ define Device/d-link_dgs-1210
>    DEVICE_VENDOR := D-Link
>  endef
> 
> -define Device/d-link_dgs-1210-10p
> +define Device/d-link_dgs-1210-10p-f1
>    $(Device/d-link_dgs-1210)
> +  SOC := rtl8380

Please, don't overwrite SOC on different levels. If these devices have different SOC, it should be moved out of the common recipe and been set for every device individually.

Best

Adrian

>    DEVICE_MODEL := DGS-1210-10P
> +  DEVICE_VARIANT := F1
> +  SUPPORTED_DEVICES += d-link,dgs-1210-10p
>    DEVICE_PACKAGES += lua-rs232
>  endef
> -TARGET_DEVICES += d-link_dgs-1210-10p
> +TARGET_DEVICES += d-link_dgs-1210-10p-f1
> 
>  define Device/d-link_dgs-1210-16
>    $(Device/d-link_dgs-1210)
> --
> 2.17.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Paul Fertser Jan. 10, 2022, 2:07 p.m. UTC | #3
Hi Adrian,

Thank you very much for the review of these patches, all comments make
sense to me, and I would have fixed that all BUT

Apparently finding even a single person to actually test this code on
older revision or on similar Trendnet device is impossible so I guess
the best I can do is to send a single patch adding support for the
device I personally have access to, without touching anything else
that's already there.

Will post it soon. Thank you again for your continued work.
diff mbox series

Patch

diff --git a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
similarity index 60%
rename from target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts
rename to target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
index 119eaadc16e6..c465e7354872 100644
--- a/target/linux/realtek/dts-5.10/rtl8382_d-link_dgs-1210-10p.dts
+++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10.dtsi
@@ -6,9 +6,6 @@ 
 #include <dt-bindings/gpio/gpio.h>
 
 / {
-	compatible = "d-link,dgs-1210-10p", "realtek,rtl838x-soc";
-	model = "D-Link DGS-1210-10P";
-
 	aliases {
 		led-boot = &led_power;
 		led-failsafe = &led_power;
@@ -20,11 +17,6 @@ 
 		bootargs = "console=ttyS0,115200";
 	};
 
-	memory@0 {
-		device_type = "memory";
-		reg = <0x0 0x8000000>;
-	};
-
 	leds {
 		pinctrl-names = "default";
 		pinctrl-0 = <&pinmux_disable_sys_led>;
@@ -50,58 +42,6 @@ 
 	};
 };
 
-
-&spi0 {
-	status = "okay";
-	flash@0 {
-		compatible = "jedec,spi-nor";
-		reg = <0>;
-		spi-max-frequency = <10000000>;
-
-		partitions {
-			compatible = "fixed-partitions";
-			#address-cells = <1>;
-			#size-cells = <1>;
-
-			partition@0 {
-				label = "u-boot";
-				reg = <0x00000000 0x80000>;
-				read-only;
-			};
-			partition@80000 {
-				label = "u-boot-env";
-				reg = <0x00080000 0x40000>;
-				read-only;
-			};
-			partition@c0000 {
-				label = "u-boot-env2";
-				reg = <0x000c0000 0x40000>;
-			};
-			partition@280000 {
-				label = "firmware";
-				compatible = "denx,uimage";
-				reg = <0x00100000 0xd80000>;
-			};
-			partition@be80000 {
-				label = "kernel2";
-				reg = <0x00e80000 0x180000>;
-			};
-			partition@1000000 {
-				label = "sysinfo";
-				reg = <0x01000000 0x40000>;
-			};
-			partition@1040000 {
-				label = "rootfs2";
-				reg = <0x01040000 0xc00000>;
-			};
-			partition@1c40000 {
-				label = "jffs2";
-				reg = <0x01c40000 0x3c0000>;
-			};
-		};
-	};
-};
-
 &uart1 {
 	status = "okay";
 };
diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-f1.dts b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-f1.dts
new file mode 100644
index 000000000000..9a301adb935c
--- /dev/null
+++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-f1.dts
@@ -0,0 +1,66 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "rtl8380_d-link_dgs-1210-10.dtsi"
+
+/ {
+	compatible = "d-link,dgs-1210-10p-f1", "realtek,rtl838x-soc";
+	model = "D-Link DGS-1210-10P F1";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x8000000>;
+	};
+};
+
+
+&spi0 {
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <10000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x00000000 0x80000>;
+				read-only;
+			};
+			partition@80000 {
+				label = "u-boot-env";
+				reg = <0x00080000 0x40000>;
+				read-only;
+			};
+			partition@c0000 {
+				label = "u-boot-env2";
+				reg = <0x000c0000 0x40000>;
+			};
+			partition@280000 {
+				label = "firmware";
+				compatible = "denx,uimage";
+				reg = <0x00100000 0xd80000>;
+			};
+			partition@be80000 {
+				label = "kernel2";
+				reg = <0x00e80000 0x180000>;
+			};
+			partition@1000000 {
+				label = "sysinfo";
+				reg = <0x01000000 0x40000>;
+			};
+			partition@1040000 {
+				label = "rootfs2";
+				reg = <0x01040000 0xc00000>;
+			};
+			partition@1c40000 {
+				label = "jffs2";
+				reg = <0x01c40000 0x3c0000>;
+			};
+		};
+	};
+};
diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile
index 5e4b4cde800d..c1e47f719f3a 100644
--- a/target/linux/realtek/image/Makefile
+++ b/target/linux/realtek/image/Makefile
@@ -53,12 +53,15 @@  define Device/d-link_dgs-1210
   DEVICE_VENDOR := D-Link
 endef
 
-define Device/d-link_dgs-1210-10p
+define Device/d-link_dgs-1210-10p-f1
   $(Device/d-link_dgs-1210)
+  SOC := rtl8380
   DEVICE_MODEL := DGS-1210-10P
+  DEVICE_VARIANT := F1
+  SUPPORTED_DEVICES += d-link,dgs-1210-10p
   DEVICE_PACKAGES += lua-rs232
 endef
-TARGET_DEVICES += d-link_dgs-1210-10p
+TARGET_DEVICES += d-link_dgs-1210-10p-f1
 
 define Device/d-link_dgs-1210-16
   $(Device/d-link_dgs-1210)