mediatek: add support for GL.iNet GL-X3000
authorDavid Bauer <mail@david-bauer.net>
Thu, 30 Nov 2023 21:17:36 +0000 (22:17 +0100)
committerDavid Bauer <mail@david-bauer.net>
Thu, 7 Dec 2023 20:42:09 +0000 (21:42 +0100)
target/linux/mediatek/dts/mt7981b-glinet-gl-x3000.dts [new file with mode: 0644]
target/linux/mediatek/filogic/base-files/etc/board.d/02_network
target/linux/mediatek/image/filogic.mk

diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-x3000.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-x3000.dts
new file mode 100644 (file)
index 0000000..14e67c6
--- /dev/null
@@ -0,0 +1,258 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+
+/dts-v1/;
+#include "mt7981.dtsi"
+
+/ {
+       model = "GL.iNet GL-X3000";
+       compatible = "glinet,gl-x3000", "mediatek,mt7981";
+
+       aliases {
+               label-mac-device = &gmac0;
+               led-boot = &led_power;
+               led-failsafe = &led_power;
+               led-running = &led_power;
+               led-upgrade = &led_power;
+               serial0 = &uart0;
+       };
+
+       chosen {
+               stdout-path = "serial0:115200n8";
+               bootargs-append = " root=PARTLABEL=rootfs rootwait";
+       };
+
+       gpio-keys {
+               compatible = "gpio-keys";
+
+               reset {
+                       label = "reset";
+                       linux,code = <KEY_RESTART>;
+                       gpios = <&pio 1 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       leds {
+               compatible = "gpio-leds";
+
+               led_power: led-power-white {
+                       label = "white:power";
+                       gpios = <&pio 39 GPIO_ACTIVE_LOW>;
+               };
+
+               led-internet {
+                       label = "white:internet";
+                       gpios = <&pio 31 GPIO_ACTIVE_LOW>;
+               };
+
+               led-wlan-2g {
+                       label = "white:wlan-2g";
+                       gpios = <&pio 30 GPIO_ACTIVE_LOW>;
+               };
+
+               led-wlan-5g {
+                       label = "white:wlan-5g";
+                       gpios = <&pio 38 GPIO_ACTIVE_LOW>;
+               };
+
+               led-cellular-1 {
+                       label = "white:cellular-1";
+                       gpios = <&pio 6 GPIO_ACTIVE_LOW>;
+               };
+
+               led-cellular-2 {
+                       label = "white:cellular-2";
+                       gpios = <&pio 7 GPIO_ACTIVE_LOW>;
+               };
+
+               led-cellular-3 {
+                       label = "white:cellular-3";
+                       gpios = <&pio 8 GPIO_ACTIVE_LOW>;
+               };
+
+               led-cellular-4 {
+                       label = "white:cellular-4";
+                       gpios = <&pio 4 GPIO_ACTIVE_LOW>;
+               };
+       };
+
+       gpio-export {
+               compatible = "gpio-export";
+
+               usb-power {
+                       gpio-export,name = "usb-power";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 12 GPIO_ACTIVE_HIGH>;
+               };
+
+               hub-power {
+                       gpio-export,name = "hub-power";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 5 GPIO_ACTIVE_HIGH>;
+               };
+
+               cellular-power {
+                       gpio-export,name = "cellular-power";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 11 GPIO_ACTIVE_HIGH>;
+               };
+
+               cellular-control {
+                       gpio-export,name = "cellular-control";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 9 GPIO_ACTIVE_HIGH>;
+               };
+
+               cellular-reset {
+                       gpio-export,name = "cellular-reset";
+                       gpio-export,output = <0x00>;
+                       gpios = <&pio 10 GPIO_ACTIVE_HIGH>;
+               };
+
+               thread-reset {
+                       gpio-export,name = "thread-reset";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 26 GPIO_ACTIVE_HIGH>;
+               };
+
+               thread-dfu {
+                       gpio-export,name = "thread-dfu";
+                       gpio-export,output = <1>;
+                       gpios = <&pio 27 GPIO_ACTIVE_HIGH>;
+               };
+       };
+
+       reg_3p3v: regulator-3p3v {
+               compatible = "regulator-fixed";
+               regulator-name = "fixed-3.3V";
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;
+       };
+
+       fan_5v: regulator-fan-5v {
+               compatible = "regulator-fixed";
+               regulator-name = "fan";
+               regulator-min-microvolt = <5000000>;
+               regulator-max-microvolt = <5000000>;
+               gpio = <&pio 28 GPIO_ACTIVE_HIGH>;
+               enable-active-high;
+               regulator-boot-on;
+       };
+};
+
+&pwm {
+       pinctrl-names = "default";
+       pinctrl-0 = <&pwm_pins>;
+
+       status = "okay";
+};
+
+&fan {
+       pwms = <&pwm 0 40000 0>;
+       fan-supply = <&fan_5v>;
+       interrupt-parent = <&pio>;
+       interrupts = <29 IRQ_TYPE_EDGE_RISING>;
+       status = "okay";
+};
+
+&pio {
+       mmc0_pins_default: mmc0-pins-default {
+               mux {
+                       function = "flash";
+                       groups = "emmc_45";
+               };
+       };
+       
+       mmc0_pins_uhs: mmc0-pins-uhs {
+               mux {
+                       function = "flash";
+                       groups = "emmc_45";
+               };
+       };
+
+       pwm_pins: pwm0-pins {
+               mux {
+                       function = "pwm";
+                       groups = "pwm0_1";
+               };
+       };
+
+       pcie_pins: pcie-pins {
+               mux {
+                       function = "pcie";
+                       groups = "pcie_pereset", "pcie_clk", "pcie_wake";
+               };
+       };
+};
+
+&uart0 {
+       status = "okay";
+};
+
+&watchdog {
+       status = "okay";
+};
+
+&eth {
+       status = "okay";
+
+       pinctrl-names = "default";
+       pinctrl-0 = <&mdio_pins>;
+
+       gmac0: mac@0 {
+               compatible = "mediatek,eth-mac";
+               reg = <0>;
+
+               phy-mode = "2500base-x";
+               phy-handle = <&phy5>;
+       };
+
+       gmac1: mac@1 {
+               compatible = "mediatek,eth-mac";
+               reg = <1>;
+               phy-mode = "gmii";
+               phy-handle = <&int_gbe_phy>;
+       };
+};
+
+&mdio_bus {
+       reset-gpios = <&pio 14 GPIO_ACTIVE_LOW>;
+       reset-delay-us = <600>;
+       reset-post-delay-us = <20000>;
+
+       phy5: ethernet-phy@5 {
+               reg = <5>;
+               compatible = "ethernet-phy-ieee802.3-c45";
+       };
+};
+
+&usb_phy {
+       status = "okay";
+};
+
+&xhci {
+       status = "okay";
+};
+
+&mmc0 {
+       status = "okay";
+
+       pinctrl-names = "default", "state_uhs";
+       pinctrl-0 = <&mmc0_pins_default>;
+       pinctrl-1 = <&mmc0_pins_uhs>;
+       bus-width = <8>;
+       max-frequency = <52000000>;
+       vmmc-supply = <&reg_3p3v>;
+       cap-mmc-highspeed;
+       non-removable;
+};
+
+&pcie {
+       /* ToDo: Fix upstream DTS? */
+       compatible = "mediatek,mt7981-pcie",
+                    "mediatek,mt8192-pcie";
+       pinctrl-names = "default";
+       pinctrl-0 = <&pcie_pins>;
+       status = "okay";
+};
index 275a322a651837dab742392d80b297e4729c725b..bb4d6c580c2e0f0961a08a5b623f287c4acbbadd 100644 (file)
@@ -34,7 +34,8 @@ mediatek_setup_interfaces()
                ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
                ;;
        glinet,gl-mt2500|\
-       glinet,gl-mt3000)
+       glinet,gl-mt3000|\
+       glinet,gl-x3000)
                ucidef_set_interfaces_lan_wan eth1 eth0
                ;;
        glinet,gl-mt6000|\
index edee317fdf33c5db4b175264ec3624c9bee92805..9df82221ca5e6bc3906d115c06b10d5027a539a9 100644 (file)
@@ -334,6 +334,19 @@ define Device/glinet_gl-mt6000
 endef
 TARGET_DEVICES += glinet_gl-mt6000
 
+define Device/glinet_gl-x3000
+  DEVICE_VENDOR := GL.iNet
+  DEVICE_MODEL := GL-X3000
+  DEVICE_DTS := mt7981b-glinet-gl-x3000
+  DEVICE_DTS_DIR := ../dts
+  DEVICE_PACKAGES := e2fsprogs f2fsck mkf2fs kmod-usb3 kmod-usb-serial-option kmod-usb-net-qmi-wwan uqmi \
+       kmod-mhi-bus-pci-generic kmod-mhi-bus-ep kmod-mhi-wwan-mbim kmod-mhi-wwan-ctrl
+  SUPPORTED_DEVICES += glinet,x3000-emmc
+  IMAGES := sysupgrade.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
+endef
+TARGET_DEVICES += glinet_gl-x3000
+
 define Device/h3c_magic-nx30-pro
   DEVICE_VENDOR := H3C
   DEVICE_MODEL := Magic NX30 Pro