lantiq: Update TP-Link TD-W89x0 flash layout and convert to nvmem

Flash space is scarce on 8MB devices, this commit adds 124KB of usable
space by reusing OEM user configuration and unused space. I also split
the partitions to seperate MAC Address & WPS key, Memory configuration,
and Wi-Fi calibration data.

This commit also switches from userspace script to using nvmem for ath9k
calibration data.

Signed-off-by: Mustafa Can Elmacı <mustafacan@elmaci.net>
This commit is contained in:
Mustafa Can Elmacı 2024-11-04 13:51:27 +03:00
parent 11ba2b141f
commit b8a6551435
3 changed files with 39 additions and 21 deletions

View File

@ -113,7 +113,7 @@
};
&eth0 {
nvmem-cells = <&macaddr_ath9k_cal_f100 0>;
nvmem-cells = <&boardconfig_macaddr 0>;
nvmem-cell-names = "mac-address";
};
@ -205,10 +205,9 @@
reg = <0 0 0 0 0>;
#gpio-cells = <2>;
gpio-controller;
qca,no-eeprom;
ieee80211-freq-limit = <2402000 2482000>;
nvmem-cells = <&macaddr_ath9k_cal_f100 2>;
nvmem-cell-names = "mac-address";
nvmem-cells = <&ath9k_cal>, <&boardconfig_macaddr 2>;
nvmem-cell-names = "calibration", "mac-address";
};
};
};
@ -234,18 +233,13 @@
};
partition@20000 {
reg = <0x20000 0x7a0000>;
reg = <0x20000 0x7bf000>;
label = "firmware";
};
partition@7c0000 {
reg = <0x7c0000 0x10000>;
label = "config";
read-only;
};
ath9k_cal: partition@7d0000 {
reg = <0x7d0000 0x30000>;
/* MAC Adress and WPS PIN */
partition@7df000 {
reg = <0x7df000 0x1000>;
label = "boardconfig";
read-only;
@ -254,11 +248,39 @@
#address-cells = <1>;
#size-cells = <1>;
macaddr_ath9k_cal_f100: macaddr@f100 {
/* MAC Adress */
boardconfig_macaddr: macaddr@100 {
compatible = "mac-base";
reg = <0xf100 0x6>;
reg = <0x100 0x6>;
#nvmem-cell-cells = <1>;
};
/* 0x7df200 contains WPS PIN used on OEM firmware, unused in OpenWRT */
};
};
/* used by U-Boot to store memory settings */
partition@7e0000 {
reg = <0x7e0000 0x10000>;
label = "ddr_settings";
read-only;
};
/* Wi-Fi calibration data */
partition@7f0000 {
reg = <0x7f0000 0x10000>;
label = "radio";
read-only;
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
ath9k_cal: cal@440 {
reg = <0x1000 0x440>;
};
};
};
};

View File

@ -25,7 +25,7 @@ define Device/tplink_tdw8970
TPLINK_FLASHLAYOUT := 8Mltq
TPLINK_HWID := 0x89700001
TPLINK_HWREV := 1
IMAGE_SIZE := 7680k
IMAGE_SIZE := 7804k
DEVICE_PACKAGES:= kmod-ath9k wpad-basic-mbedtls kmod-usb-dwc2 kmod-usb-ledtrig-usbport
SUPPORTED_DEVICES += TDW8970
endef
@ -39,7 +39,7 @@ define Device/tplink_tdw8980
TPLINK_FLASHLAYOUT := 8Mltq
TPLINK_HWID := 0x89800001
TPLINK_HWREV := 14
IMAGE_SIZE := 7680k
IMAGE_SIZE := 7804k
DEVICE_PACKAGES:= kmod-ath9k kmod-owl-loader wpad-basic-mbedtls kmod-usb-dwc2 kmod-usb-ledtrig-usbport
SUPPORTED_DEVICES += TDW8980
endef

View File

@ -31,10 +31,6 @@ case "$FIRMWARE" in
caldata_extract_ubi "caldata" 0x1000 0x1000
ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c
;;
tplink,tdw8970|\
tplink,tdw8980)
caldata_extract "boardconfig" 0x21000 0x1000
;;
*)
caldata_die "board $board is not supported yet"
;;