123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- From 12396686484a488dff1c4a1ee8b5197c552572fe Mon Sep 17 00:00:00 2001
- From: David Bauer <[email protected]>
- Date: Thu, 20 Apr 2023 19:49:55 +0200
- Subject: [PATCH] mediatek: add support for GL.iNet GL-MT2500
- Hardware
- --------
- SoC: MediaTek MT7981BA
- RAM: 1GB DDR4 (NANYA NT5AD512M16C4-JR)
- MMC: 8GB eMMC (Samsung 8GTF4R)
- ETH: 1000Base-T LAN (ePHY)
- 2500Base-T WAN (MaxLinear GPY211C)
- BTN: 1x Reset Button
- LED: System (blue/white)
- VPN (white)
- USB: 1x USB-A (USB 3.0)
- UART: 115200 8N1 - Pinout on board next to LAN port
- Don't connect 3.3V!
- Known Issues
- ------------
- U-Boot vendor recovery does not seem to accept any images, neither
- GL.iNet images nor OpenWrt images. Recovery requires serial access!
- Installation
- ------------
- Upload the OpenWrt sysupgrade image to the Gl.iNet Web-UI. Make sure to
- not retain existing settings.
- Signed-off-by: David Bauer <[email protected]>
- ---
- .../uboot-envtools/files/mediatek_filogic | 4 +
- .../mediatek/dts/mt7981b-glinet-gl-mt2500.dts | 151 ++++++++++++++++++
- .../filogic/base-files/etc/board.d/02_network | 6 +
- .../base-files/lib/upgrade/platform.sh | 2 +
- target/linux/mediatek/image/filogic.mk | 17 ++
- 5 files changed, 180 insertions(+)
- create mode 100644 target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
- diff --git a/package/boot/uboot-envtools/files/mediatek_filogic b/package/boot/uboot-envtools/files/mediatek_filogic
- index ae8e1589a024b..4d37828f1db95 100644
- --- a/package/boot/uboot-envtools/files/mediatek_filogic
- +++ b/package/boot/uboot-envtools/files/mediatek_filogic
- @@ -74,6 +74,10 @@ xiaomi,redmi-router-ax6000-ubootmod)
- ubootenv_add_uci_config "$envdev" "0x0" "0x1f000" "0x20000" "1"
- ubootenv_add_uci_config "$envdev2" "0x0" "0x1f000" "0x20000" "1"
- ;;
- +glinet,gl-mt2500)
- + local envdev=$(find_mmc_part "u-boot-env")
- + ubootenv_add_uci_config "$envdev" "0x400000" "0x80000"
- + ;;
- glinet,gl-mt3000)
- ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x80000" "0x20000"
- ;;
- diff --git a/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
- new file mode 100644
- index 0000000000000..068dd0f236e28
- --- /dev/null
- +++ b/target/linux/mediatek/dts/mt7981b-glinet-gl-mt2500.dts
- @@ -0,0 +1,151 @@
- +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
- +
- +/dts-v1/;
- +#include "mt7981.dtsi"
- +
- +/ {
- + model = "GL.iNet GL-MT2500";
- + compatible = "glinet,gl-mt2500", "mediatek,mt7981";
- +
- + aliases {
- + label-mac-device = &gmac0;
- + led-boot = &led_sys_white;
- + led-failsafe = &led_sys_blue;
- + led-running = &led_sys_white;
- + led-upgrade = &led_sys_blue;
- + 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-vpn {
- + label = "white:vpn";
- + gpios = <&pio 31 GPIO_ACTIVE_LOW>;
- + };
- +
- + led_sys_white: led-system-white {
- + label = "white:system";
- + gpios = <&pio 30 GPIO_ACTIVE_LOW>;
- + };
- +
- + led_sys_blue: led-system-blue {
- + label = "blue:system";
- + gpios = <&pio 29 GPIO_ACTIVE_LOW>;
- + };
- + };
- +
- + usb_vbus: regulstor-usb {
- + compatible = "regulator-fixed";
- +
- + regulator-name = "usb-vbus";
- + regulator-min-microvolt = <5000000>;
- + regulator-max-microvolt = <5000000>;
- +
- + gpio = <&pio 12 GPIO_ACTIVE_HIGH>;
- + enable-active-high;
- + regulator-boot-on;
- + };
- +
- + 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;
- + };
- +};
- +
- +&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";
- + };
- + };
- +};
- +
- +&uart0 {
- + status = "okay";
- +};
- +
- +&watchdog {
- + status = "okay";
- +};
- +
- +ð {
- + 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";
- + vbus-supply = <&usb_vbus>;
- +};
- +
- +&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 = <®_3p3v>;
- + cap-mmc-highspeed;
- + non-removable;
- +};
- diff --git a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
- index 5153c156f65bd..0675e87853ac7 100644
- --- a/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
- +++ b/target/linux/mediatek/filogic/base-files/etc/board.d/02_network
- @@ -32,6 +32,7 @@ mediatek_setup_interfaces()
- h3c,magic-nx30-pro)
- ucidef_set_interfaces_lan_wan "lan1 lan2 lan3" eth1
- ;;
- + glinet,gl-mt2500|\
- glinet,gl-mt3000)
- ucidef_set_interfaces_lan_wan eth1 eth0
- ;;
- @@ -109,6 +110,11 @@ mediatek_setup_macs()
- ;;
- esac
- ;;
- + glinet,gl-mt2500)
- + label_mac="$(get_mac_binary "/dev/mmcblk0boot1" 0xA)"
- + wan_mac="$label_mac"
- + lan_mac="$(macaddr_add $label_mac 1)"
- + ;;
- glinet,gl-mt6000)
- label_mac=$(mmc_get_mac_binary factory 0x0a)
- wan_mac=$label_mac
- diff --git a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
- index 3c278d5faf2c4..6130768cb4c66 100755
- --- a/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
- +++ b/target/linux/mediatek/filogic/base-files/lib/upgrade/platform.sh
- @@ -97,6 +97,7 @@ platform_do_upgrade() {
- default_do_upgrade "$1"
- ;;
- cmcc,rax3000m-emmc|\
- + glinet,gl-mt2500|\
- glinet,gl-mt6000)
- CI_KERNPART="kernel"
- CI_ROOTPART="rootfs"
- @@ -176,6 +177,7 @@ platform_copy_config() {
- esac
- ;;
- cmcc,rax3000m-emmc|\
- + glinet,gl-mt2500|\
- glinet,gl-mt6000|\
- ubnt,unifi-6-plus)
- emmc_copy_config
- diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
- index 4886db11419e5..a0a5f944a8f69 100644
- --- a/target/linux/mediatek/image/filogic.mk
- +++ b/target/linux/mediatek/image/filogic.mk
- @@ -274,6 +274,19 @@ define Device/cudy_wr3000-v1
- endef
- TARGET_DEVICES += cudy_wr3000-v1
-
- +define Device/glinet_gl-mt2500
- + DEVICE_VENDOR := GL.iNet
- + DEVICE_MODEL := GL-MT2500
- + DEVICE_DTS := mt7981b-glinet-gl-mt2500
- + DEVICE_DTS_DIR := ../dts
- + DEVICE_DTS_LOADADDR := 0x47000000
- + DEVICE_PACKAGES := -kmod-mt7915e -wpad-basic-mbedtls e2fsprogs f2fsck mkf2fs kmod-usb3
- + SUPPORTED_DEVICES += glinet,mt2500-emmc
- + IMAGES := sysupgrade.bin
- + IMAGE/sysupgrade.bin := sysupgrade-tar | append-gl-metadata
- +endef
- +TARGET_DEVICES += glinet_gl-mt2500
- +
- define Device/glinet_gl-mt3000
- DEVICE_VENDOR := GL.iNet
- DEVICE_MODEL := GL-MT3000
|