Bläddra i källkod

realtek: rtl930x: Add support for Plasma Cloud PSX10 Switch

The Plasma Cloud PSX10 Switch is a 8 + 2 port multi-GBit switch with
8x 10/100/1000/2500BaseT Ethernet ports and 2x SFP+ module slot.

Hardware:

- RTL9302C SoC
- Macronix MX25L25645G (32MB flash)
- Winbond W632GU6NB-12 (256MB DDR3 SDRAM - only 128 MB configured*)
- 2x RTL8224 4x 10m/100m/1/2.5 Gigabit PHY
- SFP+ 2x 10GBit slot
- IC+ IP8008 POE+ PSE controller

The switch is powered by 54 Volts 2.77A barrel connector. The internal TTL
serial connector can be used to access the terminal. Pins from 1: TX RX
(unused) GND.  Serial connection is via 115200 baud, 8N1.

A reset button is accessible through a hole in the front panel.

*) Only 128 MB of RAM are currently configured because there were
infrequent random memory corruptions detected when using memtester with a
256 MB DT configuration. This could also be reproduced with RTLSDK.

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

* The device can be flashed by using sysupgrade command. Either from the
  original vendor firmware or using an initramfs (see "Debug")
* Connect serial as per the layout above. Connection parameters: 115200 8N1
* The image must be copied using scp to /tmp of the device

      scp openwrt-realtek-rtl930x-plasmacloud_psx10-squashfs-sysupgrade.bin root@[IP address of the device]:/tmp/

* start sysupgrade without saving the original vendor configuration

      sysupgrade -n /tmp/openwrt-realtek-rtl930x-plasmacloud_psx10-squashfs-sysupgrade.bin

Installation via u-boot
-----------------------

If you have an TFTP server connected to the switch, it is possible to
directly install the device using the factory image from u-boot

    # setup networking and IP of TFP server
    rtk network on
    setenv ipaddr 10.100.100.99
    setenv serverip 10.100.100.20

    # get factory image
    tftp 0x84000000 factory.bin

    # erase firmware partitions
    sf probe 0
    sf erase 0x100000 0x01f00000

    # write firmware to both partitions
    sf write ${fileaddr} 0x100000 ${filesize}
    sf write ${fileaddr} 0x1080000 ${filesize}

    # adjust the boot commands
    setenv bootargs "mtdparts=spi0.0:896k(u-boot),64k(u-boot-env),64k(u-boot-env2),15872k(inactive),15872k(firmware2)"
    setenv bootcmd "rtk init; bootm 0xb5080000"

    # restart
    reset

Debug
-----

* Connect serial as per the layout above. Connection parameters: 115200 8N1.
* A tftp server is required, tftpd-hpa works well.
* Power the device, at U-Boot start rapidly hit Esc key to stop autoboot
* Enable network:

      rtk network on

* Change ip address of device:

      setenv ipaddr 192.168.1.6

* Download initramfs from TFTP server:

      tftpboot 0x84000000 192.168.1.111:openwrt-realtek-rtl930x-plasmacloud_psx10-initramfs-kernel.bin

* Boot loaded file:

      bootm 0x84000000

Signed-off-by: Harshal Gohel <[email protected]>
Co-developed-by: Sharadanand Karanjkar <[email protected]>
Signed-off-by: Sharadanand Karanjkar <[email protected]>
Link: https://github.com/openwrt/openwrt/pull/19362
Signed-off-by: Hauke Mehrtens <[email protected]>
Harshal Gohel 5 månader sedan
förälder
incheckning
cb4603688b

+ 1 - 0
target/linux/realtek/base-files/etc/board.d/02_network

@@ -48,6 +48,7 @@ hpe,1920-48g-poe)
 	lan_mac_end=$(macaddr_add $lan_mac $((mac_count2-mac_count1)))
 	;;
 plasmacloud,psx8|\
+plasmacloud,psx10|\
 tplink,sg2008p-v1|\
 tplink,sg2210p-v3|\
 tplink,sg2452p-v4|\

+ 2 - 1
target/linux/realtek/base-files/lib/upgrade/platform.sh

