diff --git a/target/linux/ramips/dts/mt7621_jcg_nand_128m.dtsi b/target/linux/ramips/dts/mt7621_jcg_nand_128m.dtsi new file mode 100644 index 000000000..a92d64776 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_jcg_nand_128m.dtsi @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + 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 = ; + }; + + wps { + label = "wps"; + gpios = <&gpio 16 GPIO_ACTIVE_LOW>; + linux,code = ; + }; + }; +}; + +&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"; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_jcg_q20-ubootmod.dts b/target/linux/ramips/dts/mt7621_jcg_q20-ubootmod.dts new file mode 100644 index 000000000..638dd3af1 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_jcg_q20-ubootmod.dts @@ -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 = ðernet; + }; +}; + +ðernet { + 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>; + }; + }; +}; diff --git a/target/linux/ramips/dts/mt7621_jcg_q20.dts b/target/linux/ramips/dts/mt7621_jcg_q20.dts index f0e829393..f74f20008 100644 --- a/target/linux/ramips/dts/mt7621_jcg_q20.dts +++ b/target/linux/ramips/dts/mt7621_jcg_q20.dts @@ -1,9 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7621.dtsi" - -#include -#include +#include "mt7621_jcg_nand_128m.dtsi" / { compatible = "jcg,q20", "mediatek,mt7621-soc"; @@ -17,40 +14,6 @@ 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 = ; - }; - - wps { - label = "wps"; - gpios = <&gpio 16 GPIO_ACTIVE_LOW>; - linux,code = ; - }; - }; - ubi-concat { compatible = "mtd-concat"; 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 { mtd-mac-address = <&factory 0x3fff4>; }; @@ -166,10 +117,3 @@ }; }; }; - -&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 e0bd258cc..d82420438 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -843,6 +843,12 @@ define Device/jcg_q20 endef 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 $(Device/dsa-migration) $(Device/uimage-lzma-loader) 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 1b8a64ed9..fc1fbacfd 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 @@ -62,6 +62,10 @@ ramips_setup_interfaces() gnubee,gb-pc2) ucidef_set_interface_lan "lan1 lan2" ;; + jcg,q20-ubootmod) + ucidef_add_switch "switch0" \ + "1:lan" "4:lan" "0:wan" "6@eth0" + ;; linksys,re6500|\ netgear,wac104) 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) 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) wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac diff --git a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac index 2d81db61b..ff476a7ba 100644 --- a/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac +++ b/target/linux/ramips/mt7621/base-files/etc/hotplug.d/ieee80211/10_fix_wifi_mac @@ -25,7 +25,8 @@ case "$board" in [ "$PHYNBR" = "1" ] && \ macaddr_add "$(mtd_get_mac_binary factory 0x4)" 1 > /sys${DEVPATH}/macaddress ;; - jcg,q20) + jcg,q20|\ + jcg,q20-ubootmod) [ "$PHYNBR" = "1" ] && \ macaddr_setbit_la "$(mtd_get_mac_binary Factory 0x4)" > /sys${DEVPATH}/macaddress ;; diff --git a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh index 27b8793ef..f260399e1 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -61,6 +61,7 @@ platform_do_upgrade() { dlink,dir-853-a3|\ hiwifi,hc5962|\ jcg,q20|\ + jcg,q20-ubootmod|\ linksys,e5600|\ linksys,ea7300-v1|\ linksys,ea7300-v2|\