realtek/rtl839x: Edgecore ECS4100-12PH support
[openwrt/staging/stintel.git] / target / linux / realtek / dts-5.15 / rtl8392_edgecore_ecs4100-12ph.dts
diff --git a/target/linux/realtek/dts-5.15/rtl8392_edgecore_ecs4100-12ph.dts b/target/linux/realtek/dts-5.15/rtl8392_edgecore_ecs4100-12ph.dts
new file mode 100644 (file)
index 0000000..067bf24
--- /dev/null
@@ -0,0 +1,305 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#include "rtl839x.dtsi"
+
+#include <dt-bindings/input/input.h>
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+       compatible = "edgecore,ecs4100-12ph", "realtek,rtl839x-soc";
+       model = "Edgecore ECS4100-12PH Switch";
+
+       aliases {
+               label-mac-device = &ethernet0;
+               led-boot = &led_sys;
+               led-failsafe = &led_sys;
+               led-running = &led_sys;
+               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;
+        };
+
+       /* 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)>;
+               scl-gpios = <&gpio1 7 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp0: sfp-p9 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c0>;
+               los-gpio = <&gpio0 12 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 8 GPIO_ACTIVE_LOW>;
+       };
+
+       i2c1: i2c-gpio-1 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 1 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp1: sfp-p10 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c1>;
+               los-gpio = <&gpio0 14 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 3 GPIO_ACTIVE_LOW>;
+       };
+
+       i2c2: i2c-gpio-2 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 23 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp2: sfp-p11 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c2>;
+               los-gpio = <&gpio0 21 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 24 GPIO_ACTIVE_LOW>;
+       };
+
+       i2c3: i2c-gpio-3 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 12 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+       };
+
+       sfp3: sfp-p12 {
+               compatible = "sff,sfp";
+               i2c-bus = <&i2c3>;
+               los-gpio = <&gpio0 22 GPIO_ACTIVE_HIGH>;
+               mod-def0-gpio = <&gpio1 13 GPIO_ACTIVE_LOW>;
+       };
+
+       i2c4: i2c-gpio-4 {
+               compatible = "i2c-gpio";
+               sda-gpios = <&gpio1 29 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               scl-gpios = <&gpio1 30 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
+               i2c-gpio,delay-us = <2>;
+               #address-cells = <1>;
+               #size-cells = <0>;
+
+               adt7470@2f {
+                       compatible = "adi,adt7470";
+                       reg = <0x2f>;
+               };
+
+               lm75b@48 {
+                       compatible = "nxp,lm75a";
+                       reg = <0x48>;
+               };
+
+               eeprom@506 {
+                       compatible = "atmel,24c32";
+                       reg = <0x56>;
+               };
+       };
+
+       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>;
+       };
+
+        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 {
+       poe_enable {
+               gpio-hog;
+               gpios = <16 GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+
+       poe_reset {
+               gpio-hog;
+               gpios = <18 GPIO_ACTIVE_HIGH>;
+               output-high;
+       };
+};
+
+&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 0x40000>;
+                               read-only;
+                       };
+                       partition@100000 {
+                               label = "u-boot-env";
+                               reg = <0x100000 0x100000>;
+                               read-only;
+                       };
+                       partition@200000 {
+                               label = "firmware";
+                               reg = <0x200000 0xdf0000>;
+                               compatible = "openwrt,uimage", "denx,uimage";
+                       };
+                       partition@ff0000 {
+                               label = "certificates";
+                               reg = <0xff0000 0x10000>;
+                       };
+               };
+       };
+};
+
+&ethernet0 {
+       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)
+
+               phy48: ethernet-phy@48 {
+                       reg = <48>;
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       sfp = <&sfp0>;
+               };
+
+               phy49: ethernet-phy@49 {
+                       reg = <49>;
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       sfp = <&sfp1>;
+               };
+
+               phy50: ethernet-phy@50 {
+                       reg = <50>;
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       sfp = <&sfp2>;
+               };
+
+               phy51: ethernet-phy@51 {
+                       reg = <51>;
+                       compatible = "ethernet-phy-ieee802.3-c22";
+                       sfp = <&sfp3>;
+               };
+       };
+};
+
+&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>;
+
+               SWITCH_PORT(0, 1, qsgmii)
+               SWITCH_PORT(1, 2, qsgmii)
+               SWITCH_PORT(2, 3, qsgmii)
+               SWITCH_PORT(3, 4, qsgmii)
+               SWITCH_PORT(4, 5, qsgmii)
+               SWITCH_PORT(5, 6, qsgmii)
+               SWITCH_PORT(6, 7, qsgmii)
+               SWITCH_PORT(7, 8, qsgmii)
+
+               port@48 {
+                       reg = <48>;
+                       label = "lan9";
+                       phy-mode = "sgmii";
+                       phy-handle = <&phy48>;
+                       managed = "in-band-status";
+               };
+
+               port@49 {
+                       reg = <49>;
+                       label = "lan10";
+                       phy-mode = "sgmii";
+                       phy-handle = <&phy49>;
+                       managed = "in-band-status";
+               };
+
+               port@50 {
+                       reg = <50>;
+                       label = "lan11";
+                       phy-mode = "sgmii";
+                       phy-handle = <&phy50>;
+                       managed = "in-band-status";
+               };
+
+               port@51 {
+                       reg = <51>;
+                       label = "lan12";
+                       phy-mode = "sgmii";
+                       phy-handle = <&phy51>;
+                       managed = "in-band-status";
+               };
+
+               port@52 {
+                       ethernet = <&ethernet0>;
+                       reg = <52>;
+                       phy-mode = "qsgmii";
+
+                       fixed-link {
+                               speed = <1000>;
+                               full-duplex;
+                       };
+               };
+       };
+};