浏览代码

realtek: add support for Datto L8

Add support for Datto L8 with 8 copper ports.
POE+ support with 55W power budget.

Specifications:
---------------

    * SoC: Realtek RTL8380M
    * Flash: 32MiB Flash
    * RAM: 256MiB
    * Ethernet: 8x 10/100/1000 Mbps
    * PoE: 8x
    * Serial: UART 3.3V TTL logic, 115200 8N1
        * pinout: G(ND) R(x) T(x) V(cc)
    * Buttons: 1x Reset, 1x LED Mode (noop in OpenWrt)

Note: OpenWrt combines the stock dual firmware partitions
for more overlay capacity, however the OpenWrt image cannot
exceed 13504k

Installation:
-------------

> When connected to CloudTrax, the local management login will be disabled to prevent settings conflicts.

Ensure the switch does not have a working internet connection or the local
web management interface is disabled.

Go to the web management page of the switch (may require factory reset).
By default the switch will use DHCP to obtain an IP address.

The default login user is `admin` with password `0p3nm3$h!`

On the left menu, click "Management" and then "Dual Image" and ensure that
"Partition 0" is selected as the active partition. If it is not, select
"Partition 0" and click "Apply" to save changes.

Click on "Upgrade" in the top right of the web interface. Select the
Active boot partition to update. Select the OpenWrt file ending
in `-initramfs-kernel.bin` as the update file to upload.

Upload the file and follow the prompts to upgrade the firmware.

Reboot the switch from the web UI after the firmware update is completed.
Wait for OpenWrt to finish booting (~2 minutes)

Use SSH or the Luci UI (if available) to perform the sysupgrade.

Copy the sysupgrade file ending in `-squashfs-sysupgrade.bin` to the switch:
```
scp -O openwrt-realtek-rtl838x-datto_l8-squashfs-sysupgrade.bin [email protected]:/tmp/
```

SSH to the switch and run `sysupgrade`:
```
ssh [email protected]
$ sysupgrade -n /tmp/openwrt-realtek-rtl838x-datto_l8-squashfs-sysupgrade.bin
```

OpenWrt will be installed. Note that first boot after installing requires ~3
minutes for the JFFS2 overlay to be formatted. When the Power LED stops blinking
in the first boot after `sysupgrade`, JFFS2 formatting is completed.

----

Revert back to stock firmware:

You will need a tftp server and the original Datto firmware.

Download the firmware for the S8-L/L8 from Datto:
https://networkinghelp.datto.com/help/Content/kb/Networking/Switches/KB360023113291.html

Rename `s8-l_fw_01.03.24_180823-1639.bix` to `vmlinux.bix`,
put `vmlinux.bix` in the root directory of your tftp server.

Connect a serial console to the UART header and power on the switch.

Interrupt U-Boot by typing `pac` when you see
`Enter correct key to stop autoboot:`

Run the following commands:
```
setenv serverip <tftp_server_ip>
setenv ipaddr <ip_on_same_subnet>
setenv netmask 255.255.255.0
run rtkon
run update_linux
run update_linux2
reset
```

The switch will boot the Datto firmware.

Signed-off-by: Hal Martin <[email protected]>
Tested-By: Raylynn Knight <[email protected]>
Signed-off-by: Sander Vanheule <[email protected]>
Hal Martin 1 周之前
父节点
当前提交
741ac49396

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

@@ -52,6 +52,7 @@ realtek_setup_macs()
 	local label_mac=""
 
 	case $board in
+	datto,l8|\
 	edgecore,ecs4100-12ph|\
 	linksys,lgs310c|\
 	linksys,lgs328c|\
@@ -186,6 +187,9 @@ realtek_setup_poe()
 	netgear,gs110tpp-v1)
 		ucidef_set_poe 130 "$(filter_port_list "$lan_list" "lan9 lan10")"
 		;;
+	datto,l8)
+		ucidef_set_poe 55 "lan5 lan6 lan7 lan8 lan4 lan3 lan2 lan1"
+		;;
 	engenius,ews2910p-v1|\
 	engenius,ews2910p-v3)
 		ucidef_set_poe 60 "$(filter_port_list "$lan_list" "lan9 lan10")"

+ 212 - 0
target/linux/realtek/dts/rtl8380_datto_l8.dts

