From 203604769bdcdc99d7ce91c7638f0a4089373287 Mon Sep 17 00:00:00 2001 From: Tianling Shen Date: Wed, 1 Mar 2023 08:28:22 +0800 Subject: [PATCH] ramips: jcg q20: add pb-boot variants Signed-off-by: Tianling Shen (cherry picked from commit cc9a7cea381ab5dd8568de9c1929788862371037) --- package/boot/uboot-envtools/files/ramips | 1 + .../ramips/dts/mt7621_jcg_q20-pb-boot.dts | 61 +++++++++ target/linux/ramips/dts/mt7621_jcg_q20.dts | 117 +---------------- target/linux/ramips/dts/mt7621_jcg_q20.dtsi | 122 ++++++++++++++++++ target/linux/ramips/image/mt7621.mk | 6 + .../mt7621/base-files/etc/board.d/02_network | 1 + .../mt7621/base-files/lib/upgrade/platform.sh | 1 + 7 files changed, 193 insertions(+), 116 deletions(-) create mode 100644 target/linux/ramips/dts/mt7621_jcg_q20-pb-boot.dts create mode 100644 target/linux/ramips/dts/mt7621_jcg_q20.dtsi diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips index 6f351af212..a8d2d5b927 100644 --- a/package/boot/uboot-envtools/files/ramips +++ b/package/boot/uboot-envtools/files/ramips @@ -62,6 +62,7 @@ h3c,tx1800-plus|\ h3c,tx1801-plus|\ h3c,tx1806|\ jcg,q20|\ +jcg,q20-pb-boot|\ linksys,e7350|\ netgear,wax202|\ zyxel,wsm20) diff --git a/target/linux/ramips/dts/mt7621_jcg_q20-pb-boot.dts b/target/linux/ramips/dts/mt7621_jcg_q20-pb-boot.dts new file mode 100644 index 0000000000..f31325cda9 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_jcg_q20-pb-boot.dts @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621_jcg_q20.dtsi" + +/ { + compatible = "jcg,q20-pb-boot", "mediatek,mt7621-soc"; + model = "JCG Q20 (pb-boot)"; +}; + +&nand { + 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 34236954d0..3183208a85 100644 --- a/target/linux/ramips/dts/mt7621_jcg_q20.dts +++ b/target/linux/ramips/dts/mt7621_jcg_q20.dts @@ -1,56 +1,11 @@ // SPDX-License-Identifier: GPL-2.0-or-later OR MIT -#include "mt7621.dtsi" - -#include -#include +#include "mt7621_jcg_q20.dtsi" / { compatible = "jcg,q20", "mediatek,mt7621-soc"; model = "JCG Q20"; - aliases { - led-boot = &led_status_red; - led-failsafe = &led_status_red; - led-running = &led_status_blue; - led-upgrade = &led_status_blue; - 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>; @@ -69,8 +24,6 @@ }; &nand { - status = "okay"; - partitions { compatible = "fixed-partitions"; #address-cells = <1>; @@ -130,71 +83,3 @@ */ }; }; - -&pcie { - status = "okay"; -}; - -&pcie1 { - wifi@0,0 { - compatible = "mediatek,mt76"; - reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&factory 0x0>; - mediatek,disable-radar-background; - }; -}; - -&gmac0 { - nvmem-cells = <&macaddr_factory_3fff4>; - nvmem-cell-names = "mac-address"; -}; - -&gmac1 { - status = "okay"; - label = "wan"; - phy-handle = <ðphy0>; - - nvmem-cells = <&macaddr_factory_3fffa>; - nvmem-cell-names = "mac-address"; -}; - -&mdio { - ethphy0: ethernet-phy@0 { - reg = <0>; - }; -}; - -&switch0 { - ports { - port@1 { - status = "okay"; - label = "lan1"; - }; - - port@4 { - status = "okay"; - label = "lan2"; - }; - }; -}; - -&state_default { - gpio { - groups = "jtag", "wdt"; - function = "gpio"; - }; -}; - -&factory { - compatible = "nvmem-cells"; - #address-cells = <1>; - #size-cells = <1>; - - macaddr_factory_3fff4: macaddr@3fff4 { - reg = <0x3fff4 0x6>; - }; - - macaddr_factory_3fffa: macaddr@3fffa { - reg = <0x3fffa 0x6>; - }; -}; diff --git a/target/linux/ramips/dts/mt7621_jcg_q20.dtsi b/target/linux/ramips/dts/mt7621_jcg_q20.dtsi new file mode 100644 index 0000000000..4c2fe5e2b8 --- /dev/null +++ b/target/linux/ramips/dts/mt7621_jcg_q20.dtsi @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: GPL-2.0-or-later OR MIT + +#include "mt7621.dtsi" + +#include +#include + +/ { + aliases { + led-boot = &led_status_red; + led-failsafe = &led_status_red; + led-running = &led_status_blue; + led-upgrade = &led_status_blue; + 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 = ; + }; + }; +}; + +&nand { + status = "okay"; +}; + +&pcie { + status = "okay"; +}; + +&pcie1 { + wifi@0,0 { + compatible = "mediatek,mt76"; + reg = <0x0000 0 0 0 0>; + mediatek,mtd-eeprom = <&factory 0x0>; + mediatek,disable-radar-background; + }; +}; + +&gmac0 { + nvmem-cells = <&macaddr_factory_3fff4>; + nvmem-cell-names = "mac-address"; +}; + +&gmac1 { + status = "okay"; + label = "wan"; + phy-handle = <ðphy0>; + + nvmem-cells = <&macaddr_factory_3fffa>; + nvmem-cell-names = "mac-address"; +}; + +&mdio { + ethphy0: ethernet-phy@0 { + reg = <0>; + }; +}; + +&switch0 { + ports { + port@1 { + status = "okay"; + label = "lan1"; + }; + + port@4 { + status = "okay"; + label = "lan2"; + }; + }; +}; + +&state_default { + gpio { + groups = "jtag", "wdt"; + function = "gpio"; + }; +}; + +&factory { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + macaddr_factory_3fff4: macaddr@3fff4 { + reg = <0x3fff4 0x6>; + }; + + macaddr_factory_3fffa: macaddr@3fffa { + reg = <0x3fffa 0x6>; + }; +}; diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index d95ae47c69..5868c073e2 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -1320,6 +1320,12 @@ define Device/jcg_q20 endef TARGET_DEVICES += jcg_q20 +define Device/jcg_q20-pb-boot + $(Device/jcg_q20) + DEVICE_MODEL += (pb-boot) +endef +TARGET_DEVICES += jcg_q20-pb-boot + 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 61d87455b6..bd6ec91fb5 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 @@ -67,6 +67,7 @@ ramips_setup_interfaces() glinet,gl-mt1300|\ iptime,a3002mesh|\ jcg,q20|\ + jcg,q20-pb-boot|\ jdcloud,re-sp-01b|\ lenovo,newifi-d1|\ mikrotik,routerboard-m33g|\ 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 ce5fdd61ed..93943d40d9 100755 --- a/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh +++ b/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh @@ -77,6 +77,7 @@ platform_do_upgrade() { iptime,ax2004m|\ iptime,t5004|\ jcg,q20|\ + jcg,q20-pb-boot|\ linksys,e5600|\ linksys,e7350|\ linksys,ea6350-v4|\