gl-infra-builder-FUjr/patches-22.03.4/4001-support-x300b-target.patch
Jianhui Zhao f4de921188 ath79: add u-boot env config for some boards
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2023-06-05 18:25:05 +08:00

476 lines
9.8 KiB
Diff

From 14635d1e30e6c5d5b65fb41df10168c4a5f438dd Mon Sep 17 00:00:00 2001
From: niyin <yin.ni@gl-inet.com>
Date: Sat, 28 Jan 2023 00:26:02 -0800
Subject: [PATCH] x300b: support x300b target
Add x300b support files
Signed-off-by: Yin Ni <yin.ni@gl-inet.com>
---
package/boot/uboot-envtools/files/ath79 | 2 +
.../dts/qca9531_glinet_gl-x300b-nor-nand.dts | 25 +++
.../ath79/dts/qca9531_glinet_gl-x300b-nor.dts | 18 ++
.../ath79/dts/qca9531_glinet_gl-x300b.dts | 152 -------------
.../ath79/dts/qca9531_glinet_gl-x300b.dtsi | 206 ++++++++++++++++++
.../etc/uci-defaults/04_led_migration | 2 +-
6 files changed, 252 insertions(+), 153 deletions(-)
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor-nand.dts
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor.dts
delete mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-x300b.dts
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi
diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79
index 8aa82ee66f..ce87f7e086 100644
--- a/package/boot/uboot-envtools/files/ath79
+++ b/package/boot/uboot-envtools/files/ath79
@@ -40,6 +40,8 @@ engenius,enstationac-v1|\
etactica,eg200|\
glinet,gl-ar750s-nor|\
glinet,gl-ar750s-nor-nand|\
+glinet,gl-x300b-nor|\
+glinet,gl-x300b-nor-nand|\
librerouter,librerouter-v1|\
netgear,ex6400|\
netgear,ex7300|\
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor-nand.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor-nand.dts
new file mode 100644
index 0000000000..b50ed14f26
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor-nand.dts
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "qca9531_glinet_gl-x300b.dtsi"
+
+/ {
+ compatible = "glinet,gl-x300b-nor-nand", "qca,qca9531";
+ model = "GL.iNet GL-X300B (NOR/NAND)";
+};
+
+&nor_partitions {
+ partition@60000 {
+ label = "kernel";
+ reg = <0x060000 0x200000>;
+ };
+ parition@260000 {
+ label = "nor_reserved";
+ reg = <0x260000 0xbc0000>;
+ };
+};
+
+&nand_ubi {
+ label = "ubi";
+};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor.dts
new file mode 100644
index 0000000000..566df3c238
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-x300b-nor.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "qca9531_glinet_gl-x300b.dtsi"
+
+/ {
+ compatible = "glinet,gl-x300b-nor", "qca,qca9531";
+ model = "GL.iNet GL-X300B (NOR)";
+};
+
+&nor_partitions {
+ partition@60000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x060000 0xfa0000>;
+ };
+};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x300b.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x300b.dts
deleted file mode 100644
index 5f5646b3e0..0000000000
--- a/target/linux/ath79/dts/qca9531_glinet_gl-x300b.dts
+++ /dev/null
@@ -1,152 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
-
-#include "qca953x.dtsi"
-
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/input/input.h>
-
-/ {
- compatible = "glinet,gl-x300b", "qca,qca9531";
- model = "GL.iNet GL-X300B";
-
- keys {
- compatible = "gpio-keys";
-
- pinctrl-names = "default";
- pinctrl-0 = <&jtag_disable_pins>;
-
- reset {
- label = "reset";
- linux,code = <KEY_RESTART>;
- gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
- };
- };
-
- leds {
- compatible = "gpio-leds";
-
- wlan2g {
- label = "green:wlan2g";
- gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
- linux,default-trigger = "phy0tpt";
- };
-
- wan {
- label = "green:wan";
- gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
- };
-
- lte {
- label = "green:lte";
- gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
- };
- };
-
- gpio-export {
- compatible = "gpio-export";
-
- minipcie {
- gpio-export,name = "minipcie";
- gpio-export,output = <0>;
- gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
- };
-
- rs485tx_en {
- gpio-export,name = "rs485tx_en";
- gpio-export,output = <0>;
- gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
- };
-
- ble_rst {
- gpio-export,name = "ble_rst";
- gpio-export,output = <0>;
- gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
- };
- };
-
- watchdog {
- compatible = "hw_wdt";
- dog_en_gpio = <12>;
- feed_dog_gpio = <2>;
- feed_dog_interval = <100000000>;
- };
-};
-
-&usb0 {
- status = "okay";
-};
-
-&usb_phy {
- status = "okay";
-};
-
-&spi {
- status = "okay";
-
- flash@0 {
- compatible = "jedec,spi-nor";
- reg = <0>;
- spi-max-frequency = <25000000>;
-
- partitions {
- compatible = "fixed-partitions";
- #address-cells = <1>;
- #size-cells = <1>;
-
- partition@0 {
- label = "u-boot";
- reg = <0x000000 0x040000>;
- read-only;
- };
-
- partition@40000 {
- label = "u-boot-env";
- reg = <0x040000 0x010000>;
- };
-
- art: partition@50000 {
- label = "art";
- reg = <0x050000 0x010000>;
- read-only;
- };
-
- partition@60000 {
- compatible = "denx,uimage";
- label = "firmware";
- reg = <0x060000 0xfa0000>;
- };
-
- };
- };
-};
-
-&eth0 {
- status = "okay";
-
- nvmem-cells = <&macaddr_art_0>;
- nvmem-cell-names = "mac-address";
-
- phy-handle = <&swphy4>;
-};
-
-&eth1 {
- nvmem-cells = <&macaddr_art_0>;
- nvmem-cell-names = "mac-address";
- mac-address-increment = <1>;
-};
-
-&wmac {
- status = "okay";
-
- mtd-cal-data = <&art 0x1000>;
-};
-
-&art {
- compatible = "nvmem-cells";
- #address-cells = <1>;
- #size-cells = <1>;
-
- macaddr_art_0: macaddr@0 {
- reg = <0x0 0x6>;
- };
-};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi b/target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi
new file mode 100644
index 0000000000..cf2735cb6b
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-x300b.dtsi
@@ -0,0 +1,206 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/input/input.h>
+
+#include "qca953x.dtsi"
+
+/ {
+ compatible = "glinet,gl-x300b", "qca,qca9531";
+ model = "GL.iNet GL-X300B";
+
+ gl_hw {
+ compatible = "gl-hw-info";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "x300b";
+ wan = "eth0";
+ lan = "eth1";
+ flash_size = <16>;
+ radio = "mac80211";
+ build-in-modem = "1-1";
+ reset-button = "gpio-3";
+ factory_data {
+ device_mac = "art";
+ device_ddns = "art", "0x10";
+ device_sn_bak = "art", "0x20";
+ device_sn = "art", "0x30";
+ country_code = "art", "0x88";
+ };
+ };
+
+ keys {
+ compatible = "gpio-keys-polled";
+
+ poll-interval = <20>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&jtag_disable_pins>;
+
+ reset {
+ label = "reset";
+ linux,code = <KEY_RESTART>;
+ gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ wlan2g {
+ label = "gl-x300b:green:wlan2g";
+ gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+ linux,default-trigger = "phy0tpt";
+ };
+
+ wan {
+ label = "gl-x300b:green:wan";
+ gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
+ };
+
+ lte {
+ label = "gl-x300b:green:lte";
+ gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
+ };
+ };
+ gpio-export {
+ compatible = "gpio-export";
+
+ minocie {
+ gpio-export,name = "gpio0";
+ gpio-export,output = <0>;
+ gpios = <&gpio 0 GPIO_ACTIVE_HIGH>;
+ };
+
+ rs485tx_en {
+ gpio-export,name = "gpio1";
+ gpio-export,output = <0>;
+ gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+ };
+
+ feed_dog {
+ gpio-export,name = "gpio2";
+ gpio-export,output = <0>;
+ gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+ };
+
+ dog_en {
+ gpio-export,name = "gpio12";
+ gpio-export,output = <0>;
+ gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
+ };
+
+ ble_rst {
+ gpio-export,name = "gpio16";
+ gpio-export,output = <0>;
+ gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;
+ };
+
+ };
+ watchdog {
+ compatible = "hw_wdt";
+ dog_en_gpio= <12>;
+ feed_dog_gpio=<2>;
+ feed_dog_interval=<100000000>;
+ };
+
+};
+
+
+&uart {
+ status = "okay";
+ rs485_pin=<1>;
+};
+
+&usb0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+
+ hub_port: port@1 {
+ reg = <1>;
+ #trigger-source-cells = <0>;
+ };
+};
+
+&usb_phy {
+ status = "okay";
+};
+
+&spi {
+ status = "okay";
+ num-cs = <2>;
+ cs-gpios = <0>, <0>;
+
+ flash@0 {
+ compatible = "jedec,spi-nor";
+ reg = <0>;
+ spi-max-frequency = <25000000>;
+
+ nor_partitions: partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ partition@0 {
+ label = "u-boot";
+ reg = <0x000000 0x040000>;
+ read-only;
+ };
+
+ partition@40000 {
+ label = "u-boot-env";
+ reg = <0x040000 0x010000>;
+ };
+
+ art: partition@50000 {
+ label = "art";
+ reg = <0x050000 0x010000>;
+ read-only;
+ };
+ };
+ };
+
+ flash_nand: flash@1 {
+ compatible = "spi-nand";
+ reg = <1>;
+ spi-max-frequency = <25000000>;
+
+ nand_partitions: partitions {
+ compatible = "fixed-partitions";
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ nand_ubi: partition@0 {
+ label = "nand_ubi";
+ reg = <0x000000 0x8000000>;
+ };
+ };
+ };
+
+};
+/*
+&bootargs {
+ bootargs="";
+};*/
+
+&eth0 {
+ status = "okay";
+ mtd-mac-address = <&art 0x0>;
+ phy-handle = <&swphy4>;
+ ifname = "eth0";
+};
+
+&eth1 {
+ mtd-mac-address = <&art 0x0>;
+ mtd-mac-address-increment = <1>;
+ ifname = "eth1";
+};
+
+
+&wmac {
+ status = "okay";
+ mtd-cal-data = <&art 0x1000>;
+ mtd-mac-address = <&art 0x1002>;
+};
diff --git a/target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration b/target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration
index 281d6ac0bc..0d20953919 100644
--- a/target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration
+++ b/target/linux/ath79/nand/base-files/etc/uci-defaults/04_led_migration
@@ -6,7 +6,7 @@ board=$(board_name)
case "$board" in
esac
-remove_devicename_leds
+#remove_devicename_leds
migrations_apply system
--
2.34.1