From b403a6e1241c00f509b201ec2ac8ca5f29e1ffd1 Mon Sep 17 00:00:00 2001
From: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Date: Sat, 28 Nov 2020 12:08:42 +0100
Subject: [PATCH] ath79: add support for the Belkin F9K1115 v2 (AC1750 DB
 Wi-Fi)

This device has (almost?) identical hardware to the F9J1108 v2 but uses
a different firmware magic and model number.

Specifications:

SoC: QCA9558
CPU: 720 MHz
Flash: 16 MiB NOR
RAM: 128 MiB
WiFi 2.4 GHz: QCA9558-AT4A 3x3 MIMO 802.11b/g/n
WiFi 5 GHz: QCA9880-2R4E 3x3 MIMO 802.11a/n/ac
Ethernet: 4x LAN and 1x WAN (all 1Gbit/s ports)
USB: 1 x USB 2.0 (lower), 1 x USB 3.0 (upper)

MAC addresses based on OEM firmware:

Interface   Address   Location
---------   -------   --------
lan         *:5A      sometimes in 0x6
wan         *:5B      0x0
2.4Ghz      *:5A      0x1002
5Ghz        As per mini PCIe EEPROM

Flashing instructions:

The factory.bin can be flashed via the Belkin web UI or via the uboot
HTTP upgrade page (which is by default listening on 192.168.2.1). Once
the factory.bin has been written, sysupgrade.bin will work as usual.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
 target/linux/ath79/dts/qca9558_belkin_f9k1115-v2.dts      | 8 ++++++++
 .../linux/ath79/generic/base-files/etc/board.d/02_network | 1 +
 target/linux/ath79/image/generic.mk                       | 8 ++++++++
 3 files changed, 17 insertions(+)
 create mode 100644 target/linux/ath79/dts/qca9558_belkin_f9k1115-v2.dts

diff --git a/target/linux/ath79/dts/qca9558_belkin_f9k1115-v2.dts b/target/linux/ath79/dts/qca9558_belkin_f9k1115-v2.dts
new file mode 100644
index 000000000000..aa5851c2e820
--- /dev/null
+++ b/target/linux/ath79/dts/qca9558_belkin_f9k1115-v2.dts
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0-or-later OR MIT
+
+#include "qca9558_belkin_f9x-v2.dtsi"
+
+/ {
+	model = "Belkin F9K1115 v2 (AC 1750 DB)";
+	compatible = "belkin,f9k1115-v2", "qca,qca9558";
+};
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index 987b405431b6..905848a2badc 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -101,6 +101,7 @@ ath79_setup_interfaces()
 			"0@eth0" "1:lan:1" "2:lan:4" "3:lan:3" "4:lan:2"
 		;;
 	belkin,f9j1108-v2|\
+	belkin,f9k1115-v2|\
 	tplink,archer-c5-v1|\
 	tplink,archer-c7-v1|\
 	tplink,archer-c7-v2|\
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 02fdf8ecad70..b3fca9eb8f7f 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -410,6 +410,14 @@ define Device/belkin_f9j1108-v2
 endef
 TARGET_DEVICES += belkin_f9j1108-v2
 
+define Device/belkin_f9k1115-v2
+  $(Device/belkin_f9x-v2)
+  DEVICE_MODEL := F9K1115 v2 (AC1750 DB Wi-Fi)
+  EDIMAX_HEADER_MAGIC := eDiMaX
+  EDIMAX_HEADER_MODEL := F9K1115V2
+endef
+TARGET_DEVICES += belkin_f9k1115-v2
+
 define Device/buffalo_bhr-4grv
   $(Device/buffalo_common)
   SOC := ar7242
-- 
2.30.2