WIP ecs4100
authorStijn Tintel <stijn@linux-ipv6.be>
Thu, 4 Apr 2024 15:12:35 +0000 (18:12 +0300)
committerStijn Tintel <stijn@linux-ipv6.be>
Tue, 7 May 2024 14:55:43 +0000 (17:55 +0300)
* 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

Notes:

Did not manage to get a working link on the combo or SFP ports.
Tested mod-def0 and los GPIOs of all 4 SFP nodes, they are correct.
UTP port 9 and 10 work in U-Boot after running `rtk network on`.

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.

target/linux/realtek/base-files/etc/board.d/02_network
target/linux/realtek/dts-5.15/rtl8392_edgecore_ecs4100-12ph.dts
target/linux/realtek/image/rtl839x.mk

index 0599f2ef2a19323b91d514ef8901074a94d5fd8c..f61423e9fc09c3158b09c61c90a90d21ab86503f 100644 (file)
@@ -80,9 +80,8 @@ d-link,dgs-1210-28mp-f)
        ucidef_set_poe 370 "lan8 lan7 lan6 lan5 lan4 lan3 lan2 lan1 lan16 lan15 lan14 lan13 lan12 lan11 lan10 lan9 lan24 lan23
                        lan22 lan21 lan20 lan19 lan18 lan17"
        ;;
-edgecore,ecs4100-12ph|\
-netgear,gs110tpp-v1)
-       ucidef_set_poe 130 "$(filter_port_list "$lan_list" "lan9 lan10")"
+edgecore,ecs4100-12ph)
+       ucidef_set_poe 180 "$(filter_port_list "$lan_list" "lan9 lan10 lan11 lan12")"
        ;;
 engenius,ews2910p)
        ucidef_set_poe 60 "$(filter_port_list "$lan_list" "lan9 lan10")"
@@ -93,6 +92,9 @@ hpe,1920-8g-poe-65w)
 hpe,1920-8g-poe-180w)
        ucidef_set_poe 180 "$(filter_port_list_reverse "$lan_list" "lan9 lan10")"
        ;;
+netgear,gs110tpp-v1)
+       ucidef_set_poe 130 "$(filter_port_list "$lan_list" "lan9 lan10")"
+       ;;
 netgear,gs110tup-v1)
        ucidef_set_poe 240 "$(filter_port_list "$lan_list" "lan9 lan10")"
        ;;
index 067bf24f5a8c919a1c4869caad15a0618ab591e7..2fda9ebda3263ca1fc850c9a2e11bb8910c9ac7a 100644 (file)
                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>;
+               };
+       };
+
+       gpio1: rtl8231-gpio {
+               compatible = "realtek,rtl8231-gpio";
+               #gpio-cells = <2>;
+               indirect-access-bus-id = <3>;
+               gpio-controller;
+       };
+
+       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)>;
                #address-cells = <1>;
                #size-cells = <0>;
 
-               adt7470@2f {
-                       compatible = "adi,adt7470";
-                       reg = <0x2f>;
-               };
-
                lm75b@48 {
                        compatible = "nxp,lm75a";
                        reg = <0x48>;
        };
 
        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 {
                        };
                        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";
 };
 
 &ethernet0 {
+       nvmem-cells = <&macaddr_factory>;
+       nvmem-cell-names = "mac-address";
+
        mdio: mdio-bus {
                compatible = "realtek,rtl838x-mdio";
                regmap = <&ethernet0>;
                #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>;
 };
 
 &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>;
                port@48 {
                        reg = <48>;
                        label = "lan9";
-                       phy-mode = "sgmii";
+                       phy-mode = "qsgmii";
                        phy-handle = <&phy48>;
                        managed = "in-band-status";
                };
                port@49 {
                        reg = <49>;
                        label = "lan10";
-                       phy-mode = "sgmii";
+                       phy-mode = "qsgmii";
                        phy-handle = <&phy49>;
                        managed = "in-band-status";
                };
                port@50 {
                        reg = <50>;
                        label = "lan11";
-                       phy-mode = "sgmii";
+                       phy-mode = "qsgmii";
                        phy-handle = <&phy50>;
                        managed = "in-band-status";
                };
                port@51 {
                        reg = <51>;
                        label = "lan12";
-                       phy-mode = "sgmii";
+                       phy-mode = "qsgmii";
                        phy-handle = <&phy51>;
                        managed = "in-band-status";
                };
                };
        };
 };
+
+&uart1 {
+       status = "okay";
+};
index 90a58180fd5372421d830b20c0c35e79a2470ea9..16cec844f0c468cae1812da1ccda15de53dc1393 100644 (file)
@@ -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