gl-infra-builder-FUjr/patches-21.02.2/0014-ath79-add-support-for-gl-s200.patch
2022-05-10 18:58:01 +08:00

364 lines
8.5 KiB
Diff
Executable File

From 30689f1bb09cd33854f3fa4984c3e48e3dfda5ee Mon Sep 17 00:00:00 2001
From: "GL.iNet-Hongjian.Zhang" <hongjian.zhang@gl-inet.com>
Date: Tue, 10 May 2022 18:24:15 +0800
Subject: [PATCH] ath79: add support for gl s200
---
.../dts/qca9531_glinet_gl-s200-nor-nand.dts | 34 +++
.../ath79/dts/qca9531_glinet_gl-s200-nor.dts | 22 ++
.../ath79/dts/qca9531_glinet_gl-s200.dtsi | 203 ++++++++++++++++++
target/linux/ath79/image/nand.mk | 30 +++
.../nand/base-files/etc/board.d/02_network | 2 +
.../nand/base-files/lib/upgrade/platform.sh | 1 +
6 files changed, 292 insertions(+)
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-s200-nor-nand.dts
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-s200-nor.dts
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-s200.dtsi
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor-nand.dts b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor-nand.dts
new file mode 100644
index 0000000000..1fddb169f9
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor-nand.dts
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "qca9531_glinet_gl-s200.dtsi"
+
+/ {
+ compatible = "glinet,gl-s200-nor-nand", "qca,qca9531";
+ model = "GL.iNet GL-S200 (NOR/NAND)";
+};
+
+
+&bootargs {
+ bootargs = "console=ttyS0,115200n8";
+ };
+
+&nor_partitions {
+ partition@60000 {
+ label = "kernel";
+ reg = <0x060000 0x400000>;
+ };
+ parition@460000 {
+ label = "nor_reserved";
+ reg = <0x460000 0xb80000>;
+ };
+ parition@fe0000 {
+ label = "log";
+ reg = <0xfe0000 0x020000>;
+ };
+};
+
+&nand_ubi {
+ label = "ubi";
+};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor.dts b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor.dts
new file mode 100644
index 0000000000..7d5d27ec01
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-s200-nor.dts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "qca9531_glinet_gl-s200.dtsi"
+
+/ {
+ compatible = "glinet,gl-s200-nor", "qca,qca9531";
+ model = "GL.iNet GL-S200 (NOR)";
+};
+
+&nor_partitions {
+ partition@60000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x060000 0xf80000>;
+ };
+ partition@fe0000 {
+ label = "log";
+ reg = <0xfe0000 0x020000>;
+ };
+};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-s200.dtsi b/target/linux/ath79/dts/qca9531_glinet_gl-s200.dtsi
new file mode 100644
index 0000000000..3d2d9d6fc1
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-s200.dtsi
@@ -0,0 +1,203 @@
+// 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-s200", "qca,qca9531";
+ model = "GL.iNet GL-S200";
+
+ gl_hw {
+ compatible = "gl-hw-info";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "s200";
+ wan = "eth0";
+ lan = "eth1";
+ 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>;
+ linux,input-type = <EV_KEY>;
+ gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
+ };
+
+ switch {
+ label = "switch";
+ linux,code = <BTN_1>;
+ linux,input-type = <EV_SW>;
+ gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
+ };
+ };
+
+ leds {
+ compatible = "gpio-leds";
+
+ blue_led {
+ label = "gl-s200:blue";
+ gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;
+ default-state = "on";
+ };
+
+ white_led {
+ label = "gl-s200:green";
+ gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+
+ orange_led {
+ label = "gl-s200:orange";
+ gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;
+ default-state = "off";
+ };
+ };
+
+ gpio-export {
+ compatible = "gpio-export";
+
+ gpio_zigbee_reset {
+ gpio-export,name = "gpio1";
+ gpio-export,output = <1>;
+ gpio-export,direction_may_change;
+ gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+ };
+
+ gpio_zwave_reset {
+ gpio-export,name = "gpio2";
+ gpio-export,output = <1>;
+ gpio-export,direction_may_change;
+ gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
+ };
+
+ gpio_zigbee_upgrade {
+ gpio-export,name = "gpio11";
+ gpio-export,output = <1>;
+ gpio-export,direction_may_change;
+ gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;
+ };
+
+ gpio_zwave_upgrade {
+ gpio-export,name = "gpio17";
+ gpio-export,output = <1>;
+ gpio-export,direction_may_change;
+ gpios = <&gpio 17 GPIO_ACTIVE_HIGH>;
+ };
+ };
+};
+
+&pcie0 {
+ status = "okay";
+};
+
+&uart {
+ status = "okay";
+};
+
+&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>;
+ };
+ };
+ };
+
+ 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/image/nand.mk b/target/linux/ath79/image/nand.mk
index 4831a13ab9..878b23028a 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -161,6 +161,36 @@ define Device/glinet_gl-mifi
endef
TARGET_DEVICES += glinet_gl-mifi
+define Device/glinet_gl-s200-common
+ SOC := qca9531
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := GL-S200
+ DEVICE_PACKAGES := kmod-usb2 kmod-usb-serial-ch341
+ SUPPORTED_DEVICES += gl-s200 glinet,gl-s200
+endef
+
+
+define Device/glinet_gl-s200-nor
+ $(Device/glinet_gl-s200-common)
+ DEVICE_VARIANT := NOR
+ IMAGE_SIZE := 16000k
+endef
+TARGET_DEVICES += glinet_gl-s200-nor
+
+define Device/glinet_gl-s200-nor-nand
+ $(Device/glinet_gl-s200-common)
+ DEVICE_VARIANT := NOR/NAND
+ KERNEL_SIZE := 4096k
+ BLOCKSIZE := 128k
+ PAGESIZE := 2048
+ VID_HDR_OFFSET := 2048
+ IMAGES := factory.img sysupgrade.tar
+ IMAGE/sysupgrade.tar := sysupgrade-tar-compat-1806 | append-gl-metadata
+ IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | append-gl-metadata
+ SUPPORTED_DEVICES += gl-s200 glinet,gl-s200
+endef
+TARGET_DEVICES += glinet_gl-s200-nor-nand
+
define Device/glinet_gl-xe300-common
SOC := qca9531
DEVICE_VENDOR := GL.iNet
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/02_network b/target/linux/ath79/nand/base-files/etc/board.d/02_network
index 5912a4504a..f277679f3e 100755
--- a/target/linux/ath79/nand/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/nand/base-files/etc/board.d/02_network
@@ -23,6 +23,8 @@ ath79_setup_interfaces()
ucidef_add_switch "switch0" \
"0@eth0" "2:lan:2" "3:lan:1" "1:wan"
;;
+ glinet,gl-s200-nor|\
+ glinet,gl-s200-nor-nand|\
glinet,gl-ar300m-nor|\
glinet,gl-ar300m-nand|\
glinet,gl-x300b-nor|\
diff --git a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
index 21951ceba2..b657bba2fe 100644
--- a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
@@ -20,6 +20,7 @@ platform_do_upgrade() {
;;
glinet,gl-x750-nor-nand|\
glinet,gl-ar750s-nor-nand|\
+ glinet,gl-s200-nor-nand|\
glinet,gl-xe300-iot|\
glinet,gl-xe300-nor-nand)
nand_nor_do_upgrade "$1"
--
2.17.1