From 69b0f1cf689817cb2e77cca8f4ae8ea4c5d4a256 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Thu, 23 Sep 2021 00:46:42 +0800 Subject: [PATCH] ramips: add support for JCG JHR-AC945M (#7900) Hardware specs: SoC: MediaTek MT7621AT Flash: SPI NOR 16MB RAM: DDR3 256MB 2.4GHz: MT7615N bgn 4x4 5GHz: MT7615N nac 4x4 Ethernet: 1 x WAN and 4 x LAN USB: 1 x 3.0 Button: Reset, WPS Unsupported chips: ATMEGA328P-AU HCLTEK HT1621B Flash instructions: Upload factory.bin in stock firmware's upgrade page. Signed-off-by: AmadeusGhost --- .../ramips/dts/mt7621_jcg_jhr-ac945m.dts | 131 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 13 ++ .../mt7621/base-files/etc/board.d/02_network | 1 + 3 files changed, 145 insertions(+) create mode 100644 target/linux/ramips/dts/mt7621_jcg_jhr-ac945m.dts diff --git a/target/linux/ramips/dts/mt7621_jcg_jhr-ac945m.dts b/target/linux/ramips/dts/mt7621_jcg_jhr-ac945m.dts new file mode 100644 index 000000000..c604bca1c --- /dev/null +++ b/target/linux/ramips/dts/mt7621_jcg_jhr-ac945m.dts @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + compatible = "jcg,jhr-ac945m", "mediatek,mt7621-soc"; + model = "JCG JHR-AC945M"; + + keys { + compatible = "gpio-keys"; + + reset { + label = "reset"; + gpios = <&gpio 18 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&spi0 { + status = "okay"; + + flash@0 { + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <80000000>; + m25p,fast-read; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "bootloader"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "config"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0xfb0000>; + }; + }; + }; +}; + +&pcie { + status = "okay"; +}; + +&pcie0 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + ieee80211-freq-limit = <2400000 2500000>; + }; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x8000>; + ieee80211-freq-limit = <5000000 6000000>; + }; +}; + +&gmac0 { + mtd-mac-address = <&factory 0xe000>; +}; + +&switch0 { + ports { + port@0 { + status = "okay"; + label = "lan1"; + }; + + port@1 { + status = "okay"; + label = "lan2"; + }; + + port@2 { + status = "okay"; + label = "lan3"; + }; + + port@3 { + status = "okay"; + label = "lan4"; + }; + + port@4 { + status = "okay"; + label = "wan"; + mtd-mac-address = <&factory 0xe006>; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "wdt"; + function = "gpio"; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 15746d73c..3413df5c9 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -759,6 +759,19 @@ define Device/jcg_jhr-ac876m endef TARGET_DEVICES += jcg_jhr-ac876m +define Device/jcg_jhr-ac945m + $(Device/dsa-migration) + $(Device/uimage-lzma-loader) + IMAGE_SIZE := 16064k + IMAGES += factory.bin + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 91.1 + JCG_MAXSIZE := 16064k + DEVICE_VENDOR := JCG + DEVICE_MODEL := JHR-AC945M + DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3 +endef +TARGET_DEVICES += jcg_jhr-ac945m + define Device/jcg_q20 $(Device/dsa-migration) BLOCKSIZE := 128k diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 0f99d2294..5ecd35d08 100644 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -165,6 +165,7 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac ;; + jcg,jhr-ac945m|\ jcg,y2|\ wavlink,wl-wn531a6|\ winstars,ws-wn583a6|\