@@ -27,7 +27,8 @@ platform_do_upgrade() {
 	local board=$(board_name)
 
 	case "$board" in
-	plasmacloud,psx8)
+	plasmacloud,psx8|\
+	plasmacloud,psx10)
 		PART_NAME="inactive"
 		platform_do_upgrade_dualboot_plasmacloud "$1"
 		;;

+ 4 - 2
target/linux/realtek/base-files/lib/upgrade/upgrade_dualboot_plasmacloud.sh

@@ -4,7 +4,8 @@ set_boot_part() {
 	local board=$(board_name)
 
 	case "$board" in
-	plasmacloud,psx8)
+	plasmacloud,psx8|\
+	plasmacloud,psx10)
 		if [ "$part_num" = "1" ]; then
 			echo "bootargs mtdparts=spi0.0:896k(u-boot),64k(u-boot-env),64k(u-boot-env2),15872k(firmware1),15872k(inactive)" > $setenv_script
 			echo "bootcmd rtk init; bootm 0xb4100000" >> $setenv_script
@@ -56,7 +57,8 @@ platform_do_upgrade_dualboot_plasmacloud() {
 	# identify "inactive" slot id based on the expected partition id
 	# of the primary ("firmware1") slot
 	case "$(board_name)" in
-	plasmacloud,psx8)
+	plasmacloud,psx8|\
+	plasmacloud,psx10)
 		primary_firmware_mtd=3
 		;;
 	*)

+ 71 - 0
target/linux/realtek/dts/rtl9302_plasmacloud_psx10.dts

@@ -0,0 +1,71 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/dts-v1/;
+
+#include "rtl9302_plasmacloud_common.dtsi"
+
+/ {
+	compatible = "plasmacloud,psx10", "realtek,rtl838x-soc";
+	model = "Plasma Cloud PSX10";
+
+	i2c1: i2c-gpio1 {
+		compatible = "i2c-gpio";
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		sda-gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
+		scl-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
+
+		i2c-gpio,delay-us = <5>;	/* ~100 kHz */
+	};
+
+	sfp0: sfp-lan9 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c0>;
+		los-gpio = <&gpio0 11 GPIO_ACTIVE_HIGH>;
+		mod-def0-gpio = <&gpio0 12 GPIO_ACTIVE_LOW>;
+		tx-disable-gpio = <&gpio0 22 GPIO_ACTIVE_HIGH>;
+	};
+
+	sfp1: sfp-lan10 {
+		compatible = "sff,sfp";
+		i2c-bus = <&i2c1>;
+		los-gpio = <&gpio0 16 GPIO_ACTIVE_HIGH>;
+		mod-def0-gpio = <&gpio0 20 GPIO_ACTIVE_LOW>;
+		tx-disable-gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
+	};
+};
+
+&mdio {
+	INTERNAL_PHY_SDS(26, 8)
+	INTERNAL_PHY_SDS(27, 9)
+};
+
+&switch0 {
+	ports {
+		port@26 {
+			reg = <26>;
+			label = "lan9";
+			phy-mode = "1000base-x";
+			phy-handle = <&phy26>;
+			sfp = <&sfp0>;
+			led-set = <0>;
+			managed = "in-band-status";
+
+			nvmem-cells = <&macaddr_ubootenv_ethaddr 9>;
+			nvmem-cell-names = "mac-address";
+		};
+
+		port@27 {
+			reg = <27>;
+			label = "lan10";
+			phy-mode = "1000base-x";
+			phy-handle = <&phy27>;
+			sfp = <&sfp1>;
+			led-set = <0>;
+			managed = "in-band-status";
+
+			nvmem-cells = <&macaddr_ubootenv_ethaddr 10>;
+			nvmem-cell-names = "mac-address";
+		};
+	};
+};

+ 6 - 0
target/linux/realtek/image/rtl930x.mk

@@ -34,6 +34,12 @@ define Device/plasmacloud_psx8
 endef
 TARGET_DEVICES += plasmacloud_psx8
 
+define Device/plasmacloud_psx10
+  $(Device/plasmacloud-common)
+  DEVICE_MODEL := PSX10
+endef
+TARGET_DEVICES += plasmacloud_psx10
+
 define Device/tplink_tl-st1008f_v2
   SOC := rtl9303
   UIMAGE_MAGIC := 0x93030000