diff mbox series

[RFT,4/5] realtek: support D-Link DGS-1210-10P H/W:R1

Message ID 20211005194024.31909-5-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
This is an 8 port 1000BASE-T + 2 1000BASE-X SFP gigabit switch with PoE+
support, 65 W budget (using 54 V * 1.574 A = 85 W power supply).

In order to manipulate the PoE+ one needs the realtek-poe package [0].

Specifications
--------------
* SoC:       Realtek RTL8380M 500 MHz MIPS 4KEc
* Flash:     Macronix MX25L25645GMI-08G 32 MiB
* RAM:       Nanya NT5CC256M8JQ-EK 256 MiB DDR3(L) SDRAM
* Ethernet:  8x 10/100/1000 1000BASE-T
             2x 1000BASE-X SFP
* PoE+:      Broadcom BCM59121B0KMLG (IEEE 802.3at-2009 compliant)
             Controlled by Nuvoton M0516LDE MCU talking undocumented
             protocol to the Realtek's second UART
* Buttons:   Mode ("lights_toggle") and Reset
* LEDs:      Power, PoE Max, Link and PoE software-controlled; per-port
             link indication LEDs hardware-controlled
* UART:      2.54 mm header with populated standard pin connector J8
             Pin 1: Vcc (3.3 V)
             Pin 2: Tx
             Pin 3: Rx
             Pin 4: GND
             Baud and framing: 115200 8n1

Installation
------------

* Configure your client with static 10.90.90.91/24 address.
* Set up a TFTP server on your client and make it serve the initramfs
  image. Connect it to port 1 of the switch.
* Connect serial, power up the switch, interrupt U-boot by hitting
  Escape after seeing "Power on self test" message
* Download the image onto the device and boot from it:
  > tftpboot 0x8f000000 10.90.90.91:openwrt-realtek-generic-d-link_dgs-1210-10p-r1-initramfs-kernel.bin
  > bootm
* Once OpenWrt has booted reconfigure your client to use VID 100 and DHCP,
  scp the sysupgrade image to /tmp and run sysupgrade.

[0] https://patchwork.ozlabs.org/project/openwrt/patch/20210511152243.1167160-1-john@phrozen.org/

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 .../realtek/base-files/etc/board.d/02_network |  7 ++
 .../rtl8380_d-link_dgs-1210-10p-r1.dts        | 67 +++++++++++++++++++
 target/linux/realtek/image/Makefile           | 11 +++
 3 files changed, 85 insertions(+)
 create mode 100644 target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-r1.dts

Comments

Adrian Schmutzler Oct. 9, 2021, 5:55 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 4/5] realtek: support D-Link DGS-1210-10P H/W:R1
> 

[...]

> 
> diff --git a/target/linux/realtek/base-files/etc/board.d/02_network
> b/target/linux/realtek/base-files/etc/board.d/02_network
> index 58461c9c995f..e7c45de92328 100644
> --- a/target/linux/realtek/base-files/etc/board.d/02_network
> +++ b/target/linux/realtek/base-files/etc/board.d/02_network
> @@ -48,6 +48,13 @@ done
>  [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
> 
>  case $board in
> +d-link,dgs-1210-10p-f1|\
> +d-link,dgs-1210-10p-r1)

F1 should be added with F1 support here, unless I'm misunderstanding something.

Best

Adrian

