[From nobody Thu Jun 25 05:54:59 2020
Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532])
 by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux))
 id 1gde4P-0007Mj-SD
 for openwrt-devel@lists.openwrt.org; Sun, 30 Dec 2018 16:36:11 +0000
Received: by mail-ed1-x532.google.com with SMTP id f23so21146249edb.3
 for &lt;openwrt-devel@lists.openwrt.org&gt;; Sun, 30 Dec 2018 08:35:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=googlemail.com; s=20161025;
 h=from:to:subject:date:message-id:in-reply-to:references:mime-version
 :content-transfer-encoding;
 bh=1gcqna+mWMFyZctIDtF7CFu50RdFL4chVvbRAaRfkiM=;
 b=pGhP+E9NnCrWdEF6OA1Xds90J53whZWfQsNC445/W8h9x7I92qiD0UrqJppL+Zk8MX
 /Ubyw2cCAGrdUAx1TXA2nqSHV1eH+4YDpOl60Ud4bUSdqaFyt0HUXi+LH+LgrpP+DRRn
 SgotCi0mctR2gz0AtU9av7HRigNN9J7qADzpbbHJ7D+2JAf7NGWhDLmfuVdeFLGCCQHD
 Ce3KqPzW9QH3eKBd/9/Owy5MfXPEX7XBeWdJ4oVfeWEIS5RYf0o3kcTpFlMydNZDLdfr
 1oDJEhEDnb5MofxkjHA24uTCje9KHOtkQYGsK7jtmdkge1PZ2Il/8wHx3ZA6nhmwLRmI
 0CAg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=1gcqna+mWMFyZctIDtF7CFu50RdFL4chVvbRAaRfkiM=;
 b=m8jWHFCKt0CmjekLA5vl0ryDdqR2fttDcvDYT81sxR7ZuRDP4jtfV2X3QZSEBH9kQm
 Lw/85be3Op6IO5BO4xhWMTEd94Zlls9bgTgQo+x3u0tYvzpv4qe1UZNj5k/zB8Ix/ns5
 1N28wAq8rEIlY7ausE9kP2trc5i1+DObMgi7eC6Ed9+FvsbLUiJmKaRtQ3s7AQhBAUo4
 eDWO30M89wihJ+NUyj9ywu6qDngTWURaXRlZNfcJoSSZo4KzUCqYkA+bXGEyRyan0x8v
 WdcwbS3GECNHHnQV2+OTEXZqTXequBGC443CMQOsvEIG9fANvqZLHtludBnd1xZLHtti
 eFPA==
X-Gm-Message-State: AA+aEWYZkDOy7L88+zIcveS6/Beeaw4Zr+tfOgk9137muP6BsUhqw/hi
 k33TSVELAW7gwvLpmO+MY7e4tlr1L5U=
X-Google-Smtp-Source: AFSGD/WnWR7hJcI4OKNBeAzSA9HXzkxTlmGTEsw+MWJK+e8uB5Odceq7H+xfIEssAJuEMnrnjer1hg==
X-Received: by 2002:a50:b006:: with SMTP id i6mr29967145edd.84.1546187757958; 
 Sun, 30 Dec 2018 08:35:57 -0800 (PST)
