From d93b6a2bc23fe3842d2292326dbec5ff91c70259 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Mon, 3 Jun 2024 18:52:49 +0300 Subject: [PATCH 1/7] ramips: move zyimage creation to include/image-commands.mk This is required for upcoming Keenetic KN-3911 support Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/16830 (cherry picked from commit 79db5d65ca5a19fb37e7fb428dec798f713a8632) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- include/image-commands.mk | 4 ++++ target/linux/ramips/image/Makefile | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/image-commands.mk b/include/image-commands.mk index 2568fb3ade..a627ffc202 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -732,6 +732,10 @@ define Build/zip rm -rf $@.tmp endef +define Build/zyimage + $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ +endef + define Build/zyxel-ras-image let \ newsize="$(call exp_units,$(RAS_ROOTFS_SIZE))"; \ diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index 5697176943..53b9c314ef 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -167,10 +167,6 @@ define Build/wrg-header mv $@.new $@ endef -define Build/zyimage - $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ -endef - define Device/Default PROFILES = Default BLOCKSIZE := 64k From 13e91178616ba4cacb1300aab536ce15d70b88d3 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Thu, 31 Oct 2024 12:27:54 +0300 Subject: [PATCH 2/7] mediatek/filogic: enable mtd virtual concat support This is required for upcoming Keenetic KN-3911 support Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/16830 (cherry picked from commit 0d651dd302cf2b6968268f27a084363b9b398760) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- target/linux/mediatek/filogic/config-6.6 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/mediatek/filogic/config-6.6 b/target/linux/mediatek/filogic/config-6.6 index 8b8444175d..a450de2e79 100644 --- a/target/linux/mediatek/filogic/config-6.6 +++ b/target/linux/mediatek/filogic/config-6.6 @@ -272,6 +272,7 @@ CONFIG_MTD_UBI_BLOCK=y CONFIG_MTD_UBI_FASTMAP=y CONFIG_MTD_UBI_NVMEM=y CONFIG_MTD_UBI_WL_THRESHOLD=4096 +CONFIG_MTD_VIRT_CONCAT=y # CONFIG_MTK_CMDQ is not set CONFIG_MTK_CPUX_TIMER=y # CONFIG_MTK_CQDMA is not set From 895531f5c5e99c6013e1f23e6a708a7ed6ed841e Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Thu, 31 Oct 2024 10:30:08 +0300 Subject: [PATCH 3/7] mediatek/filogic: add Keenetic KN-3911 support Specification: - MT7981 CPU using 2.4GHz and 5GHz WiFi (both AX) - 512MB RAM - 128MB SPI NAND - 2 LEDs (green, orange) - 3 buttons (fn, reset, wps) - 2 2.5Gbit ethernet ports based on Airoha EN8811H phy Serial Interface: - 3 Pins GND, RX, TX - Settings: 115200, 8N1 Notes: - The device supports dual boot mode Flash instruction: The only way to flash OpenWrt image is to use tftp recovery mode in U-Boot: 1. Configure PC with static IP 192.168.1.2/24 and tftp server. 2. Rename "openwrt-mediatek-filogic-keenetic_kn-3911-squashfs-factory.bin" to "KN-3911_recovery.bin" and place it in tftp server directory. 3. Connect PC with ethernet port, press the reset button, power up the device and keep button pressed until status led start blinking. 4. Device will download file from server, write it to flash and reboot. Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/16830 (cherry picked from commit 5a4eb56a7bc7d1d8028d103d50b0dba2ff7808c4) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-keenetic-kn-3911.dts | 300 ++++++++++++++++++ .../filogic/base-files/etc/board.d/02_network | 13 +- .../etc/hotplug.d/ieee80211/11_fix_wifi_mac | 4 + target/linux/mediatek/image/filogic.mk | 20 ++ 4 files changed, 331 insertions(+), 6 deletions(-) create mode 100644 target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts diff --git a/target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts new file mode 100644 index 0000000000..8a9bf0f1a9 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3911.dts @@ -0,0 +1,300 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "Keenetic KN-3911"; + compatible = "keenetic,kn-3911", "mediatek,mt7981"; + + aliases { + label-mac-device = &gmac0; + led-boot = &status_led; + led-failsafe = &status_led; + led-running = &status_led; + led-upgrade = &status_led; + serial0 = &uart0; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + gpio-keys { + compatible = "gpio-keys"; + + button-fn { + label = "fn"; + linux,code = ; + gpios = <&pio 0 GPIO_ACTIVE_LOW>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 24 GPIO_ACTIVE_LOW>; + }; + + button-wps { + label = "wps"; + linux,code = ; + gpios = <&pio 29 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + status_led: led-0 { + color = ; + function = LED_FUNCTION_STATUS; + gpios = <&pio 11 GPIO_ACTIVE_HIGH>; + }; + + led-1 { + color = ; + function = LED_FUNCTION_WPS; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &firmware2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x600000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x600000 0x0>; + }; + }; + }; +}; + +&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 = <&phy10>; + label = "lan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 0>; + }; + + gmac1: mac@1 { + compatible = "mediatek,eth-mac"; + reg = <1>; + phy-mode = "2500base-x"; + phy-handle = <&phy11>; + label = "wan"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_a 0>; + }; +}; + +&mdio_bus { + phy10: ethernet-phy@a { + reg = <0xa>; + interrupt-parent = <&pio>; + interrupts = <38 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&pio 22 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <20000>; + }; + + phy11: ethernet-phy@b { + reg = <0xb>; + interrupt-parent = <&pio>; + interrupts = <23 IRQ_TYPE_EDGE_FALLING>; + reset-gpios = <&pio 27 GPIO_ACTIVE_LOW>; + reset-assert-us = <10000>; + reset-deassert-us = <20000>; + }; +}; + +&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 = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + /* Winbond W25N01GVZEIG (128M) */ + spi_nand@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@0 { + label = "preloader"; + reg = <0x0 0x80000>; + read-only; + }; + + /* fip */ + partition@80000 { + label = "u-boot"; + reg = <0x80000 0x200000>; + read-only; + }; + + partition@280000 { + label = "u-config"; + reg = <0x280000 0x80000>; + read-only; + }; + + partition@300000 { + label = "rf-eeprom"; + reg = <0x300000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + /* lan mac */ + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + + /* wan mac */ + macaddr_factory_a: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + firmware1: partition@500000 { + label = "firmware_1"; + reg = <0x500000 0x3500000>; + }; + + partition@3a00000 { + label = "config_1"; + reg = <0x3a00000 0x80000>; + read-only; + }; + + partition@3a80000 { + label = "dump"; + reg = <0x3a80000 0x80000>; + read-only; + }; + + partition@3c00000 { + label = "u-state"; + reg = <0x3c00000 0x20000>; + read-only; + }; + + partition@3e80000 { + label = "u-config_res"; + reg = <0x3e80000 0x80000>; + read-only; + }; + + partition@3f00000 { + label = "rf-eeprom_res"; + reg = <0x3f00000 0x200000>; + read-only; + }; + + firmware2: partition@4100000 { + label = "firmware_2"; + reg = <0x4140000 0x3500000>; + }; + + partition@7600000 { + label = "config_2"; + reg = <0x7600000 0x80000>; + read-only; + }; + }; + }; +}; + +&wifi { + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; + status = "okay"; +}; + +&sgmiisys0 { + /delete-node/ mediatek,pnswap; +}; 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 b9c149d072..7222040518 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 @@ -92,6 +92,13 @@ mediatek_setup_interfaces() dlink,aquila-pro-ai-m60-a1) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" internet ;; + keenetic,kn-3911|\ + smartrg,sdg-8622|\ + smartrg,sdg-8632|\ + smartrg,sdg-8733a|\ + yuncore,ax835) + ucidef_set_interfaces_lan_wan lan wan + ;; mediatek,mt7986a-rfb) ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4 lan6" "eth1 wan" ;; @@ -105,12 +112,6 @@ mediatek_setup_interfaces() mercusys,mr90x-v1-ubi) ucidef_set_interfaces_lan_wan "lan0 lan1 lan2" eth1 ;; - smartrg,sdg-8622|\ - smartrg,sdg-8632|\ - smartrg,sdg-8733a|\ - yuncore,ax835) - ucidef_set_interfaces_lan_wan lan wan - ;; tplink,tl-xdr6086|\ wavlink,wl-wn586x3) ucidef_set_interfaces_lan_wan "lan1 lan2" eth1 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 69e39f76fc..a161fb5827 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 @@ -112,6 +112,10 @@ case "$board" in jdcloud,re-cp-03) [ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress ;; + keenetic,kn-3911) + [ "$PHYNBR" = "1" ] && \ + macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress + ;; mercusys,mr90x-v1|\ tplink,re6000xd) addr=$(get_mac_binary "/tmp/tp_data/default-mac" 0) diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 135a954400..f6d898fa60 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -920,6 +920,26 @@ define Device/jdcloud_re-cp-03 endef TARGET_DEVICES += jdcloud_re-cp-03 +define Device/keenetic_kn-3911 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-3911 + DEVICE_DTS := mt7981b-keenetic-kn-3911 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-phy-airoha-en8811h + 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 0x803911 -v "KN-3911" + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += keenetic_kn-3911 + define Device/mediatek_mt7981-rfb DEVICE_VENDOR := MediaTek DEVICE_MODEL := MT7981 rfb From d7d560b84bebf4e194a487b2a729dc5814a34053 Mon Sep 17 00:00:00 2001 From: Maxim Anisimov Date: Wed, 13 Nov 2024 17:17:17 +0300 Subject: [PATCH 4/7] mediatek/filogic: add Keenetic KN-3811 support Specification: * Mediatek MT7981BA * 256 MB SPI-NAND * 512 MB DDR4 RAM * MT7976CN DBDC AX Wi-Fi * MediaTek MT7531AE (3x LAN Gigabit ports) + Internal Gbe Phy (1x WAN Gigabit port) * 4x LED (power, internet, fn, wifi) * 3x buttons (wps, fn, reset) * 1x USB 3.0 port Serial Interface: * 3 Pins GND, RX, TX * Settings: 115200, 8N1 Notes: * The device supports dual boot mode * Fn led reassigned to wlan 2.4 Flash instruction: The only way to flash OpenWrt image is to use tftp recovery mode in U-Boot: 1. Configure PC with static IP 192.168.1.2/24 and tftp server. 2. Rename "openwrt-mediatek-filogic-keenetic_kn-3811-squashfs-factory.bin" to "KN-3811_recovery.bin" and place it in tftp server directory. 3. Connect PC with ethernet port, press the reset button, power up the device and keep button pressed until status led start blinking. 4. Device will download file from server, write it to flash and reboot. Signed-off-by: Maxim Anisimov Link: https://github.com/openwrt/openwrt/pull/17135 (cherry picked from commit d087a79b7b03fe93a221fd6246ce437c5c5325c3) Link: https://github.com/openwrt/openwrt/pull/18055 Signed-off-by: Hauke Mehrtens --- .../mediatek/dts/mt7981b-keenetic-kn-3811.dts | 368 ++++++++++++++++++ .../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, 390 insertions(+) create mode 100644 target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts diff --git a/target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts new file mode 100644 index 0000000000..87043ec907 --- /dev/null +++ b/target/linux/mediatek/dts/mt7981b-keenetic-kn-3811.dts @@ -0,0 +1,368 @@ +// SPDX-License-Identifier: GPL-2.0-only OR MIT + +/dts-v1/; + +#include "mt7981.dtsi" + +/ { + model = "Keenetic KN-3811"; + compatible = "keenetic,kn-3811", "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"; + + button-fn { + label = "fn"; + linux,code = ; + gpios = <&pio 5 GPIO_ACTIVE_LOW>; + }; + + button-reset { + label = "reset"; + linux,code = ; + gpios = <&pio 24 GPIO_ACTIVE_LOW>; + }; + + button-wps { + label = "wps"; + linux,code = ; + gpios = <&pio 29 GPIO_ACTIVE_LOW>; + }; + }; + + gpio-leds { + compatible = "gpio-leds"; + + /* fn led reassigned to wlan 2.4 */ + led-0 { + color = ; + function = LED_FUNCTION_WLAN_2GHZ; + gpios = <&pio 9 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy0tpt"; + }; + + power_led: led-1 { + color = ; + function = LED_FUNCTION_POWER; + gpios = <&pio 11 GPIO_ACTIVE_HIGH>; + }; + + led-2 { + color = ; + function = LED_FUNCTION_WAN; + gpios = <&pio 12 GPIO_ACTIVE_LOW>; + }; + + led-3 { + color = ; + function = LED_FUNCTION_WLAN_5GHZ; + gpios = <&pio 34 GPIO_ACTIVE_LOW>; + linux,default-trigger = "phy1tpt"; + }; + }; + + usb_vbus: regulator-usb-vbus { + compatible = "regulator-fixed"; + regulator-name = "usb_vbus"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpios = <&pio 6 GPIO_ACTIVE_HIGH>; + enable-active-high; + regulator-boot-on; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware1 &storage1 &firmware2 &storage2>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x600000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x600000 0x0>; + }; + }; + }; +}; + +&uart0 { + status = "okay"; +}; + +&watchdog { + status = "okay"; +}; + +ð { + status = "okay"; + + gmac0: mac@0 { + compatible = "mediatek,eth-mac"; + reg = <0>; + phy-mode = "2500base-x"; + + nvmem-cell-names = "mac-address"; + nvmem-cells = <&macaddr_factory_4 0>; + + fixed-link { + speed = <2500>; + full-duplex; + pause; + }; + }; + + gmac1: mac@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 0>; + }; +}; + +&mdio_bus { + switch: switch@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>; + }; +}; + +&switch { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + label = "lan1"; + }; + + port@1 { + reg = <1>; + label = "lan2"; + }; + + port@2 { + reg = <2>; + label = "lan3"; + }; + + port@6 { + reg = <6>; + 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 = ; + bias-pull-up = ; + }; + + conf-pd { + pins = "SPI0_CLK", "SPI0_MOSI", "SPI0_MISO"; + drive-strength = ; + bias-pull-down = ; + }; + }; +}; + +&spi0 { + pinctrl-names = "default"; + pinctrl-0 = <&spi0_flash_pins>; + status = "okay"; + + /* Winbond W25N02KV (256M) */ + spi_nand@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@0 { + label = "preloader"; + reg = <0x0 0x80000>; + read-only; + }; + + /* fip */ + partition@80000 { + label = "u-boot"; + reg = <0x80000 0x200000>; + read-only; + }; + + partition@280000 { + label = "u-config"; + reg = <0x280000 0x80000>; + read-only; + }; + + partition@300000 { + label = "rf-eeprom"; + reg = <0x300000 0x200000>; + read-only; + + nvmem-layout { + compatible = "fixed-layout"; + #address-cells = <1>; + #size-cells = <1>; + + eeprom_factory_0: eeprom@0 { + reg = <0x0 0x1000>; + }; + + /* lan mac */ + macaddr_factory_4: macaddr@4 { + compatible = "mac-base"; + reg = <0x4 0x6>; + #nvmem-cell-cells = <1>; + }; + + /* wan mac */ + macaddr_factory_a: macaddr@a { + compatible = "mac-base"; + reg = <0xa 0x6>; + #nvmem-cell-cells = <1>; + }; + }; + }; + + firmware1: partition@500000 { + label = "firmware_1"; + reg = <0x500000 0x3a00000>; + }; + + partition@3f00000 { + label = "config_1"; + reg = <0x3f00000 0x80000>; + read-only; + }; + + partition@3f80000 { + label = "dump"; + reg = <0x3f80000 0x80000>; + read-only; + }; + + storage1: partition@4000000 { + label = "storage_a"; + reg = <0x4000000 0x3800000>; + }; + + partition@7800000 { + label = "u-state"; + reg = <0x7800000 0x20000>; + read-only; + }; + + partition@7a80000 { + label = "u-config_res"; + reg = <0x7a80000 0x80000>; + read-only; + }; + + partition@7b00000 { + label = "rf-eeprom_res"; + reg = <0x7b00000 0x200000>; + read-only; + }; + + firmware2: partition@7d00000 { + label = "firmware_2"; + reg = <0x7d00000 0x3a00000>; + }; + + partition@b700000 { + label = "config_2"; + reg = <0xb700000 0x80000>; + read-only; + }; + + storage2: partition@b780000 { + label = "storage_b"; + reg = <0xb780000 0x3880000>; + }; + }; + }; +}; + +&wifi { + nvmem-cell-names = "eeprom"; + nvmem-cells = <&eeprom_factory_0>; + status = "okay"; +}; + +&usb_phy { + status = "okay"; +}; + +&xhci { + status = "okay"; + vbus-supply = <&usb_vbus>; +}; 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 7222040518..b976463cff 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 @@ -33,6 +33,7 @@ mediatek_setup_interfaces() confiabits,mt7981|\ cudy,wr3000-v1|\ jcg,q30-pro|\ + keenetic,kn-3811|\ qihoo,360t7|\ routerich,ax3000|\ routerich,ax3000-ubootmod) 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 a161fb5827..a9d06f9b84 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 @@ -112,6 +112,7 @@ case "$board" in jdcloud,re-cp-03) [ "$PHYNBR" = "1" ] && mmc_get_mac_binary factory 0xa > /sys${DEVPATH}/macaddress ;; + keenetic,kn-3811|\ keenetic,kn-3911) [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary rf-eeprom 0x4)" > /sys${DEVPATH}/macaddress diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index f6d898fa60..e8a2888ee0 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -920,6 +920,26 @@ define Device/jdcloud_re-cp-03 endef TARGET_DEVICES += jdcloud_re-cp-03 +define Device/keenetic_kn-3811 + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-3811 + DEVICE_DTS := mt7981b-keenetic-kn-3811 + DEVICE_DTS_DIR := ../dts + DEVICE_PACKAGES := kmod-mt7915e kmod-mt7981-firmware mt7981-wo-firmware kmod-usb3 + UBINIZE_OPTS := -E 5 + BLOCKSIZE := 128k + PAGESIZE := 2048 + KERNEL_SIZE := 6144k + IMAGE_SIZE := 233984k + 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 0x803811 -v "KN-3811" + IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata +endef +TARGET_DEVICES += keenetic_kn-3811 + define Device/keenetic_kn-3911 DEVICE_VENDOR := Keenetic DEVICE_MODEL := KN-3911 From 1ec8d8ea5c320fb15ff351d53f3d78f5d2dfa4d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Feb 2025 08:04:50 +0100 Subject: [PATCH 5/7] kernel: r8125: update to v9.015.00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8125/compare/9.014.01...9.015.00 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit a8dea562aa6146f5955ef081ee3240f0b960edf9) --- package/kernel/r8125/Makefile | 4 ++-- ...0-r8125-print-link-speed-and-duplex-mode.patch | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/package/kernel/r8125/Makefile b/package/kernel/r8125/Makefile index 647630393a..232cf695b8 100644 --- a/package/kernel/r8125/Makefile +++ b/package/kernel/r8125/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8125 -PKG_VERSION:=9.014.01 +PKG_VERSION:=9.015.00 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8125/releases/download/$(PKG_VERSION) -PKG_HASH:=f006aa95501738ca55c522812c9d1b473ac781675f3ad88ce341a09316b8aa13 +PKG_HASH:=7d6906336c3ad960c3e7c0299ad655659d7110bdc933c5b568b7f2536cb8ffc3 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch index a3b3562149..449cc9a7e2 100644 --- a/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8125/patches/200-r8125-print-link-speed-and-duplex-mode.patch @@ -18,11 +18,12 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8125.h +++ b/src/r8125.h -@@ -1672,6 +1672,8 @@ enum RTL8125_register_content { +@@ -1687,6 +1687,9 @@ enum RTL8125_register_content { LinkStatus = 0x02, FullDup = 0x01, +#define RTL8125_FULL_DUPLEX_MASK (_2500bpsF | _1000bpsF | FullDup) ++#define RTL8125_SPEED_1000_MASK (_1000bpsF | _1000bpsL | _2500bpsL) + /* DBG_reg */ Fix_Nak_1 = (1 << 4), @@ -37,11 +38,11 @@ Signed-off-by: Álvaro Fernández Rojas #include #include #include -@@ -5116,6 +5117,38 @@ rtl8125_link_down_patch(struct net_devic +@@ -5023,6 +5024,38 @@ rtl8125_link_down_patch(struct net_devic #endif } -+static unsigned int rtl8125_phy_duplex(u16 status) ++static unsigned int rtl8125_phy_duplex(u32 status) +{ + unsigned int duplex = DUPLEX_UNKNOWN; + @@ -55,14 +56,14 @@ Signed-off-by: Álvaro Fernández Rojas + return duplex; +} + -+static int rtl8125_phy_speed(u16 status) ++static int rtl8125_phy_speed(u32 status) +{ + int speed = SPEED_UNKNOWN; + + if (status & LinkStatus) { + if (status & _2500bpsF) + speed = SPEED_2500; -+ else if (status & _1000bpsF) ++ else if (status & RTL8125_SPEED_1000_MASK) + speed = SPEED_1000; + else if (status & _100bps) + speed = SPEED_100; @@ -76,14 +77,14 @@ Signed-off-by: Álvaro Fernández Rojas static void _rtl8125_check_link_status(struct net_device *dev, unsigned int link_state) { -@@ -5128,11 +5161,18 @@ _rtl8125_check_link_status(struct net_de +@@ -5035,11 +5068,18 @@ _rtl8125_check_link_status(struct net_de if (link_state == R8125_LINK_STATE_ON) { rtl8125_link_on_patch(dev); - if (netif_msg_ifup(tp)) - printk(KERN_INFO PFX "%s: link up\n", dev->name); + if (netif_msg_ifup(tp)) { -+ const u16 phy_status = RTL_R16(tp, PHYstatus); ++ const u32 phy_status = RTL_R32(tp, PHYstatus); + const unsigned int phy_duplex = rtl8125_phy_duplex(phy_status); + const int phy_speed = rtl8125_phy_speed(phy_status); + printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n", From abd08419dea521e8fbb8479d67360c4972ba8fa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Feb 2025 08:06:27 +0100 Subject: [PATCH 6/7] kernel: r8126: update to v10.015.00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/rtl8126/compare/10.014.01...10.015.00 Signed-off-by: Álvaro Fernández Rojas (cherry picked from commit 3d3328bf5f019507896bfa9ffeb53777fc5bfeaa) --- package/kernel/r8126/Makefile | 4 ++-- ...8126-print-link-speed-and-duplex-mode.patch | 18 ++++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/package/kernel/r8126/Makefile b/package/kernel/r8126/Makefile index a8f60f9dbb..da43697bfb 100644 --- a/package/kernel/r8126/Makefile +++ b/package/kernel/r8126/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=r8126 -PKG_VERSION:=10.014.01 +PKG_VERSION:=10.015.00 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/openwrt/rtl8126/releases/download/$(PKG_VERSION) -PKG_HASH:=dbb10a7abd0972e4abd1b89ea4eb22fc55d6c1dc2f711b5acf4a3bc376275e21 +PKG_HASH:=fac513aa925264a95b053e7532fcda56022d29db288f6625fafee2759a8a6124 PKG_BUILD_PARALLEL:=1 PKG_LICENSE:=GPLv2 diff --git a/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch b/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch index 27b3d626c1..236f80c7fd 100644 --- a/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch +++ b/package/kernel/r8126/patches/200-r8126-print-link-speed-and-duplex-mode.patch @@ -18,11 +18,13 @@ Signed-off-by: Álvaro Fernández Rojas --- a/src/r8126.h +++ b/src/r8126.h -@@ -1740,6 +1740,8 @@ enum RTL8126_register_content { +@@ -1756,6 +1756,10 @@ enum RTL8126_register_content { LinkStatus = 0x02, FullDup = 0x01, +#define RTL8126_FULL_DUPLEX_MASK (_5000bpsF | _2500bpsF | _1000bpsF | FullDup) ++#define RTL8126_SPEED_1000_MASK (_1000bpsF | _1000bpsL | _2500bpsL) ++#define RTL8126_SPEED_2500_MASK (_2500bpsF | _5000bpsL) + /* DBG_reg */ Fix_Nak_1 = (1 << 4), @@ -37,11 +39,11 @@ Signed-off-by: Álvaro Fernández Rojas #include #include #include -@@ -4744,6 +4745,40 @@ rtl8126_link_down_patch(struct net_devic +@@ -4661,6 +4662,40 @@ rtl8126_link_down_patch(struct net_devic #endif } -+static unsigned int rtl8126_phy_duplex(u16 status) ++static unsigned int rtl8126_phy_duplex(u32 status) +{ + unsigned int duplex = DUPLEX_UNKNOWN; + @@ -55,16 +57,16 @@ Signed-off-by: Álvaro Fernández Rojas + return duplex; +} + -+static int rtl8126_phy_speed(u16 status) ++static int rtl8126_phy_speed(u32 status) +{ + int speed = SPEED_UNKNOWN; + + if (status & LinkStatus) { + if (status & _5000bpsF) + speed = SPEED_5000; -+ else if (status & _2500bpsF) ++ else if (status & RTL8126_SPEED_2500_MASK) + speed = SPEED_2500; -+ else if (status & _1000bpsF) ++ else if (status & RTL8126_SPEED_1000_MASK) + speed = SPEED_1000; + else if (status & _100bps) + speed = SPEED_100; @@ -78,14 +80,14 @@ Signed-off-by: Álvaro Fernández Rojas static void _rtl8126_check_link_status(struct net_device *dev, unsigned int link_state) { -@@ -4756,11 +4791,18 @@ _rtl8126_check_link_status(struct net_de +@@ -4673,11 +4708,18 @@ _rtl8126_check_link_status(struct net_de if (link_state == R8126_LINK_STATE_ON) { rtl8126_link_on_patch(dev); - if (netif_msg_ifup(tp)) - printk(KERN_INFO PFX "%s: link up\n", dev->name); + if (netif_msg_ifup(tp)) { -+ const u16 phy_status = RTL_R16(tp, PHYstatus); ++ const u32 phy_status = RTL_R32(tp, PHYstatus); + const unsigned int phy_duplex = rtl8126_phy_duplex(phy_status); + const int phy_speed = rtl8126_phy_speed(phy_status); + printk(KERN_INFO PFX "%s: Link is Up - %s/%s\n", From 89f05e032b21c28f161825f28047eed845dff2cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 27 Feb 2025 08:31:12 +0100 Subject: [PATCH 7/7] omcproxy: update to latest version MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: https://github.com/openwrt/omcproxy/compare/bfba2aa75802ff1a70ef2fd3eba53409a8c6e93a...582cd8d3ae7e6af0073ce1d9198387af48affd60 Signed-off-by: Álvaro Fernández Rojas --- package/network/services/omcproxy/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/network/services/omcproxy/Makefile b/package/network/services/omcproxy/Makefile index 0ca0970af2..a295431cb5 100644 --- a/package/network/services/omcproxy/Makefile +++ b/package/network/services/omcproxy/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=omcproxy -PKG_RELEASE:=9 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/omcproxy.git -PKG_MIRROR_HASH:=61f03d76b14149e417360b6aaa630e920b75a31a6a497353b7160b3a374b20b2 -PKG_SOURCE_DATE:=2021-11-04 -PKG_SOURCE_VERSION:=bfba2aa75802ff1a70ef2fd3eba53409a8c6e93a +PKG_MIRROR_HASH:=b18c6dcc323dc35cfeb3503562dd3d8b9fb27fcf6ddd98690a64bd709920ff3d +PKG_SOURCE_DATE:=2025-02-27 +PKG_SOURCE_VERSION:=582cd8d3ae7e6af0073ce1d9198387af48affd60 PKG_MAINTAINER:=Steven Barth PKG_LICENSE:=Apache-2.0