@@ -0,0 +1,212 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/leds/common.h>
+
+#include "rtl838x.dtsi"
+
+/ {
+	compatible = "datto,l8", "realtek,rtl838x-soc";
+
+	model = "Datto L8";
+
+	aliases {
+		label-mac-device = &ethernet0;
+		led-boot = &led_power;
+		led-failsafe = &led_fault;
+		led-running = &led_power;
+		led-upgrade = &led_power;
+	};
+
+	memory@0 {
+		device_type = "memory";
+		reg = <0x0 0x10000000>;
+	};
+
+	leds: leds {
+		pinctrl-names = "default";
+		pinctrl-0 = <&pinmux_disable_sys_led>;
+		compatible = "gpio-leds";
+
+		led_power: led-0 {
+			function = LED_FUNCTION_POWER;
+			color = <LED_COLOR_ID_GREEN>;
+			gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
+		};
+
+		/* high: LAN Mode, low: PoE Mode */
+		led_lan_mode: led-1 {
+			label = "green:lan-mode";
+			gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
+		};
+
+		led_fault: led-2 {
+			function = LED_FUNCTION_FAULT;
+			color = <LED_COLOR_ID_AMBER>;
+			gpios = <&gpio1 2 GPIO_ACTIVE_LOW>;
+		};
+
+		led_poe_max: led-3 {
+			label = "amber:poe-max";
+			gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+		};
+	};
+
+	keys {
+		compatible = "gpio-keys";
+
+		reset {
+			label = "reset";
+			gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_RESTART>;
+		};
+
+		mode {
+			label = "mode";
+			gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+			linux,code = <KEY_LIGHTS_TOGGLE>;
+		};
+	};
+
+	gpio-restart {
+		compatible = "gpio-restart";
+		gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
+		open-source;
+	};
+
+	virtual_flash {
+		compatible = "mtd-concat";
+
+		devices = <&fwconcat0>, <&fwconcat1>;
+
+		partitions {
+			compatible = "fixed-partitions";
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			partition@0 {
+				label = "firmware";
+				reg = <0x0 0x1a60000>;
+				compatible = "openwrt,uimage", "denx,uimage";
+				openwrt,ih-magic = <0x00703400>;
+			};
+		};
+	};
+};
+
+&mdio_aux {
+	status = "okay";
+
+	gpio1: expander@0 {
+		compatible = "realtek,rtl8231";
+		reg = <0>;
+
+		gpio-controller;
+		#gpio-cells = <2>;
+		gpio-ranges = <&gpio1 0 0 37>;
+
+		led-controller {
+			compatible = "realtek,rtl8231-leds";
+			status = "disabled";
+		};
+	};
+};
+
+&uart1 {
+	status = "okay";
+};
+
+&mdio_bus0 {
+	INTERNAL_PHY(8)
+	INTERNAL_PHY(9)
+	INTERNAL_PHY(10)
+	INTERNAL_PHY(11)
+	INTERNAL_PHY(12)
+	INTERNAL_PHY(13)
+	INTERNAL_PHY(14)
+	INTERNAL_PHY(15)
+};
+
+&switch0 {
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		SWITCH_PORT(8, 1, internal)
+		SWITCH_PORT(9, 2, internal)
+		SWITCH_PORT(10, 3, internal)
+		SWITCH_PORT(11, 4, internal)
+		SWITCH_PORT(12, 5, internal)
+		SWITCH_PORT(13, 6, internal)
+		SWITCH_PORT(14, 7, internal)
+		SWITCH_PORT(15, 8, internal)
+
+		port@28 {
+			ethernet = <&ethernet0>;
+			reg = <28>;
+			phy-mode = "internal";
+			fixed-link {
+				speed = <1000>;
+				full-duplex;
+			};
+		};
+	};
+};
+
+&ethernet0 {
+	nvmem-cells = <&macaddr_ubootenv_ethaddr 0>;
+	nvmem-cell-names = "mac-address";
+};
+
+&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 = <0x0 0x80000>;
+				read-only;
+			};
+			partition@80000 {
+				label = "u-boot-env";
+				reg = <0x80000 0x10000>;
+				nvmem-layout {
+					compatible = "u-boot,env";
+
+					macaddr_ubootenv_ethaddr: ethaddr {
+						#nvmem-cell-cells = <1>;
+					};
+				};
+			};
+			partition@90000 {
+				label = "u-boot-env2";
+				reg = <0x90000 0x20000>;
+			};
+			partition@a0000 {
+				label = "cfg";
+				reg = <0xa0000 0x400000>;
+			};
+			partition@4a0000 {
+				label = "log";
+				reg = <0x4a0000 0x100000>;
+			};
+			fwconcat0: partition@5a0000 {
+				label = "runtime";
+				reg = <0x5a0000 0xd30000>;
+			};
+			fwconcat1: partition@12d0000 {
+				label = "runtime2";
+				reg = <0x12d0000 0xd30000>;
+			};
+		};
+	};
+};

+ 13 - 0
target/linux/realtek/image/rtl838x.mk

@@ -91,6 +91,19 @@ define Device/d-link_dgs-1210-28p-f
 endef
 TARGET_DEVICES += d-link_dgs-1210-28p-f
 
+define Device/datto_l8
+  $(Device/uimage-rt-loader)
+  SOC := rtl8380
+  DEVICE_VENDOR := Datto
+  DEVICE_MODEL := L8
+  DEVICE_ALT0_VENDOR := Open Mesh
+  DEVICE_ALT0_MODEL := S8-L
+  DEVICE_PACKAGES += realtek-poe
+  UIMAGE_MAGIC := 0x00703400
+  IMAGE_SIZE := 13504k
+endef
+TARGET_DEVICES += datto_l8
+
 define Device/engenius_ews2910p-v1
   $(Device/engenius_ews2910p)
   SOC := rtl8380