[openwrt/openwrt] mediatek: filogic: add Keenetic Sprinter (KN-3711) support
LEDE Commits
lede-commits at lists.infradead.org
Thu Sep 18 14:18:41 PDT 2025
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/9241f29c0eed40d16f7eb913ef3514e59a0f704c
commit 9241f29c0eed40d16f7eb913ef3514e59a0f704c
Author: Vladimir Epifantsev <volatilefield at outlook.com>
AuthorDate: Sat Sep 6 20:01:34 2025 +0300
mediatek: filogic: add Keenetic Sprinter (KN-3711) support
Specification:
SoC: Mediatek MT7981BA
RAM: 512 MB DDR4 RAM
Flash: Winbond W25N01GV 128 MB SPI-NAND (dual boot on OEM)
WiFi: MT7976CN DBDC AX
Switch: MediaTek MT7531AE (3x LAN Gigabit ports) + Internal Gbe Phy (1x WAN Gigabit port)
GPIO: 4x LED (power, internet, fn, wifi), 2x buttons (wps, reset), 1x switch (mesh)
UART Interface:
Pins: VCC, TX, RX, NC, GND
Settings: 115200, 8N1
Flashing via TFTP:
1. Connect your PC and router to the first LAN port, configure PC interface using IP 192.168.1.2, mask 255.255.255.0
2. Save the factory image of the OpenWRT firmware, renamed to KN-3711_recovery.bin, on the TFTP server
3. Hold the reset button and power up the device
4. Keep the button pressed until the status LED starts blinking
Signed-off-by: Vladimir Epifantsev <volatilefield at outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19633
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
.../mediatek/dts/mt7981b-keenetic-kn-3711.dts | 329 +++++++++++++++++++++
.../filogic/base-files/etc/board.d/02_network | 1 +
.../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 1 +
target/linux/mediatek/image/filogic.mk | 20 ++
4 files changed, 351 insertions(+)
diff --git a/target/linux/mediatek/dts/mt7981b-keenetic-kn-3711.dts b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3711.dts
new file mode 100755
index 0000000000..f18483542c
--- /dev/null
+++ b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3711.dts
@@ -0,0 +1,329 @@
+// SPDX-License-Identifier: GPL-2.0-only OR MIT
+
+/dts-v1/;
+
+#include "mt7981b.dtsi"
+
+/ {
+ model = "Keenetic KN-3711";
+ compatible = "keenetic,kn-3711", "mediatek,mt7981";
+
+ aliases {
+ label-mac-device = &gmac0;
+ led-boot = &power_led;
+ led-failsafe = &power_led;
+ led-running = &power_led;
+ led-upgrade = &power_led;
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ gpio-keys {
+ compatible = "gpio-keys";
+
+ switch-fn {
+ label = "fn";
+ gpios = <&pio 0 GPIO_ACTIVE_LOW>;
+ linux,code = <BTN_0>;
+ linux,input-type = <EV_SW>;
+ };
+
+ button-reset {
+ label = "reset";
+ gpios = <&pio 24 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_RESTART>;
+ };
+
+ button-wps {
+ label = "wps";
+ gpios = <&pio 29 GPIO_ACTIVE_LOW>;
+ linux,code = <KEY_WPS_BUTTON>;
+ };
+ };
+
+ gpio-leds {
+ compatible = "gpio-leds";
+
+ power_led: led-0 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_POWER;
+ gpios = <&pio 11 GPIO_ACTIVE_HIGH>;
+ };
+
+ led-1 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WAN;
+ gpios = <&pio 12 GPIO_ACTIVE_LOW>;
+ };
+
+ led-2 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = "fn";
+ gpios = <&pio 9 GPIO_ACTIVE_LOW>;
+ };
+
+ led-3 {
+ color = <LED_COLOR_ID_GREEN>;
+ function = LED_FUNCTION_WLAN_2GHZ;
+ gpios = <&pio 34 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0tpt";
+ };
+ };
+
+ virtual_flash {
+ compatible = "mtd-concat";
+ devices = <&firmware1 &firmware2>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition at 0 {
+ label = "kernel";
+ reg = <0x0 0x600000>;
+ };
+
+ partition at 600000 {
+ label = "ubi";
+ reg = <0x600000 0x06000000>;
+ };
+ };
+ };
+};
+
+&uart0 {
+ status = "okay";
+};
+
+ð {
+ status = "okay";
+
+ gmac0: mac at 0 {
+ compatible = "mediatek,eth-mac";
+ reg = <0>;
+ phy-mode = "2500base-x";
+
+ nvmem-cell-names = "mac-address";
+ nvmem-cells = <&macaddr_factory_4>;
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+
+ mac at 1 {
+ compatible = "mediatek,eth-mac";
+ reg = <1>;
+ phy-mode = "gmii";
+ phy-handle = <&int_gbe_phy>;
+ label = "wan";
+
+ nvmem-cell-names = "mac-address";
+ nvmem-cells = <&macaddr_factory_a>;
+ };
+};
+
+&mdio_bus {
+ switch at 1f {
+ compatible = "mediatek,mt7531";
+ reg = <0x1f>;
+ reset-gpios = <&pio 22 GPIO_ACTIVE_HIGH>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+ interrupt-parent = <&pio>;
+ interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port at 0 {
+ reg = <0>;
+ label = "lan1";
+ };
+
+ port at 1 {
+ reg = <1>;
+ label = "lan2";
+ };
+
+ port at 2 {
+ reg = <2>;
+ label = "lan3";
+ };
+
+ port at 6 {
+ reg = <6>;
+ label = "cpu";
+ ethernet = <&gmac0>;
+ phy-mode = "2500base-x";
+
+ fixed-link {
+ speed = <2500>;
+ full-duplex;
+ pause;
+ };
+ };
+ };
+ };
+};
+
+&pio {
+ spi0_flash_pins: spi0-pins {
+ mux {
+ function = "spi";
+ groups = "spi0", "spi0_wp_hold";
+ };
+
+ conf-pu {
+ pins = "SPI0_CS", "SPI0_HOLD", "SPI0_WP";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-up = <MTK_PUPD_SET_R1R0_11>;
+ };
+
+ conf-pd {
+ pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO";
+ drive-strength = <MTK_DRIVE_8mA>;
+ bias-pull-down = <MTK_PUPD_SET_R1R0_11>;
+ };
+ };
+};
+
+&spi0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&spi0_flash_pins>;
+ status = "okay";
+
+ /* Winbond W25N01GV SPI NAND (128 MiB) */
+ spi_nand at 0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "spi-nand";
+ reg = <0>;
+
+ spi-max-frequency = <52000000>;
+ spi-tx-buswidth = <4>;
+ spi-rx-buswidth = <4>;
+
+ spi-cal-enable;
+ spi-cal-mode = "read-data";
+ spi-cal-datalen = <7>;
+ spi-cal-data = /bits/ 8 <0x53 0x50 0x49 0x4e 0x41 0x4e 0x44>;
+ spi-cal-addrlen = <5>;
+ spi-cal-addr = /bits/ 32 <0x0 0x0 0x0 0x0 0x0>;
+
+ mediatek,nmbm;
+ mediatek,bmt-max-ratio = <1>;
+ mediatek,bmt-max-reserved-blocks = <64>;
+
+ partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ /* bl2 */
+ partition at 0 {
+ label = "preloader";
+ reg = <0x0 0x80000>;
+ read-only;
+ };
+
+ /* fip */
+ partition at 80000 {
+ label = "u-boot";
+ reg = <0x80000 0x200000>;
+ read-only;
+ };
+
+ partition at 280000 {
+ label = "u-config";
+ reg = <0x280000 0x80000>;
+ read-only;
+ };
+
+ partition at 300000 {
+ label = "rf-eeprom";
+ reg = <0x300000 0x200000>;
+ read-only;
+
+ nvmem-layout {
+ compatible = "fixed-layout";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ eeprom_factory_0: eeprom at 0 {
+ reg = <0x0 0x1000>;
+ };
+
+ /* lan mac */
+ macaddr_factory_4: macaddr at 4 {
+ reg = <0x4 0x6>;
+ };
+
+ /* wan mac */
+ macaddr_factory_a: macaddr at a {
+ reg = <0xa 0x6>;
+ };
+ };
+ };
+
+ firmware1: partition at 500000 {
+ label = "firmware_1";
+ reg = <0x500000 0x3500000>;
+ };
+
+ partition at 3a00000 {
+ label = "config_1";
+ reg = <0x3a00000 0x80000>;
+ read-only;
+ };
+
+ partition at 3a80000 {
+ label = "dump";
+ reg = <0x3a80000 0x80000>;
+ read-only;
+ };
+
+ partition at 3c00000 {
+ label = "u-state";
+ reg = <0x3c00000 0x20000>;
+ read-only;
+ };
+
+ partition at 3e80000 {
+ label = "u-config_res";
+ reg = <0x3e80000 0x80000>;
+ read-only;
+ };
+
+ partition at 3f00000 {
+ label = "rf-eeprom_res";
+ reg = <0x3f00000 0x200000>;
+ read-only;
+ };
+
+ firmware2: partition at 4100000 {
+ label = "firmware_2";
+ reg = <0x4100000 0x3500000>;
+ };
+
+ partition at 7600000 {
+ label = "config_2";
+ reg = <0x7600000 0x80000>;
+ read-only;
+ };
+ };
+ };
+};
+
+&wifi {
+ nvmem-cell-names = "eeprom";
+ nvmem-cells = <&eeprom_factory_0>;
+ status = "okay";
+};
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 b8c59a2490..a8c4565af0 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
@@ -46,6 +46,7 @@ mediatek_setup_interfaces()
creatlentem,clt-r30b1-112m|\
cudy,wr3000-v1|\
jcg,q30-pro|\
+ keenetic,kn-3711|\
keenetic,kn-3811|\
qihoo,360t7|\
routerich,ax3000|\
diff --git a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
index b0db1c0de7..819fa44b93 100644
--- a/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
+++ b/target/linux/mediatek/filogic/base-files/etc/hotplug.d/ieee80211/11_fix_wifi_mac
@@ -141,6 +141,7 @@ case "$board" in
jdcloud,re-cp-03)
[ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress
;;
+ keenetic,kn-3711|\
keenetic,kn-3811|\
keenetic,kn-3911)
[ "$PHYNBR" = "1" ] && \
diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk
index 69efad0c77..3bdb20c0ea 100644
--- a/target/linux/mediatek/image/filogic.mk
+++ b/target/linux/mediatek/image/filogic.mk
@@ -1362,6 +1362,26 @@ define Device/jdcloud_re-cp-03
endef
TARGET_DEVICES += jdcloud_re-cp-03
+define Device/keenetic_kn-3711
+ DEVICE_VENDOR := Keenetic
+ DEVICE_MODEL := KN-3711
+ DEVICE_DTS := mt7981b-keenetic-kn-3711
+ DEVICE_DTS_DIR := ../dts
+ DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware
+ UBINIZE_OPTS := -E 5
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ KERNEL_SIZE := 6144k
+ IMAGE_SIZE := 108544k
+ KERNEL := kernel-bin | lzma | fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb | \
+ append-squashfs4-fakeroot
+ IMAGES += factory.bin
+ IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \
+ append-ubi | check-size | zyimage -d 0x803711 -v "KN-3711"
+ IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+endef
+TARGET_DEVICES += keenetic_kn-3711
+
define Device/keenetic_kn-3811
DEVICE_VENDOR := Keenetic
DEVICE_MODEL := KN-3811
More information about the lede-commits
mailing list