gl-infra-builder-FUjr/patches-22.03.4/4009-GL-MT300N-V2-adapted-to-GL.iNet-SDK-4.X.patch
2023-06-06 19:00:03 +08:00

139 lines
4.0 KiB
Diff

From 426d9268f3288f1f05eba8cecdfd13f5acdad127 Mon Sep 17 00:00:00 2001
From: Jianhui Zhao <jianhui.zhao@gl-inet.com>
Date: Mon, 8 May 2023 09:07:27 +0800
Subject: [PATCH] GL-MT300N-V2: adapted to GL.iNet SDK 4.X
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
---
package/boot/uboot-envtools/files/ramips | 1 +
.../dts/mt7628an_glinet_gl-mt300n-v2.dts | 47 +++++++++++++++----
target/linux/ramips/image/mt76x8.mk | 3 +-
.../mt76x8/base-files/etc/board.d/01_leds | 2 +-
4 files changed, 43 insertions(+), 10 deletions(-)
diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index f512015c23..2ed394ef40 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -24,6 +24,7 @@ sitecom,wlr-4100-v1-002)
allnet,all0256n-4m|\
allnet,all0256n-8m|\
allnet,all5002|\
+glinet,gl-mt300n-v2|\
yuncore,ax820)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
;;
diff --git a/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts b/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts
index 48f0fbd92b..d747227778 100644
--- a/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts
+++ b/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts
@@ -8,13 +8,34 @@
model = "GL-MT300N-V2";
aliases {
- led-boot = &led_power;
- led-failsafe = &led_power;
- led-running = &led_power;
- led-upgrade = &led_power;
+ //led-boot = &led_power;
+ //led-failsafe = &led_power;
+ //led-running = &led_power;
+ //led-upgrade = &led_power;
label-mac-device = &ethernet;
};
+ gl_hw {
+ compatible = "gl-hw-info";
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "mt300n-v2";
+ wan = "eth0.2";
+ lan = "eth0.1";
+ reset-button = "gpio-38";
+ switch-button = "gpio-0";
+ flash_size = <16>;
+ radio = "mt7628";
+ usb-port = "1-1";
+ factory_data {
+ device_mac = "factory", "0x4000";
+ device_ddns = "factory", "0x4010";
+ device_sn_bak = "factory", "0x4020";
+ device_sn = "factory", "0x4030";
+ country_code = "factory", "0x4048";
+ };
+ };
+
chosen {
bootargs = "console=ttyS0,115200";
};
@@ -48,10 +69,10 @@
linux,code = <KEY_RESTART>;
};
- BTN_0 {
- label = "BTN_0";
+ switch {
+ label = "switch";
gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
- linux,code = <BTN_0>;
+ linux,code = <KEY_SETUP>;
};
BTN_1 {
@@ -125,7 +146,12 @@
partition@50000 {
compatible = "denx,uimage";
label = "firmware";
- reg = <0x50000 0xfb0000>;
+ reg = <0x50000 0xf90000>;
+ };
+
+ partition@fe0000 {
+ label = "log";
+ reg = <0xfe0000 0x20000>;
};
};
};
@@ -135,6 +161,11 @@
status = "okay";
};
+&esw {
+ mediatek,portmap = <0x3e>;
+ mediatek,portdisable = <0x3c>;
+};
+
&factory {
compatible = "nvmem-cells";
#address-cells = <1>;
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 2106324684..4d12c9aee8 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -182,7 +182,8 @@ define Device/glinet_gl-mt300n-v2
DEVICE_MODEL := GL-MT300N
DEVICE_VARIANT := V2
DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci
- SUPPORTED_DEVICES += gl-mt300n-v2
+ OLD_SUPPORTED_DEVICES += gl-mt300n-v2
+ IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-gl-metadata
endef
TARGET_DEVICES += glinet_gl-mt300n-v2
diff --git a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
index 0af01d4393..28bcca5b1c 100644
--- a/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/mt76x8/base-files/etc/board.d/01_leds
@@ -36,7 +36,7 @@ elecom,wrc-1167fs)
ucidef_set_led_switch "internet" "internet" "green:internet" "switch0" "0x10"
;;
glinet,gl-mt300n-v2)
- ucidef_set_led_netdev "wifi_led" "wifi" "red:wlan" "wlan0"
+ ucidef_set_led_netdev "wifi_led" "wifi" "red:wlan" "ra0"
ucidef_set_led_switch "wan" "wan" "green:wan" "switch0" "0x1"
;;
hilink,hlk-7628n|\
--
2.25.1