> +	ucidef_set_poe 65 "$lan_list"
> +	# once PoE board data is standardised it should also include
> +	# max per-port power: 30 W
> +	# PoE id numbers: inversed, e.g. lan2 is id 7
> +	;;
>  netgear,gs110tpp-v1)
>  	ucidef_set_poe 130 "$lan_list"
>  	;;
> diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-r1.dts
> b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-r1.dts
> new file mode 100644
> index 000000000000..379e0140bdf0
> --- /dev/null
> +++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-r1.dts
> @@ -0,0 +1,67 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
> +
> +#include "rtl8380_d-link_dgs-1210-10.dtsi"
> +
> +/ {
> +	compatible = "d-link,dgs-1210-10p-r1", "realtek,rtl838x-soc";
> +	model = "D-Link DGS-1210-10P R1";
> +
> +	memory@0 {
> +		device_type = "memory";
> +		reg = <0x0 0x10000000>;
> +	};
> +};
> +
> +&spi0 {
> +	status = "okay";
> +
> +	flash@0 {
> +		compatible = "jedec,spi-nor";
> +		reg = <0>;
> +		spi-max-frequency = <50000000>;
> +
> +		partitions {
> +			compatible = "fixed-partitions";
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +
> +			partition@0 {
> +				label = "u-boot";
> +				reg = <0x00000000 0x0080000>;
> +				read-only;
> +			};
> +
> +			partition@80000 {
> +				label = "u-boot-env";
> +				reg = <0x00080000 0x0040000>;
> +				read-only;
> +			};
> +
> +			partition@c0000 {
> +				label = "u-boot-env2";
> +				reg = <0x000c0000 0x0040000>;
> +			};
> +
> +			partition@100000 {
> +				label = "firmware";
> +				compatible = "denx,uimage";
> +				reg = <0x00100000 0x0e80000>;
> +			};
> +
> +			partition@f80000 {
> +				label = "kernel2";
> +				reg = <0x00f80000 0x0180000>;
> +			};
> +
> +			partition@1100000 {
> +				label = "rootfs2";
> +				reg = <0x01100000 0x0d00000>;
> +			};
> +
> +			partition@1e00000 {
> +				label = "jffs2";
> +				reg = <0x01e00000 0x0200000>;
> +			};
> +		};
> +	};
> +};
> diff --git a/target/linux/realtek/image/Makefile
> b/target/linux/realtek/image/Makefile
> index 903ad3815690..c7238494606e 100644
> --- a/target/linux/realtek/image/Makefile
> +++ b/target/linux/realtek/image/Makefile
> @@ -69,6 +69,17 @@ define Device/d-link_dgs-1210-10p-f1  endef
> TARGET_DEVICES += d-link_dgs-1210-10p-f1
> 
> +define Device/d-link_dgs-1210-10p-r1
> +  $(Device/d-link_dgs-1210)
> +  SOC := rtl8380
> +  IMAGE_SIZE := 14848k
> +  DEVICE_MODEL := DGS-1210-10P
> +  DEVICE_VARIANT := R1
> +  # TODO
> +  # DEVICE_PACKAGES += realtek-poe
> +endef
> +TARGET_DEVICES += d-link_dgs-1210-10p-r1
> +
>  define Device/d-link_dgs-1210-16
>    $(Device/d-link_dgs-1210)
>    DEVICE_MODEL := DGS-1210-16
> --
> 2.17.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
diff mbox series

Patch

diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network
index 58461c9c995f..e7c45de92328 100644
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -48,6 +48,13 @@  done
 [ -n "$label_mac" ] && ucidef_set_label_macaddr $label_mac
 
 case $board in
+d-link,dgs-1210-10p-f1|\
+d-link,dgs-1210-10p-r1)
+	ucidef_set_poe 65 "$lan_list"
+	# once PoE board data is standardised it should also include
+	# max per-port power: 30 W
+	# PoE id numbers: inversed, e.g. lan2 is id 7
+	;;
 netgear,gs110tpp-v1)
 	ucidef_set_poe 130 "$lan_list"
 	;;
diff --git a/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-r1.dts b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-r1.dts
new file mode 100644
index 000000000000..379e0140bdf0
--- /dev/null
+++ b/target/linux/realtek/dts-5.10/rtl8380_d-link_dgs-1210-10p-r1.dts
@@ -0,0 +1,67 @@ 
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "rtl8380_d-link_dgs-1210-10.dtsi"
+
+/ {
+	compatible = "d-link,dgs-1210-10p-r1", "realtek,rtl838x-soc";
+	model = "D-Link DGS-1210-10P R1";
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x10000000>;
+	};
+};
+
+&spi0 {
+	status = "okay";
+
+	flash@0 {
+		compatible = "jedec,spi-nor";
+		reg = <0>;
+		spi-max-frequency = <50000000>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x00000000 0x0080000>;
+				read-only;
+			};
+
+			partition@80000 {
+				label = "u-boot-env";
+				reg = <0x00080000 0x0040000>;
+				read-only;
+			};
+
+			partition@c0000 {
+				label = "u-boot-env2";
+				reg = <0x000c0000 0x0040000>;
+			};
+
+			partition@100000 {
+				label = "firmware";
+				compatible = "denx,uimage";
+				reg = <0x00100000 0x0e80000>;
+			};
+
+			partition@f80000 {
+				label = "kernel2";
+				reg = <0x00f80000 0x0180000>;
+			};
+
+			partition@1100000 {
+				label = "rootfs2";
+				reg = <0x01100000 0x0d00000>;
+			};
+
+			partition@1e00000 {
+				label = "jffs2";
+				reg = <0x01e00000 0x0200000>;
+			};
+		};
+	};
+};
diff --git a/target/linux/realtek/image/Makefile b/target/linux/realtek/image/Makefile
index 903ad3815690..c7238494606e 100644
--- a/target/linux/realtek/image/Makefile
+++ b/target/linux/realtek/image/Makefile
@@ -69,6 +69,17 @@  define Device/d-link_dgs-1210-10p-f1
 endef
 TARGET_DEVICES += d-link_dgs-1210-10p-f1
 
+define Device/d-link_dgs-1210-10p-r1
+  $(Device/d-link_dgs-1210)
+  SOC := rtl8380
+  IMAGE_SIZE := 14848k
+  DEVICE_MODEL := DGS-1210-10P
+  DEVICE_VARIANT := R1
+  # TODO
+  # DEVICE_PACKAGES += realtek-poe
+endef
+TARGET_DEVICES += d-link_dgs-1210-10p-r1
+
 define Device/d-link_dgs-1210-16
   $(Device/d-link_dgs-1210)
   DEVICE_MODEL := DGS-1210-16