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.

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-12-19 17:11:44 +03:00
parent a5f9fad1ac
commit 3d52754eed
5 changed files with 18 additions and 21 deletions

View File

@ -6,13 +6,13 @@
}; };
&boardconfig { &boardconfig {
cal_boardconfig_21000: calibration@21000 { boardconfig_cal: calibration@12000 {
reg = <0x21000 0x440>; reg = <0x12000 0x440>;
}; };
}; };
&ath9k { &ath9k {
compatible = "pci168c,0030"; compatible = "pci168c,0030";
nvmem-cells = <&macaddr_ath9k_cal_f100 2>, <&cal_boardconfig_21000>; nvmem-cells = <&boardconfig_macaddr 2>, <&boardconfig_cal>;
nvmem-cell-names = "mac-address", "calibration"; nvmem-cell-names = "mac-address", "calibration";
}; };

View File

@ -29,13 +29,13 @@
}; };
&boardconfig { &boardconfig {
cal_boardconfig_21000: calibration@21000 { boardconfig_cal: calibration@12000 {
reg = <0x21000 0x3d8>; reg = <0x12000 0x3d8>;
}; };
}; };
&ath9k { &ath9k {
compatible = "pci168c,002e"; compatible = "pci168c,002e";
nvmem-cells = <&macaddr_ath9k_cal_f100 2>, <&cal_boardconfig_21000>; nvmem-cells = <&boardconfig_macaddr 2>, <&boardconfig_cal>;
nvmem-cell-names = "mac-address", "calibration"; nvmem-cell-names = "mac-address", "calibration";
}; };

View File

@ -113,7 +113,7 @@
}; };
&eth0 { &eth0 {
nvmem-cells = <&macaddr_ath9k_cal_f100 0>; nvmem-cells = <&boardconfig_macaddr 0>;
nvmem-cell-names = "mac-address"; nvmem-cell-names = "mac-address";
}; };
@ -230,18 +230,12 @@
}; };
partition@20000 { partition@20000 {
reg = <0x20000 0x7a0000>; reg = <0x20000 0x7bf000>;
label = "firmware"; label = "firmware";
}; };
partition@7c0000 { partition@7df000 {
reg = <0x7c0000 0x10000>; reg = <0x7df000 0x21000>;
label = "config";
read-only;
};
partition@7d0000 {
reg = <0x7d0000 0x30000>;
label = "boardconfig"; label = "boardconfig";
read-only; read-only;
@ -250,11 +244,14 @@
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
macaddr_ath9k_cal_f100: macaddr@f100 { /* MAC Adress */
boardconfig_macaddr: macaddr@100 {
compatible = "mac-base"; compatible = "mac-base";
reg = <0xf100 0x6>; reg = <0x100 0x6>;
#nvmem-cell-cells = <1>; #nvmem-cell-cells = <1>;
}; };
/* <0x7df200 0x8> contains WPS PIN used on OEM firmware, unused in OpenWRT */
/* <0x7e0000 0x18> used by U-Boot to store memory settings */
}; };
}; };
}; };

View File

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

View File

@ -57,7 +57,7 @@ lantiq_setup_macs()
;; ;;
tplink,tdw8970|\ tplink,tdw8970|\
tplink,tdw8980) tplink,tdw8980)
wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0xf100)" 1) wan_mac=$(macaddr_add "$(mtd_get_mac_binary boardconfig 0x100)" 1)
;; ;;
esac esac