From e7323f0140d38ba3551107d26abf7cc98a2574b5 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Thu, 4 Apr 2024 18:12:35 +0300 Subject: [PATCH] WIP * reduce u-boot-env parition to 128k * add "para" partition which contains the label MAC address analog to TP-Link SG2452P v4 and few others * add "empty" partition in between u-boot-env and para partitions * use nvmem-layout for MAC address * fix indentation in DTS * replace edgecore,reboot with gpio-restart and use active-low * remove adt7470@2f node, the adt7470 driver has no OF support * remove chosen node, it is not needed * remove ext-io@e4 node, we don't have a rtl8390-eio driver * remove gpio-fan node, the fan is connected to and adt7470 * use EXTERNAL_PHY macro for phy 0-7 * add leds node with the gpio-leds driver * enable uart1 for Nuvoton M0516 (PoE) * fix PoE UCI defaults * set phy-mode for PHY at address 48-51 to qsgmii * add reset-gpios to mdio node * add to DEVICE_PACKAGES: * kmod-eeprom-at24 * kmod-hwmon-adt7470 * kmod-hwmon-lm75 * kmod-thermal * realtek-poe * switch rtl8231 driver Notes: Initramfs of this size boots fine when loading to address 0x8f000000 Data Size: 8113317 Bytes = 7.7 MB Having adt7470 and lm75 seems to cause random SFP unplug/plug events. Unloading these modules stops that behaviour. mtd_get_mac_ascii: partition u-boot-env2 not found! mtd_get_mac_ascii: partition u-boot-env2 not found! Cannot parse config file '/etc/fw_env.config': No such file or directory Failed to find NVMEM device --- .../dts/rtl8392_edgecore_ecs4100-12ph.dts | 137 +++++++++++------- target/linux/realtek/image/rtl839x.mk | 6 + 2 files changed, 87 insertions(+), 56 deletions(-) diff --git a/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts b/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts index 067bf24f5a..4411803408 100644 --- a/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts +++ b/target/linux/realtek/dts/rtl8392_edgecore_ecs4100-12ph.dts @@ -17,23 +17,27 @@ led-upgrade = &led_sys; }; - chosen { - bootargs = "console=ttyS0,115200"; - }; - memory@0 { device_type = "memory"; reg = <0x0 0x10000000>; }; - gpio1: rtl8231-gpio { - compatible = "realtek,rtl8231-gpio"; - #gpio-cells = <2>; - indirect-access-bus-id = <3>; - gpio-controller; - }; + leds { + pinctrl-names = "default"; + pinctrl-0 = <&pinmux_disable_sys_led>; + compatible = "gpio-leds"; + + led_sys: sys { + label = "green:sys"; + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + }; + }; + + gpio-restart { + compatible = "gpio-restart"; + gpios = <&gpio1 26 GPIO_ACTIVE_LOW>; + }; - /* i2c of the left SFP cage: port 9 */ i2c0: i2c-gpio-0 { compatible = "i2c-gpio"; sda-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>; @@ -106,11 +110,6 @@ #address-cells = <1>; #size-cells = <0>; - adt7470@2f { - compatible = "adi,adt7470"; - reg = <0x2f>; - }; - lm75b@48 { compatible = "nxp,lm75a"; reg = <0x48>; @@ -123,24 +122,11 @@ }; watchdog { - compatible = "linux,wdt-gpio"; - gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; - hw_algo = "toggle"; - hw_margin_ms = <1200>; - }; - - reboot@0 { - compatible = "edgecore,reboot"; - gpios = <&gpio1 26 GPIO_ACTIVE_HIGH>; + compatible = "linux,wdt-gpio"; + gpios = <&gpio0 20 GPIO_ACTIVE_LOW>; + hw_algo = "toggle"; + hw_margin_ms = <1200>; }; - - fan0: gpio-fan { - #cooling-cells = <2>; - compatible = "gpio-fan"; - gpio-fan,speed-map = <0 0 3000 1>; - gpios = <&gpio1 9 GPIO_ACTIVE_LOW>; - status = "okay"; - }; }; &gpio0 { @@ -157,6 +143,25 @@ }; }; +&mdio_aux { + status = "okay"; + + gpio1: expander@3 { + compatible = "realtek,rtl8231"; + reg = <3>; + + gpio-controller; + #gpio-cells = <2>; + gpio-ranges = <&gpio1 0 0 37>; + + led-controller { + compatible = "realtek,rtl8231-leds"; + status = "disabled"; + }; + }; +}; + + &spi0 { status = "okay"; @@ -177,8 +182,27 @@ }; partition@100000 { label = "u-boot-env"; - reg = <0x100000 0x100000>; + reg = <0x100000 0x20000>; + }; + partition@120000 { + label = "empty"; + reg = <0x120000 0x60000>; + read-only; + }; + partition@180000 { + label = "para"; + reg = <0x180000 0x20000>; read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory: macaddr@0 { + reg = <0x0 0x6>; + }; + }; }; partition@200000 { label = "firmware"; @@ -194,20 +218,27 @@ }; ðernet0 { + nvmem-cells = <&macaddr_factory>; + nvmem-cell-names = "mac-address"; + mdio: mdio-bus { compatible = "realtek,rtl838x-mdio"; regmap = <ðernet0>; #address-cells = <1>; #size-cells = <0>; - INTERNAL_PHY(0) - INTERNAL_PHY(1) - INTERNAL_PHY(2) - INTERNAL_PHY(3) - INTERNAL_PHY(4) - INTERNAL_PHY(5) - INTERNAL_PHY(6) - INTERNAL_PHY(7) + reset-gpios = <&gpio0 23 GPIO_ACTIVE_LOW>; + reset-delay-us = <2000>; + reset-post-delay-us = <140000>; + + EXTERNAL_PHY(0) + EXTERNAL_PHY(1) + EXTERNAL_PHY(2) + EXTERNAL_PHY(3) + EXTERNAL_PHY(4) + EXTERNAL_PHY(5) + EXTERNAL_PHY(6) + EXTERNAL_PHY(7) phy48: ethernet-phy@48 { reg = <48>; @@ -236,16 +267,6 @@ }; &switch0 { - ext_io: ext-io@e4 { - compatible = "realtek,rtl8390-eio", "syscon"; - reg = <0xe4 0x17c>; - - led_sys: sys-led { - active-low; - label = "green:status"; - linux,default-trigger = "default-on"; - }; - }; ports { #address-cells = <1>; #size-cells = <0>; @@ -262,7 +283,7 @@ port@48 { reg = <48>; label = "lan9"; - phy-mode = "sgmii"; + phy-mode = "qsgmii"; phy-handle = <&phy48>; managed = "in-band-status"; }; @@ -270,7 +291,7 @@ port@49 { reg = <49>; label = "lan10"; - phy-mode = "sgmii"; + phy-mode = "qsgmii"; phy-handle = <&phy49>; managed = "in-band-status"; }; @@ -278,7 +299,7 @@ port@50 { reg = <50>; label = "lan11"; - phy-mode = "sgmii"; + phy-mode = "qsgmii"; phy-handle = <&phy50>; managed = "in-band-status"; }; @@ -286,7 +307,7 @@ port@51 { reg = <51>; label = "lan12"; - phy-mode = "sgmii"; + phy-mode = "qsgmii"; phy-handle = <&phy51>; managed = "in-band-status"; }; @@ -303,3 +324,7 @@ }; }; }; + +&uart1 { + status = "okay"; +}; diff --git a/target/linux/realtek/image/rtl839x.mk b/target/linux/realtek/image/rtl839x.mk index f1a38965c9..2ede486b4b 100644 --- a/target/linux/realtek/image/rtl839x.mk +++ b/target/linux/realtek/image/rtl839x.mk @@ -14,6 +14,12 @@ define Device/edgecore_ecs4100-12ph DEVICE_VENDOR := Edgecore DEVICE_MODEL := ECS4100-12PH IMAGE_SIZE := 14336k + DEVICE_PACKAGES := \ + kmod-eeprom-at24 \ + kmod-hwmon-adt7470 \ + kmod-hwmon-lm75 \ + kmod-thermal \ + realtek-poe endef TARGET_DEVICES += edgecore_ecs4100-12ph -- 2.30.2