[PATCH RFC] ath79: switch TP-Link Archer C59 v1 to read partitions table

Rafał Miłecki zajec5 at gmail.com
Thu Nov 10 03:13:13 PST 2022


From: Rafał Miłecki <rafal at milecki.pl>

So far DTS file for C59 V1 model was assuming flash partitions were
fixed. It just used a little quirk with a custom "firmware" partition
covering both: "os-image" and "file-system" to avoid hardcoding their
offsets and sizes.

That solution works quite reliably in most cases. "firmware" hack is a
very minor one. Partitions other that "os-image" and "file-system" are
rather never reorganized (thought they probably could be during firmware
upgrade).

This change is a minor design and code cleanup. It makes kernel read
"partition-table" flash partition to register all partitions specified
there.

Benefits:
1. Partitions may get changed / reorganized without breaking things
2. We don't hardcode & duplicate info about flash partitions in DT
3. Linux doesn't have to split "firmware" partition (less magic)

RFC part:
This change gets rid of "firmware" partition as it isn't defined in the
"partition-table". That probably breaks OpenWrt's sysupgrade.

Signed-off-by: Rafał Miłecki <rafal at milecki.pl>
---
 .../dts/qca9561_tplink_archer-c59-v1.dts      | 33 ++++---------------
 1 file changed, 6 insertions(+), 27 deletions(-)

diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
index c385eb1592..6d1d1602fa 100644
--- a/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c59-v1.dts
@@ -44,38 +44,17 @@
 		spi-max-frequency = <25000000>;
 
 		partitions {
-			compatible = "fixed-partitions";
-			#address-cells = <1>;
-			#size-cells = <1>;
-
-			partition at 0 {
-				label = "u-boot";
-				reg = <0x000000 0x010000>;
-				read-only;
-			};
-
-			info: partition at 10000 {
-				label = "info";
-				reg = <0x010000 0x010000>;
-				read-only;
-			};
+			compatible = "tplink,safeloader-partitions";
+			partitions-table-offset = <0xe50000>;
 
-			partition at 20000 {
-				compatible = "denx,uimage";
-				label = "firmware";
-				reg = <0x020000 0xe30000>;
+			partition-file-system {
+				linux,rootfs;
 			};
 
-			partition at e50000 {
-				label = "tplink";
-				reg = <0xe50000 0x1a0000>;
-				read-only;
+			info: partition-default-mac {
 			};
 
-			art: partition at ff0000 {
-				label = "art";
-				reg = <0xff0000 0x010000>;
-				read-only;
+			art: partition-radio {
 			};
 		};
 	};
-- 
2.34.1




More information about the openwrt-devel mailing list