From patchwork Tue May 7 14:14:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wornandrew X-Patchwork-Id: 1932496 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=bBKgs4bI; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VYgLj19phz1xnT for ; Wed, 8 May 2024 00:16:28 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type:List-Help: Reply-To:List-Archive:List-Unsubscribe:List-Subscribe:From:List-Post:List-Id: Message-ID:MIME-Version:Subject:To:Date:Cc:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=/gRqahxVnAjlOhvQT/vSePu41xLhUdhxxEnFGRmWEu4=; b=bBKgs4bI5V0p5p193rKjzMaEFe HPT3JQc+glfgieqyJohCe41c2MW0f7Oe2brE05Ub1Kt7aYEG2pGIpwhf0+2ZFmU2Dw9kVGW0LyQJF 2Q0eXI0IlLlcl4k3re5TRaQyqF8BLD9XzGZYnnCbUOayThYLgFQ5KRZPMU74CajpBcYKKW/WEpsYx uRr1CDq2Fb0nVtuXwEGvuWNISb4edi5KusxWN/jeDFYPJRVGb8gxHTNwZOVh9yW1omYf0gYIeuHsb 1oUviGxje+y5LIX9gNgaecsLHuKdD4nhIixUNcr3C8J+I/i9iivsISf+KIgo+tK4n2vT7fKnvmirq kWBdTitg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s4Lad-0000000BQQ7-23RS; Tue, 07 May 2024 14:14:43 +0000 Date: Tue, 07 May 2024 14:14:20 +0000 To: "openwrt-devel@lists.openwrt.org" Subject: [PATCH] ramips: mt7621: add support for Keenetic Viva (KN-1910) MIME-Version: 1.0 Message-ID: List-Id: OpenWrt Development List List-Post: X-Patchwork-Original-From: wornandrew via openwrt-devel From: wornandrew Precedence: list X-Mailman-Version: 2.1.34 X-BeenThere: openwrt-devel@lists.openwrt.org List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: wornandrew List-Help: Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. From: Andrew Worn SoC : MediaTek MT7621A RAM : 128M DDR3 Flash : 128M NAND Switch: MT7530, 5 ports 1Gbps WiFi : MT7615DN, 2.4GHz n and 5GHz ac USB : 2 ports USB 2.0 GPIO : 4 buttons, 4 LEDs, USB port power controls LAN : RF-EEPROM + 0x04 WAN : RF-EEPROM + 0x28 2.4GHz: RF-EEPROM + 0x04 5GHz : 2.4GHz + 82:00:00:00:00:00 1. Connect to a LAN port, configure interface to use 192.168.1.2/30 2. Serve the factory image renamed to KN-1910_recovery.bin via TFTP 3. Power up the router while pressing Restart button on the back 4. Release Restart button when Power LED starts blinking Keenetic's bootloader supports booting a LZMA compressed kernel but seems to fail if the uncompressed data is larger than a fixed buffer therefore it is safer to use a uimage-lzma-loader Vendor firmware uses around half of flash for a writable UBIFS partition that is preserved here. It may be accessed with the following commands: ubiattach -p /dev/mtd17 mount -t ubifs /dev/ubi1_0 /mnt/ Signed-off-by: Andrew Worn diff --git a/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts b/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts new file mode 100644 index 0000000000..1717d274a8 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_keenetic_kn-1910.dts @@ -0,0 +1,271 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "keenetic,kn-1910", "mediatek,mt7621-soc"; + model = "Keenetic KN-1910"; + + aliases { + led-boot = &led_power; + led-failsafe = &led_power; + led-running = &led_power; + led-upgrade = &led_power; + label-mac-device = &gmac0; + }; + + gpio_export { + compatible = "gpio-export"; + #size-cells = <0>; + + left_usb_power { + gpio-export,name = "left-usb:power"; + gpio-export,output = <1>; + gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; + }; + + right_usb_power { + gpio-export,name = "right-usb:power"; + gpio-export,output = <1>; + gpios = <&gpio 11 GPIO_ACTIVE_HIGH>; + }; + }; + + keys { + compatible = "gpio-keys"; + + restart { + label = "restart"; + gpios = <&gpio 6 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 12 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn1 { + label = "fn1"; + gpios = <&gpio 10 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + fn2 { + label = "fn2"; + gpios = <&gpio 7 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; + + leds { + compatible = "gpio-leds"; + + led_power: power { + label = "green:power"; + gpios = <&gpio 9 GPIO_ACTIVE_HIGH>; + }; + + internet { + label = "green:internet"; + gpios = <&gpio 17 GPIO_ACTIVE_HIGH>; + }; + + fn { + label = "green:fn"; + gpios = <&gpio 13 GPIO_ACTIVE_HIGH>; + }; + + wifi { + label = "green:wifi"; + gpios = <&gpio 15 GPIO_ACTIVE_HIGH>; + }; + }; + + virtual_flash { + compatible = "mtd-concat"; + devices = <&firmware_1>, <&firmware_2>, <&storage_a>, <&storage_b>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "kernel"; + reg = <0x0 0x400000>; + }; + + partition@400000 { + label = "ubi"; + reg = <0x400000 0x3380000>; + }; + + partition@3780000 { + label = "storage"; + reg = <0x3780000 0x41c0000>; + }; + }; + }; +}; + +&nand { + status = "okay"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "U-Boot"; + reg = <0x0 0x80000>; + read-only; + }; + + partition@80000 { + label = "U-Config"; + reg = <0x80000 0x80000>; + read-only; + }; + + factory: partition@100000 { + label = "RF-EEPROM"; + reg = <0x100000 0x80000>; + read-only; + }; + + firmware_1: partition@180000 { + label = "Firmware_1"; + reg = <0x180000 0x1bc0000>; + }; + + partition@1d40000 { + label = "Config_1"; + reg = <0x1d40000 0x80000>; + read-only; + }; + + partition@1dc0000 { + label = "Storage_Legacy"; + reg = <0x1dc0000 0x200000>; + }; + + partition@1fc0000 { + label = "Dump"; + reg = <0x1fc0000 0x40000>; + read-only; + }; + + storage_a: partition@2000000 { + label = "Storage_A"; + reg = <0x2000000 0x1fc0000>; + }; + + partition@3fc0000 { + label = "U-State"; + reg = <0x3fc0000 0x80000>; + read-only; + }; + + partition@4040000 { + label = "U-Config_res"; + reg = <0x4040000 0x80000>; + read-only; + }; + + partition@40c0000 { + label = "RF-EEPROM_res"; + reg = <0x40c0000 0x80000>; + read-only; + }; + + firmware_2: partition@4140000 { + label = "Firmware_2"; + reg = <0x4140000 0x1bc0000>; + }; + + partition@5d00000 { + label = "Config_2"; + reg = <0x5d00000 0x80000>; + read-only; + }; + + storage_b: partition@5d80000 { + label = "Storage_B"; + reg = <0x5d80000 0x2200000>; + }; + + partition@7f80000 { + label = "unused"; + reg = <0x7f80000 0x80000>; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + }; +}; + +ðphy0 { + /delete-property/ interrupts; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_4>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_28>; + nvmem-cell-names = "mac-address"; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + }; + + port@2 { + status = "okay"; + }; + + port@3 { + status = "okay"; + }; + + port@4 { + status = "okay"; + }; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_4: macaddr@4 { + reg = <0x4 0x6>; + }; + + macaddr_factory_28: macaddr@28 { + reg = <0x28 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 10e7857614..b8533311f2 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1524,6 +1524,19 @@ define Device/jcg_y2 endef TARGET_DEVICES += jcg_y2 +define Device/keenetic_kn-1910 + $(Device/nand) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 56832k + DEVICE_VENDOR := Keenetic + DEVICE_MODEL := KN-1910 + DEVICE_PACKAGES := kmod-mt7615-firmware kmod-usb3 + IMAGES += factory.bin + IMAGE/factory.bin := append-kernel | pad-to $$(KERNEL_SIZE) | \ + append-ubi | check-size | zyimage -d 0x801910 -v "KN-1910" +endef +TARGET_DEVICES += keenetic_kn-1910 + define Device/keenetic_kn-3010 $(Device/dsa-migration) $(Device/uimage-lzma-loader) diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds index 6848bebd00..3755abdb51 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/01_leds @@ -122,6 +122,7 @@ gnubee,gb-pc2) huasifei,ws1208v2) ucidef_set_led_netdev "wwan0" "wwan0" "green:cellular" "wwan0" "link tx rx" ;; +keenetic,kn-1910|\ keenetic,kn-3010) ucidef_set_led_netdev "internet" "internet" "green:internet" "wan" ;;