Received: from precision.congress.ccc.de ([151.217.213.156])
 by smtp.gmail.com with ESMTPSA id b45sm17230632eda.34.2018.12.30.08.35.57
 for &lt;openwrt-devel@lists.openwrt.org&gt;
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Sun, 30 Dec 2018 08:35:57 -0800 (PST)
From: Christoph Krapp &lt;achterin@googlemail.com&gt;
To: openwrt-devel@lists.openwrt.org
Subject: [PATCH] ath79: add support for GL.iNet GL-AR750S
Date: Sun, 30 Dec 2018 17:35:41 +0100
Message-Id: &lt;20181230163540.25875-2-achterin@googlemail.com&gt;
X-Mailer: git-send-email 2.19.2
In-Reply-To: &lt;20181230163540.25875-1-achterin@googlemail.com&gt;
References: &lt;20181230163540.25875-1-achterin@googlemail.com&gt;
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20181230_083609_908706_884E6E1C 
X-CRM114-Status: GOOD (  15.99  )
X-Spam-Score: -0.2 (/)
X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary:
 Content analysis details:   (-0.2 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (achterin[at]googlemail.com)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/,
 no trust [2a00:1450:4864:20:0:0:0:532 listed in]
 [list.dnswl.org]
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
 valid
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
 author's domain
 -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from
 envelope-from domain
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature

This patch adds supports for GL-AR750S.
Right now this patch adds nor image generation only.
NAND image generation is not supportet at the moment.
Furtheremore the MicroSD port is not implemented as of now.

Specification:
- SOC: QCA9563 (775MHz)
- Flash: 16 MiB (W25Q128FVSG)
- RAM: 128 MiB DDR2
- Ethernet: 2x 1Gbps LAN + 1x 1Gbps WAN
- Wireless: 2.4GHz (bgn) and 5GHz (ac)
- USB: 1x USB 2.0 port
- Button: 1x switch button, 1x reset button
- LED: 3x LEDS (green)
  - Another LED can be accessed on GPIO 7 if soldered

Flash instruction:
- Set static ip to 192.168.1.2
- Unplug the power cord
- Hold reset button
- Plug power back in
- Right led will flash 5 times
- Release reset button
- Browse to 192.168.1.1
- Choose sysupgrade image in NOR-flash section
- Press &quot;update nor firmware&quot;
- After successful transfer unplug network cable before device restarts

Signed-off-by: Christoph Krapp &lt;achterin@googlemail.com&gt;
---
 .../ath79/base-files/etc/board.d/02_network   |   4 +
 .../etc/hotplug.d/firmware/11-ath10k-caldata  |   9 +-
 .../linux/ath79/dts/qca9563_glinet_ar750s.dts | 153 ++++++++++++++++++
 target/linux/ath79/image/generic.mk           |   9 ++
 4 files changed, 171 insertions(+), 4 deletions(-)
 create mode 100644 target/linux/ath79/dts/qca9563_glinet_ar750s.dts

diff --git a/target/linux/ath79/base-files/etc/board.d/02_network b/target/linux/ath79/base-files/etc/board.d/02_network
index 004ab59573..b9a0f356bf 100755
--- a/target/linux/ath79/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/base-files/etc/board.d/02_network
@@ -93,6 +93,10 @@ ath79_setup_interfaces()
 	glinet,gl-x750)
 		ucidef_set_interfaces_lan_wan &quot;eth1&quot; &quot;eth0&quot;
 		;;
+	glinet,ar750s)
+		ucidef_add_switch &quot;switch0&quot; \
+			&quot;0@eth0&quot; &quot;2:lan:2&quot; &quot;3:lan:1&quot; &quot;1:wan&quot;
+		;;
 	nec,wg800hp)
 		ucidef_add_switch &quot;switch0&quot; \
 			&quot;0@eth0&quot; &quot;2:lan&quot; &quot;3:lan&quot; &quot;4:lan&quot; &quot;1:wan&quot;
diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 53f57be824..2118d2b06b 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -92,6 +92,11 @@ case &quot;$FIRMWARE&quot; in
 		ath10kcal_extract &quot;art&quot; 20480 2116
 		ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0) -1)
 		;;
+	glinet,ar750s|\
+	tplink,re450-v2)
+		ath10kcal_extract &quot;art&quot; 20480 2116
+		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
+		;;
 	glinet,gl-x750)
 		ath10kcal_extract &quot;art&quot; 20480 2116
 		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
@@ -122,10 +127,6 @@ case &quot;$FIRMWARE&quot; in
 		ath10kcal_extract &quot;art&quot; 20480 2116
 		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1)
 		;;
-	tplink,re450-v2)
-		ath10kcal_extract &quot;art&quot; 20480 2116
-		ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1)
-		;;
 	ubnt,unifiac-lite|\
 	ubnt,unifiac-mesh|\
 	ubnt,unifiac-mesh-pro|\
