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 847b3fc0b5..11c7673007 100644 --- a/target/linux/realtek/base-files/etc/board.d/02_network +++ b/target/linux/realtek/base-files/etc/board.d/02_network @@ -96,6 +96,8 @@ realtek_setup_macs() zyxel,gs1920-24hp-v2) lan_mac="$(get_mac_label)" ;; + hasivo,f1100w-4sx-4xgt|\ + hasivo,f1100w-4sx-4xgt-512mb|\ tplink,tl-st1008f-v2|\ zyxel,xgs1010-12-a1) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) diff --git a/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr b/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr index 876dc75af1..3d9e795311 100644 --- a/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr +++ b/target/linux/realtek/base-files/etc/uci-defaults/99_fwenv-store-ethaddr @@ -9,12 +9,27 @@ BOARD_CFG=/etc/board.json [ "$(rootfs_type)" = "tmpfs" ] && exit 0 +# Some devices make it hard or impossible to acquire a usable ethaddr / MAC address +# of the device. Some store it in weird places, some ship with only the common +# Realtek dummy ethaddr, and some are outright broken. +# +# For these devices, we generate a random ethaddr in /etc/board.d/02_network, +# which is stored in /etc/board.json. Here we take this random ethaddr and +# persist it in the U-Boot environment, so that it survives sysupgrades. + case "$(board_name)" in +hasivo,f1100w-4sx-4xgt|\ +hasivo,f1100w-4sx-4xgt-512mb|\ tplink,tl-st1008f-v2) env_ethaddr=$(macaddr_canonicalize "$(fw_printenv -n ethaddr 2>/dev/null)") - # This device ships with a dummy ethaddr because it's an unmanaged switch. - # If it hasn't been updated to another one yet, do that now. + # F1100W-4SX-4XGT and its variants ship with the dummy ethaddr in the u-boot + # environment, and the real ethaddr stored in RUNTIME/RUNTIME2 JFFS2 partitions, + # which would be annoying to deal with. Also ethaddr isn't printed on the case. + # + # TL-ST1008F v2 ships with a dummy ethaddr because it's an unmanaged switch. + # + # We persist the random ethaddr if the currently stored ethaddr is empty or dummy. if [ -z "$env_ethaddr" ] || [ "$env_ethaddr" = "00:e0:4c:00:00:00" ]; then json_init json_load_file "$BOARD_CFG" diff --git a/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-512mb.dts b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-512mb.dts new file mode 100644 index 0000000000..777e53b0bd --- /dev/null +++ b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-512mb.dts @@ -0,0 +1,14 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/dts-v1/; + +#include "rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi" + +/ { + compatible = "hasivo,f1100w-4sx-4xgt-512mb", "realtek,rtl930x-soc"; + model = "Hasivo F1100W-4SX-4XGT (512MB)"; + + memory@0 { + reg = <0x00000000 0x10000000>, /* 256 MiB lowmem */ + <0x20000000 0x10000000>; /* 256 MiB highmem */ + }; +}; diff --git a/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi new file mode 100644 index 0000000000..3f29323c22 --- /dev/null +++ b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi @@ -0,0 +1,214 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/dts-v1/; + +#include "rtl930x.dtsi" + +#include +#include +#include + +/ { + aliases { + led-boot = &led_sys; + led-failsafe = &led_sys; + led-running = &led_sys; + led-upgrade = &led_sys; + }; + + chosen { + stdout-path = "serial0:38400n8"; + }; + + keys { + compatible = "gpio-keys"; + + button-reset { + label = "reset"; + gpios = <&gpio0 20 GPIO_ACTIVE_HIGH>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_sys: led-0 { + gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>; + color = ; + function = LED_FUNCTION_STATUS; + }; + }; + + led_set { + compatible = "realtek,rtl9300-leds"; + + led_set0 = < + (RTL93XX_LED_SET_NONE) + (RTL93XX_LED_SET_10M | RTL93XX_LED_SET_100M | RTL93XX_LED_SET_1G | + RTL93XX_LED_SET_2P5G | RTL93XX_LED_SET_5G | + RTL93XX_LED_SET_LINK | RTL93XX_LED_SET_ACT) + (RTL93XX_LED_SET_10G | RTL93XX_LED_SET_LINK | RTL93XX_LED_SET_ACT) + >; + }; + + sfp0: sfp-p1 { + compatible = "sff,sfp"; + i2c-bus = <&i2c0>; + mod-def0-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>; + maximum-power-milliwatt = <2000>; + #thermal-sensor-cells = <0>; + }; + + sfp1: sfp-p2 { + compatible = "sff,sfp"; + i2c-bus = <&i2c1>; + mod-def0-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>; + maximum-power-milliwatt = <2000>; + #thermal-sensor-cells = <0>; + }; + + sfp2: sfp-p3 { + compatible = "sff,sfp"; + i2c-bus = <&i2c2>; + mod-def0-gpios = <&gpio0 2 GPIO_ACTIVE_LOW>; + maximum-power-milliwatt = <2000>; + #thermal-sensor-cells = <0>; + }; + + sfp3: sfp-p4 { + compatible = "sff,sfp"; + i2c-bus = <&i2c3>; + mod-def0-gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; + maximum-power-milliwatt = <2000>; + #thermal-sensor-cells = <0>; + }; +}; + +&i2c_mst1 { + status = "okay"; + + i2c0: i2c@0 { reg = <0>; }; + i2c1: i2c@1 { reg = <1>; }; + i2c2: i2c@2 { reg = <2>; }; + i2c3: i2c@3 { reg = <3>; }; +}; + +&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>; + + /* stock is LOADER */ + partition@0 { + label = "u-boot"; + reg = <0x0000000 0x00e0000>; + read-only; + }; + + /* stock is BDINFO */ + partition@e0000 { + label = "u-boot-env"; + reg = <0x00e0000 0x0010000>; + }; + + /* stock is SYSINFO */ + partition@f0000 { + label = "u-boot-env2"; + reg = <0x00f0000 0x0010000>; + }; + + /* stock is CFG JFFS2 */ + partition@100000 { + label = "jffs"; + reg = <0x0100000 0x0100000>; + }; + + /* stock is LOG JFFS2 */ + partition@200000 { + label = "jffs2"; + reg = <0x0200000 0x0100000>; + }; + + /* stock is RUNTIME and RUNTIME2 + * RUNTIME is <0x0300000 0x0e80000> + * RUNTIME2 is <0x1180000 0x0e80000> + */ + partition@300000 { + compatible = "openwrt,uimage", "denx,uimage"; + label = "firmware"; + reg = <0x0300000 0x1d00000>; + }; + }; + }; +}; + +&mdio_bus0 { + PHY_C45(26, 16) +}; + +&mdio_bus1 { + PHY_C45(27, 0) +}; + +&mdio_bus2 { + PHY_C45(24, 0) +}; + +&mdio_bus3 { + PHY_C45(25, 16) +}; + +&switch0 { + ethernet-ports { + #address-cells = <1>; + #size-cells = <0>; + + /* SFP+ ports, lan1-4 */ + SWITCH_PORT_SFP(0, 1, 2, 0, 0) + SWITCH_PORT_SFP(8, 2, 3, 0, 1) + SWITCH_PORT_SFP(16, 3, 4, 0, 2) + SWITCH_PORT_SFP(20, 4, 5, 0, 3) + + /* RJ45 ports, lan5-8 */ + SWITCH_PORT_LED(24, 5, 6, 0, usxgmii) + SWITCH_PORT_LED(25, 6, 7, 0, usxgmii) + SWITCH_PORT_LED(26, 7, 8, 0, usxgmii) + SWITCH_PORT_LED(27, 8, 9, 0, usxgmii) + + /* CPU port */ + port@28 { + ethernet = <ðernet0>; + reg = <28>; + phy-mode = "internal"; + + fixed-link { + speed = <1000>; + full-duplex; + }; + }; + }; +}; + +&thermal_zones { + sfp-thermal { + polling-delay-passive = <10000>; + polling-delay = <10000>; + thermal-sensors = <&sfp0>, <&sfp1>, <&sfp2>, <&sfp3>; + trips { + sfp-crit { + temperature = <110000>; + hysteresis = <1000>; + type = "critical"; + }; + }; + }; +}; + diff --git a/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt.dts b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt.dts new file mode 100644 index 0000000000..9c035899aa --- /dev/null +++ b/target/linux/realtek/dts/rtl9303_hasivo_f1100w-4sx-4xgt.dts @@ -0,0 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/dts-v1/; + +#include "rtl9303_hasivo_f1100w-4sx-4xgt-common.dtsi" + +/ { + compatible = "hasivo,f1100w-4sx-4xgt", "realtek,rtl930x-soc"; + model = "Hasivo F1100W-4SX-4XGT"; + + memory@0 { + reg = <0x00000000 0x10000000>; /* 256 MiB */ + }; +}; diff --git a/target/linux/realtek/image/rtl930x.mk b/target/linux/realtek/image/rtl930x.mk index a1f8848efe..1b5b0419cf 100644 --- a/target/linux/realtek/image/rtl930x.mk +++ b/target/linux/realtek/image/rtl930x.mk @@ -12,6 +12,35 @@ define Device/d-link_dgs-1250-28x endef TARGET_DEVICES += d-link_dgs-1250-28x +define Device/hasivo_f1100w-4sx-4xgt-common + SOC := rtl9303 + DEVICE_VENDOR := Hasivo + DEVICE_MODEL := F1100W-4SX-4XGT + DEVICE_ALT0_VENDOR := Hasivo + DEVICE_ALT0_MODEL := F1100W-4SX-4XGT-SE + DEVICE_ALT1_VENDOR := Hasivo + DEVICE_ALT1_MODEL := F1100WP-4SX-4XGT + DEVICE_ALT2_VENDOR := Hasivo + DEVICE_ALT2_MODEL := F1100WP-4SX-4XGT-SE + DEVICE_PACKAGES := kmod-phy-realtek rtl8261n-firmware + IMAGE_SIZE := 29696k + $(Device/kernel-lzma) +endef + +define Device/hasivo_f1100w-4sx-4xgt + $(Device/hasivo_f1100w-4sx-4xgt-common) +endef +TARGET_DEVICES += hasivo_f1100w-4sx-4xgt + +define Device/hasivo_f1100w-4sx-4xgt-512mb + $(Device/hasivo_f1100w-4sx-4xgt-common) + DEVICE_VARIANT := 512MB + DEVICE_ALT0_VARIANT := 512MB + DEVICE_ALT1_VARIANT := 512MB + DEVICE_ALT2_VARIANT := 512MB +endef +TARGET_DEVICES += hasivo_f1100w-4sx-4xgt-512mb + define Device/hasivo_s1100w-8xgt-se SOC := rtl9303 DEVICE_VENDOR := Hasivo