From 872b65ecc882c6b9afda9582932c62bc43b6745e Mon Sep 17 00:00:00 2001
From: Tamas Balogh <tamasbalogh@hotmail.com>
Date: Sat, 15 Jan 2022 00:56:51 +0100
Subject: [PATCH] ath79: patch Asus RP-AC66 clean up and fix for sysupgrade
 image

- clean up leftovers regarding MAC configure in dts
- fix alphabetical order in caldata
- IMAGE_SIZE for sysupgrade image

Signed-off-by: Tamas Balogh <tamasbalogh@hotmail.com>
---
 target/linux/ath79/dts/qca9563_asus_rp-ac66.dts           | 1 +
 .../linux/ath79/generic/base-files/etc/board.d/02_network | 4 ----
 .../base-files/etc/hotplug.d/firmware/11-ath10k-caldata   | 8 ++++----
 target/linux/ath79/image/generic.mk                       | 1 +
 4 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts b/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts
index b1317d55ec..39c96127e6 100644
--- a/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts
+++ b/target/linux/ath79/dts/qca9563_asus_rp-ac66.dts
@@ -15,6 +15,7 @@
 		led-failsafe = &led_orange;
 		led-running = &led_power;
 		led-upgrade = &led_orange;
+		label-mac-device = &eth0;
 	};
 
 	leds {
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 e49e9bd3a1..88269c03ec 100644
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -534,10 +534,6 @@ ath79_setup_macs()
 		lan_mac=$(macaddr_setbit $base_mac 29)
 		[ $lan_mac = $base_mac ] && lan_mac=$(macaddr_unsetbit $base_mac 29)
 		;;
-	asus,rp-ac66)
-		lan_mac=$(mtd_get_mac_binary art 0x1002)
-		label_mac=$lan_mac
-		;;
 	avm,fritz1750e|\
 	avm,fritz450e|\
 	avm,fritzdvbc)
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 c0e5078bdb..6da323facc 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
@@ -17,10 +17,6 @@ case "$FIRMWARE" in
 		caldata_extract "art" 0x5000 0x844
 		ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) 2)
 		;;
-	avm,fritz1750e|\
-	avm,fritzdvbc)
-		caldata_extract "urlader" 0x198a 0x844
-		;;
 	asus,rp-ac66|\
 	comfast,cf-wr650ac-v1|\
 	comfast,cf-wr650ac-v2|\
@@ -50,6 +46,10 @@ case "$FIRMWARE" in
 	yuncore,a770)
 		caldata_extract "art" 0x5000 0x844
 		;;
+	avm,fritz1750e|\
+	avm,fritzdvbc)
+		caldata_extract "urlader" 0x198a 0x844
+		;;
 	devolo,dvl1200e|\
 	devolo,dvl1200i|\
 	devolo,dvl1750c|\
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 8e97fec402..2cd24ab67b 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -334,6 +334,7 @@ define Device/asus_rp-ac66
   SOC := qca9563
   DEVICE_VENDOR := ASUS
   DEVICE_MODEL := RP-AC66
+  IMAGE_SIZE := 15488k
   IMAGES += factory.bin
   IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
 	append-rootfs | pad-rootfs
-- 
2.30.2