ramips: JCG Q20: add pbboot mod version

Add the missing part, fixes: #8391
This commit is contained in:
AmadeusGhost 2021-12-02 23:50:03 +08:00
parent f8a982515a
commit 4bdb51efa0
7 changed files with 165 additions and 58 deletions

View File

@ -0,0 +1,61 @@
// 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>
/ {
chosen {
bootargs = "console=ttyS0,115200";
};
leds {
compatible = "gpio-leds";
led_status_red: status_red {
label = "red:status";
gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
};
led_status_blue: status_blue {
label = "blue:status";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
};
&pcie {
status = "okay";
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0>;
};
};
&state_default {
gpio {
groups = "jtag", "wdt";
function = "gpio";
};
};

View File

@ -0,0 +1,86 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621_jcg_nand_128m.dtsi"
/ {
compatible = "jcg,q20-ubootmod", "mediatek,mt7621-soc";
model = "JCG Q20 (U-Boot mod)";
aliases {
led-boot = &led_status_red;
led-failsafe = &led_status_red;
led-running = &led_status_blue;
led-upgrade = &led_status_blue;
label-mac-device = &ethernet;
};
};
&ethernet {
compatible = "mediatek,ralink-mt7621-eth";
mediatek,switch = <&gsw>;
mtd-mac-address = <&factory 0x3fff4>;
};
&switch0 {
/delete-property/ compatible;
phy-mode = "rgmii";
};
&gsw {
compatible = "mediatek,ralink-mt7621-gsw";
};
&nand {
status = "okay";
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "Bootloader";
reg = <0x0 0x80000>;
};
partition@80000 {
label = "Nvram";
reg = <0x80000 0x40000>;
read-only;
};
partition@c0000 {
label = "Bdata";
reg = <0xc0000 0x40000>;
read-only;
};
factory: partition@100000 {
label = "Factory";
reg = <0x100000 0x80000>;
read-only;
};
partition@180000 {
label = "crash";
reg = <0x180000 0x40000>;
read-only;
};
partition@1c0000 {
label = "crash_log";
reg = <0x1c0000 0x40000>;
read-only;
};
partition@200000 {
label = "kernel";
reg = <0x200000 0x400000>;
};
partition@600000 {
label = "ubi";
reg = <0x600000 0x7980000>;
};
};
};

View File

@ -1,9 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT // SPDX-License-Identifier: GPL-2.0-or-later OR MIT
#include "mt7621.dtsi" #include "mt7621_jcg_nand_128m.dtsi"
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
/ { / {
compatible = "jcg,q20", "mediatek,mt7621-soc"; compatible = "jcg,q20", "mediatek,mt7621-soc";
@ -17,40 +14,6 @@
label-mac-device = &gmac0; label-mac-device = &gmac0;
}; };
chosen {
bootargs = "console=ttyS0,115200";
};
leds {
compatible = "gpio-leds";
led_status_red: status_red {
label = "red:status";
gpios = <&gpio 14 GPIO_ACTIVE_HIGH>;
};
led_status_blue: status_blue {
label = "blue:status";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
};
keys {
compatible = "gpio-keys";
reset {
label = "reset";
gpios = <&gpio 18 GPIO_ACTIVE_LOW>;
linux,code = <KEY_RESTART>;
};
wps {
label = "wps";
gpios = <&gpio 16 GPIO_ACTIVE_LOW>;
linux,code = <KEY_WPS_BUTTON>;
};
};
ubi-concat { ubi-concat {
compatible = "mtd-concat"; compatible = "mtd-concat";
devices = <&ubiconcat0 &ubiconcat1>; devices = <&ubiconcat0 &ubiconcat1>;
@ -131,18 +94,6 @@
}; };
}; };
&pcie {
status = "okay";
};
&pcie1 {
wifi@0,0 {
compatible = "mediatek,mt76";
reg = <0x0000 0 0 0 0>;
mediatek,mtd-eeprom = <&factory 0x0>;
};
};
&gmac0 { &gmac0 {
mtd-mac-address = <&factory 0x3fff4>; mtd-mac-address = <&factory 0x3fff4>;
}; };
@ -166,10 +117,3 @@
}; };
}; };
}; };
&state_default {
gpio {
groups = "jtag", "wdt";
function = "gpio";
};
};

View File

@ -843,6 +843,12 @@ define Device/jcg_q20
endef endef
TARGET_DEVICES += jcg_q20 TARGET_DEVICES += jcg_q20
define Device/jcg_q20-ubootmod
$(Device/jcg_q20)
DEVICE_VARIANT := U-Boot mod
endef
TARGET_DEVICES += jcg_q20-ubootmod
define Device/jcg_y2 define Device/jcg_y2
$(Device/dsa-migration) $(Device/dsa-migration)
$(Device/uimage-lzma-loader) $(Device/uimage-lzma-loader)

View File

@ -62,6 +62,10 @@ ramips_setup_interfaces()
gnubee,gb-pc2) gnubee,gb-pc2)
ucidef_set_interface_lan "lan1 lan2" ucidef_set_interface_lan "lan1 lan2"
;; ;;
jcg,q20-ubootmod)
ucidef_add_switch "switch0" \
"1:lan" "4:lan" "0:wan" "6@eth0"
;;
linksys,re6500|\ linksys,re6500|\
netgear,wac104) netgear,wac104)
ucidef_set_interface_lan "lan1 lan2 lan3 lan4" ucidef_set_interface_lan "lan1 lan2 lan3 lan4"
@ -166,6 +170,10 @@ ramips_setup_macs()
[ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address) [ -n "$lan_mac" ] || lan_mac=$(cat /sys/class/net/eth0/address)
wan_mac=$(macaddr_add "$lan_mac" 1) wan_mac=$(macaddr_add "$lan_mac" 1)
;; ;;
jcg,q20-ubootmod)
lan_mac=$(cat /sys/class/net/eth0/address)
wan_mac=$(mtd_get_mac_binary factory 0x3fffa)
;;
iodata,wnpr2600g) iodata,wnpr2600g)
wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
label_mac=$wan_mac label_mac=$wan_mac

View File

@ -25,7 +25,8 @@ case "$board" in
[ "$PHYNBR" = "1" ] && \ [ "$PHYNBR" = "1" ] && \
macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress
;; ;;
jcg,q20) jcg,q20|\
jcg,q20-ubootmod)
[ "$PHYNBR" = "1" ] && \ [ "$PHYNBR" = "1" ] && \
macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress
;; ;;

View File

@ -61,6 +61,7 @@ platform_do_upgrade() {
dlink,dir-853-a3|\ dlink,dir-853-a3|\
hiwifi,hc5962|\ hiwifi,hc5962|\
jcg,q20|\ jcg,q20|\
jcg,q20-ubootmod|\
linksys,e5600|\ linksys,e5600|\
linksys,ea7300-v1|\ linksys,ea7300-v1|\
linksys,ea7300-v2|\ linksys,ea7300-v2|\