diff --git a/target/linux/ath79/dts/qca9563_glinet_ar750s.dts b/target/linux/ath79/dts/qca9563_glinet_ar750s.dts
new file mode 100644
index 0000000000..b46a75c4af
--- /dev/null
+++ b/target/linux/ath79/dts/qca9563_glinet_ar750s.dts
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+/dts-v1/;
+
+#include &lt;dt-bindings/gpio/gpio.h&gt;
+#include &lt;dt-bindings/input/input.h&gt;
+
+#include &quot;qca956x.dtsi&quot;
+
+/ {
+	compatible = &quot;glinet,ar750s&quot;, &quot;qca,qca9563&quot;;
+	model = &quot;GL.iNet GL-AR750S&quot;;
+
+	chosen {
+		bootargs = &quot;console=ttyS0,115200n8&quot;;
+	};
+
+	aliases {
+		led-boot = &power;
+		led-failsafe = &power;
+		led-running = &power;
+		led-upgrade = &power;
+	};
+
+	keys {
+		compatible = &quot;gpio-keys-polled&quot;;
+		poll-interval = &lt;20&gt;;
+		pinctrl-names = &quot;default&quot;;
+		pinctrl-0 = &lt;&amp;jtag_disable_pins&gt;;
+
+		button0 {
+			label = &quot;reset&quot;;
+			linux,code = &lt;KEY_RESTART&gt;;
+			gpios = &lt;&amp;gpio 2 GPIO_ACTIVE_LOW&gt;;
+		};
+
+		button1 {
+			label = &quot;button right&quot;;
+			linux,code = &lt;BTN_0&gt;;
+			gpios = &lt;&amp;gpio 8 GPIO_ACTIVE_LOW&gt;;
+		};
+	};
+
+	leds {
+		compatible = &quot;gpio-leds&quot;;
+
+		power: power {
+			label = &quot;gl-ar750s:green:power&quot;;
+			gpios = &lt;&amp;gpio 1 GPIO_ACTIVE_LOW&gt;;
+			default-state = &quot;keep&quot;;
+		};
+
+		wlan2g {
+			label = &quot;gl-ar750s:green:wlan2g&quot;;
+			gpios = &lt;&amp;gpio 19 GPIO_ACTIVE_LOW&gt;;
+			linux,default-trigger = &quot;phy1tpt&quot;;
+		};
+
+		wlan5g {
+			label = &quot;gl-ar750s:green:wlan5g&quot;;
+			gpios = &lt;&amp;gpio 20 GPIO_ACTIVE_HIGH&gt;;
+			linux,default-trigger = &quot;phy0tpt&quot;;
+		};
+	};
+};
+
+&amp;spi {
+	status = &quot;okay&quot;;
+	num-cs = &lt;0&gt;;
+
+	flash@0 {
+		compatible = &quot;jedec,spi-nor&quot;;
+		reg = &lt;0&gt;;
+		spi-max-frequency = &lt;25000000&gt;;
+
+		partitions {
+			compatible = &quot;fixed-partitions&quot;;
+			#address-cells = &lt;1&gt;;
+			#size-cells = &lt;1&gt;;
+
+			partition@0 {
+				label = &quot;u-boot&quot;;
+				reg = &lt;0x000000 0x040000&gt;;
+				read-only;
+			};
+
+			partition@40000 {
+				label = &quot;u-boot-env&quot;;
+				reg = &lt;0x040000 0x010000&gt;;
+			};
+
+			art: partition@50000 {
+				label = &quot;art&quot;;
+				reg = &lt;0x050000 0x010000&gt;;
+			};
+
+			partition@60000 {
+				compatible = &quot;denx,uimage&quot;;
+				label = &quot;firmware&quot;;
+				reg = &lt;0x060000 0xfa0000&gt;;
+			};
+		};
+	};
+};
+
+&amp;pcie {
+	status = &quot;okay&quot;;
+};
+
+&amp;uart {
+	status = &quot;okay&quot;;
+};
+
+&amp;usb0 {
+	#address-cells = &lt;1&gt;;
+	#size-cells = &lt;0&gt;;
+	status = &quot;okay&quot;;
+
+	hub_port: port@1 {
+		reg = &lt;1&gt;;
+		#trigger-source-cells = &lt;0&gt;;
+	};
+};
+
+&amp;usb_phy0 {
+	status = &quot;okay&quot;;
+};
+
+&amp;mdio0 {
+	status = &quot;okay&quot;;
+	phy-mask = &lt;0&gt;;
+
+	phy0: ethernet-phy@0 {
+		reg = &lt;0&gt;;
+		phy-mode = &quot;sgmii&quot;;
+		qca,ar8327-initvals = &lt;
+			0x04 0x00080080 /* PORT0 PAD MODE CTRL */
+			0x7c 0x0000007e /* PORT0_STATUS */
+		&gt;;
+	};
+};
+
+&amp;eth0 {
+	status = &quot;okay&quot;;
+
+	mtd-mac-address = &lt;&amp;art 0x0&gt;;
+	phy-handle = &lt;&amp;phy0&gt;;
+};
+
+&amp;wmac {
+	status = &quot;okay&quot;;
+	mtd-cal-data = &lt;&amp;art 0x1000&gt;;
+	mtd-mac-address = &lt;&amp;art 0x1002&gt;;
+};
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index b2f83ba58c..c61148d50e 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -237,6 +237,15 @@ define Device/glinet_ar300m-nor
 endef
 TARGET_DEVICES += glinet_ar300m-nor
 
+define Device/glinet_ar750s
+  ATH_SOC := qca9563
+  DEVICE_TITLE := GL.iNet GL-AR750S
+  DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct ath10k-firmware-qca988x-ct
+  IMAGE_SIZE := 16000k
+  SUPPORTED_DEVICES += gl-ar750s
+endef
+TARGET_DEVICES += glinet_ar750s
+
 define Device/glinet_gl-x750
   ATH_SOC := qca9531
   DEVICE_TITLE := GL.iNet GL-X750
-- 
2.19.2


]