gl-infra-builder-FUjr/patches-21.02.0/0012-ath79-add-support-for-gl-x750.patch
Jianhui Zhao e062f61813 patches: dts: use new format for gl-hwinfo
Signed-off-by: Jianhui Zhao <jianhui.zhao@gl-inet.com>
2022-01-10 16:58:35 +08:00

464 lines
13 KiB
Diff

From 4afa87a602f9af8be38494237c4e758009d5c142 Mon Sep 17 00:00:00 2001
From: "GL.iNet-Hongjian.Zhang" <hongjian.zhang@gl-inet.com>
Date: Tue, 28 Sep 2021 14:19:45 +0800
Subject: [PATCH] ath79: add support for gl x750
---
.../dts/qca9531_glinet_gl-x750-nor-nand.dts | 25 +++++
.../ath79/dts/qca9531_glinet_gl-x750-nor.dts | 18 +++
...l-x750.dts => qca9531_glinet_gl-x750.dtsi} | 105 ++++++++++++++----
target/linux/ath79/dts/qca953x.dtsi | 3 +-
.../generic/base-files/etc/board.d/01_leds | 3 -
.../etc/hotplug.d/firmware/11-ath10k-caldata | 3 +-
target/linux/ath79/image/generic.mk | 9 --
target/linux/ath79/image/nand.mk | 30 ++++-
.../ath79/nand/base-files/etc/board.d/01_leds | 5 +
.../nand/base-files/etc/board.d/02_network | 2 +
.../etc/hotplug.d/firmware/11-ath10k-caldata | 6 +-
.../nand/base-files/lib/upgrade/platform.sh | 6 +-
12 files changed, 174 insertions(+), 41 deletions(-)
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-x750-nor-nand.dts
create mode 100644 target/linux/ath79/dts/qca9531_glinet_gl-x750-nor.dts
rename target/linux/ath79/dts/{qca9531_glinet_gl-x750.dts => qca9531_glinet_gl-x750.dtsi} (51%)
mode change 100644 => 100755
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x750-nor-nand.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x750-nor-nand.dts
new file mode 100644
index 0000000000..1926ff8626
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-x750-nor-nand.dts
@@ -0,0 +1,25 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "qca9531_glinet_gl-x750.dtsi"
+
+/ {
+ compatible = "glinet,gl-x750-nor-nand", "qca,qca9531";
+ model = "GL.iNet GL-X750 (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-x750-nor.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x750-nor.dts
new file mode 100644
index 0000000000..14be3e13a5
--- /dev/null
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-x750-nor.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+/dts-v1/;
+
+#include "qca9531_glinet_gl-x750.dtsi"
+
+/ {
+ compatible = "glinet,gl-x750-nor", "qca,qca9531";
+ model = "GL.iNet GL-X750 (NOR)";
+};
+
+&nor_partitions {
+ partition@60000 {
+ compatible = "denx,uimage";
+ label = "firmware";
+ reg = <0x060000 0xfa0000>;
+ };
+};
diff --git a/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts b/target/linux/ath79/dts/qca9531_glinet_gl-x750.dtsi
old mode 100644
new mode 100755
similarity index 51%
rename from target/linux/ath79/dts/qca9531_glinet_gl-x750.dts
rename to target/linux/ath79/dts/qca9531_glinet_gl-x750.dtsi
index c755e00033..89a109addc
--- a/target/linux/ath79/dts/qca9531_glinet_gl-x750.dts
+++ b/target/linux/ath79/dts/qca9531_glinet_gl-x750.dtsi
@@ -1,21 +1,43 @@
// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
-
-#include "qca953x.dtsi"
+/dts-v1/;
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
+#include "qca953x.dtsi"
+
/ {
compatible = "glinet,gl-x750", "qca,qca9531";
model = "GL.iNet GL-X750";
+ gl_hw {
+ compatible = "gl-hw-info";
+
+ #address-cells = <1>;
+ #size-cells = <1>;
+ model = "x750";
+ wan = "eth0";
+ lan = "eth1";
+ build-in-modem = "1-1.2";
+ reset-button = "gpio-3";
+ usb-port = "1-1.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";
+ compatible = "gpio-keys-polled";
+ poll-interval = <20>;
pinctrl-names = "default";
pinctrl-0 = <&jtag_disable_pins>;
- reset {
+ button0 {
label = "reset";
linux,code = <KEY_RESTART>;
gpios = <&gpio 3 GPIO_ACTIVE_LOW>;
@@ -26,39 +48,66 @@
compatible = "gpio-leds";
power {
- label = "green:power";
+ label = "gl-x750:green:power";
gpios = <&gpio 12 GPIO_ACTIVE_LOW>;
default-state = "on";
};
wlan2g {
- label = "green:wlan2g";
+ label = "gl-x750:green:wlan2g";
gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy1tpt";
};
wlan5g {
- label = "green:wlan5g";
+ label = "gl-x750:green:wlan5g";
gpios = <&gpio 13 GPIO_ACTIVE_LOW>;
linux,default-trigger = "phy0tpt";
};
wan {
- label = "green:wan";
+ label = "gl-x750:green:wan";
gpios = <&gpio 14 GPIO_ACTIVE_LOW>;
};
- 4g {
- label = "green:4g";
+ lte {
+ label = "gl-x750:green:lte";
gpios = <&gpio 15 GPIO_ACTIVE_LOW>;
};
};
+
+ gpio-export {
+ compatible = "gpio-export";
+
+ gpio_pci_power {
+ gpio-export,name = "pci_power";
+ gpio-export,output = <0>;
+ gpios = <&gpio 0 GPIO_ACTIVE_LOW>;
+ };
+
+ gpio_usb_power {
+ gpio-export,name = "usb_power";
+ gpio-export,output = <0>;
+ gpios = <&gpio 2 GPIO_ACTIVE_LOW>;
+ };
+
+ gpio_ble_reset {
+ //set name as gpio1 to compat 1806 gpio name
+ gpio-export,name = "gpio1";
+ gpio-export,output = <0>;
+ gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
+ };
+ };
};
&pcie0 {
status = "okay";
};
+&uart {
+ status = "okay";
+};
+
&usb0 {
#address-cells = <1>;
#size-cells = <0>;
@@ -76,13 +125,15 @@
&spi {
status = "okay";
+ num-cs = <2>;
+ cs-gpios = <0>, <0>;
flash@0 {
compatible = "jedec,spi-nor";
reg = <0>;
spi-max-frequency = <25000000>;
- partitions {
+ nor_partitions: partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
@@ -103,31 +154,47 @@
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>;
- partition@60000 {
- compatible = "denx,uimage";
- label = "firmware";
- reg = <0x060000 0xfa0000>;
+ nand_ubi: partition@0 {
+ label = "nand_ubi";
+ reg = <0x000000 0x8000000>;
};
};
};
+
+};
+
+&bootargs {
+ bootargs = "console=null";
};
&eth0 {
status = "okay";
-
- phy-handle = <&swphy4>;
-
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/dts/qca953x.dtsi b/target/linux/ath79/dts/qca953x.dtsi
index 7774d073e7..3bbd7acfd8 100644
--- a/target/linux/ath79/dts/qca953x.dtsi
+++ b/target/linux/ath79/dts/qca953x.dtsi
@@ -246,8 +246,7 @@
resets = <&rst 8>;
reset-names = "switch";
phy-mode = "gmii";
- qca,phy4-mii-enable;
- qca,mib-poll-interval = <500>;
+ phy4-mii-enable;
mdio-bus {
#address-cells = <1>;
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index f3690897ee..0782f9c980 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -211,9 +211,6 @@ qxwlan,e750a-v4-16m)
ucidef_set_led_switch "lan" "LAN" "green:lan" "switch0" "0x02"
ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
;;
-glinet,gl-x750)
- ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
- ;;
hak5,lan-turtle)
ucidef_set_led_netdev "wan" "WAN" "orange:system" "eth1"
;;
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 783895525b..cbca18fef4 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -12,8 +12,7 @@ case "$FIRMWARE" in
case $board in
allnet,all-wap02860ac|\
engenius,eap1200h|\
- engenius,enstationac-v1|\
- glinet,gl-x750)
+ engenius,enstationac-v1)
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2)
;;
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index d178f437ca..7ea12da0b2 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1167,15 +1167,6 @@ define Device/glinet_gl-ar750
endef
TARGET_DEVICES += glinet_gl-ar750
-define Device/glinet_gl-x750
- SOC := qca9531
- DEVICE_VENDOR := GL.iNet
- DEVICE_MODEL := GL-X750
- DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca9887-ct
- IMAGE_SIZE := 16000k
-endef
-TARGET_DEVICES += glinet_gl-x750
-
define Device/hak5_lan-turtle
$(Device/tplink-16mlzma)
SOC := ar9331
diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index 9dd7a5b6ff..4831a13ab9 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -153,7 +153,7 @@ TARGET_DEVICES += glinet_gl-ar300m-nor
define Device/glinet_gl-mifi
SOC := ar9331
- DEVICE_VENDOR := GL.iNET
+ DEVICE_VENDOR := GL.iNet
DEVICE_MODEL := GL-MIFI
DEVICE_PACKAGES := kmod-usb-chipidea2
IMAGE_SIZE := 16000k
@@ -202,6 +202,34 @@ define Device/glinet_gl-xe300-iot
endef
TARGET_DEVICES += glinet_gl-xe300-iot
+define Device/glinet_gl-x750-common
+ SOC := qca9531
+ DEVICE_VENDOR := GL.iNet
+ DEVICE_MODEL := GL-X750
+ DEVICE_PACKAGES := kmod-usb2 kmod-ath10k ath10k-firmware-qca9887 block-mount PCI_SUPPORT kmod-usb-storage
+ SUPPORTED_DEVICES += gl-x750 glinet,gl-x750
+endef
+
+define Device/glinet_gl-x750-nor
+ $(Device/glinet_gl-x750-common)
+ DEVICE_VARIANT := NOR
+ IMAGE_SIZE := 16000k
+endef
+TARGET_DEVICES += glinet_gl-x750-nor
+
+define Device/glinet_gl-x750-nor-nand
+ $(Device/glinet_gl-x750-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 | append-gl-metadata
+ IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | append-gl-metadata
+endef
+TARGET_DEVICES += glinet_gl-x750-nor-nand
+
define Device/glinet_gl-ar750s-common
SOC := qca9563
DEVICE_VENDOR := GL.iNet
diff --git a/target/linux/ath79/nand/base-files/etc/board.d/01_leds b/target/linux/ath79/nand/base-files/etc/board.d/01_leds
index 9369f15f89..d9917bb3d2 100755
--- a/target/linux/ath79/nand/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/nand/base-files/etc/board.d/01_leds
@@ -41,6 +41,11 @@ glinet,gl-ar750)
ucidef_set_led_wlan "wlan2g" "WLAN2G" "gl-ar750:white:wlan2g" "phy1tpt"
ucidef_set_led_wlan "wlan5g" "WLAN5G" "gl-ar750:white:wlan5g" "phy0tpt"
;;
+glinet,gl-x750-nor|\
+glinet,gl-x750-nor-nand)
+ ucidef_set_led_netdev "wan" "WAN" "gl-x750:green:wan" "eth0"
+ ucidef_set_led_netdev "3gnet" "LTE" "gl-x750:green:lte" "wwan0"
+ ;;
netgear,wndr3700-v4|\
netgear,wndr4300|\
netgear,wndr4300sw|\
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 0b5a63d4f5..5912a4504a 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
@@ -27,6 +27,8 @@ ath79_setup_interfaces()
glinet,gl-ar300m-nand|\
glinet,gl-x300b-nor|\
glinet,gl-x300b-nor-nand|\
+ glinet,gl-x750-nor|\
+ glinet,gl-x750-nor-nand|\
glinet,gl-ar150|\
glinet,gl-mifi)
ucidef_set_interfaces_lan_wan "eth1" "eth0"
diff --git a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 3226d4f7b1..c1c1c18500 100644
--- a/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/nand/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -14,12 +14,16 @@ case "$FIRMWARE" in
ath10k_patch_mac $(mtd_get_mac_binary art 0x12)
;;
glinet,gl-ar750|\
- glinet,gl-ar750s|\
glinet,gl-ar750s-nor|\
glinet,gl-ar750s-nor-nand)
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1)
;;
+ glinet,gl-x750-nor|\
+ glinet,gl-x750-nor-nand)
+ caldata_extract "art" 0x5000 0x844
+ ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +3)
+ ;;
zyxel,nbg6716)
caldata_extract "art" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1)
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 c9b336898e..21951ceba2 100644
--- a/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/nand/base-files/lib/upgrade/platform.sh
@@ -18,10 +18,8 @@ platform_do_upgrade() {
glinet,gl-ar300m-nor)
glinet_nand_nor_do_upgrade "$1"
;;
- glinet,gl-ar750s-nor|\
- glinet,gl-ar750s-nor-nand)
- nand_nor_do_upgrade "$1"
- ;;
+ glinet,gl-x750-nor-nand|\
+ glinet,gl-ar750s-nor-nand|\
glinet,gl-xe300-iot|\
glinet,gl-xe300-nor-nand)
nand_nor_do_upgrade "$1"
--
2.17.1