ramips: add support for JCG Y2

JCG Y2 is an AC1300M router

Hardware specs:
  SoC: MediaTek MT7621AT
  Flash: Winbond W25Q128JVSQ 16MiB
  RAM: Nanya NT5CB128M16 256MiB
  WLAN: 2.4/5 GHz 2T2R (1x MediaTek MT7615)
  Ethernet: 10/100/1000 Mbps x5
  LED: POWER, INTERNET, 2.4G, 5G
  Button: Reset
  Power: DC 12V,1A

Flash instructions:
  Upload factory.bin in stock firmware's upgrade page.

MAC addresses map:
  0x0004  *:c8  wlan2g/wlan5g/label
  0xe000  *:c7  lan
  0xe006  *:c6  wan

Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
This commit is contained in:
Chukun Pan 2021-02-08 16:28:10 +08:00 committed by Adrian Schmutzler
parent 98d61b516f
commit 82032f3509
4 changed files with 152 additions and 7 deletions

View File

@ -0,0 +1,130 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ {
compatible = "jcg,y2", "mediatek,mt7621-soc";
model = "JCG Y2";
aliases {
led-boot = &led_internet;
led-failsafe = &led_internet;
led-upgrade = &led_internet;
};
leds {
compatible = "gpio-leds";
led_internet: internet {
label = "blue:internet";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
};
};
&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>;
};
};
&gmac0 {
mtd-mac-address = <&factory 0xe000>;
};
&switch0 {
ports {
port@0 {
status = "okay";
label = "lan4";
};
port@1 {
status = "okay";
label = "lan3";
};
port@2 {
status = "okay";
label = "lan2";
};
port@3 {
status = "okay";
label = "lan1";
};
wan: port@4 {
status = "okay";
label = "wan";
mtd-mac-address = <&factory 0xe006>;
};
};
};
&state_default {
gpio {
groups = "jtag", "wdt";
function = "gpio";
};
};

View File

@ -684,6 +684,19 @@ define Device/jcg_jhr-ac876m
endef
TARGET_DEVICES += jcg_jhr-ac876m
define Device/jcg_y2
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)
IMAGE_SIZE := 16064k
IMAGES += factory.bin
IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 95.1
JCG_MAXSIZE := 16064k
DEVICE_VENDOR := JCG
DEVICE_MODEL := Y2
DEVICE_PACKAGES := kmod-mt7615e kmod-mt7615-firmware kmod-usb3
endef
TARGET_DEVICES += jcg_y2
define Device/lenovo_newifi-d1
$(Device/dsa-migration)
$(Device/uimage-lzma-loader)

View File

@ -19,6 +19,7 @@ d-team,newifi-d2)
;;
d-team,pbr-m1|\
gehua,ghl-r-001|\
jcg,y2|\
xzwifi,creativebox-v1)
ucidef_set_led_netdev "internet" "internet" "blue:internet" "wan"
;;

View File

@ -113,6 +113,14 @@ ramips_setup_macs()
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
label_mac=$wan_mac
;;
jcg,y2|\
wavlink,wl-wn531a6|\
winstars,ws-wn583a6|\
zbtlink,zbt-we1326|\
zbtlink,zbt-wg3526-16m|\
zbtlink,zbt-wg3526-32m)
label_mac=$(mtd_get_mac_binary factory 0x4)
;;
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2)
@ -128,13 +136,6 @@ ramips_setup_macs()
wan_mac=$label_mac
lan_mac=$(macaddr_add $label_mac 1)
;;
wavlink,wl-wn531a6|\
winstars,ws-wn583a6|\
zbtlink,zbt-we1326|\
zbtlink,zbt-wg3526-16m|\
zbtlink,zbt-wg3526-32m)
label_mac=$(mtd_get_mac_binary factory 0x4)
;;
esac
[ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac