lantiq: use nvmem for bthomehub v5a

Userspace handling of both calibration and mac addresses is deprecated.

Also fixed calibration size for ath9k. AR9287 uses 3d8 for its size.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2024-12-16 16:55:55 -08:00
parent f077e058fd
commit 8239dd635a
5 changed files with 45 additions and 30 deletions

View File

@ -154,6 +154,8 @@
&gswip {
pinctrl-0 = <&mdio_pins>;
pinctrl-names = "default";
nvmem-cells = <&macaddr_caldata_110c 0>;
nvmem-cell-names = "mac-address";
};
&gswip_mdio {
@ -210,6 +212,9 @@
tx-internal-delay-ps = <1500>;
rx-internal-delay-ps = <1500>;
phy-handle = <&phy5>;
nvmem-cells = <&macaddr_caldata_110c 1>;
nvmem-cell-names = "mac-address";
};
};
@ -248,8 +253,35 @@
reg = <0xc0000 0x40000>;
};
partition@100000 {
compatible = "linux,ubi";
label = "ubi";
reg = <0x100000 0x7e80000>;
volumes {
ubi-volume-caldata {
volname = "caldata";
nvmem-layout {
compatible = "fixed-layout";
#address-cells = <1>;
#size-cells = <1>;
cal_caldata_1000: calibration@1000 {
reg = <0x1000 0x3d8>;
};
macaddr_caldata_110c: macaddr@110c {
compatible = "mac-base";
reg = <0x110c 0x6>;
#nvmem-cell-cells = <1>;
};
cal_caldata_5000: calibration@5000 {
reg = <0x5000 0x844>;
};
};
};
};
};
/*
* last 512 KiB are for the bad block table, not writable
@ -262,14 +294,24 @@
status = "okay";
reset-gpios = <&gpio 21 GPIO_ACTIVE_LOW>;
wifi@168c,002d {
wifi@0,0 {
compatible = "pci168c,002d";
reg = <0x7000 0 0 0 0>;
qca,no-eeprom; /* load from ath9k-eeprom-pci-0000:00:0e.0.bin */
nvmem-cells = <&cal_caldata_1000>, <&macaddr_caldata_110c 2>;
nvmem-cell-names = "calibration", "mac-address";
ieee80211-freq-limit = <2402000 2482000>;
};
};
&pcie0 {
wifi@0,0 {
compatible = "qcom,ath10k";
reg = <0x7000 0 0 0 0>;
nvmem-cells = <&cal_caldata_5000>, <&macaddr_caldata_110c 3>;
nvmem-cell-names = "calibration", "mac-address";
};
};
&usb_phy0 {
status = "okay";
};

View File

@ -128,10 +128,6 @@ lantiq_setup_macs()
lan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n maca -o)
wan_mac=$(/usr/bin/fritz_tffs_nand -d $tffsdev -n macdsl -o)
;;
bt,homehub-v5a)
lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c)
wan_mac=$(macaddr_add "$lan_mac" 1)
;;
buffalo,wbmr-300hpd)
lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
wan_mac="$lan_mac"

View File

@ -1,20 +0,0 @@
#!/bin/sh
[ -e /lib/firmware/$FIRMWARE ] && exit 0
. /lib/functions/caldata.sh
case "$FIRMWARE" in
"ath10k/cal-pci-0000:02:00.0.bin")
board=$(board_name)
case $board in
bt,homehub-v5a)
caldata_extract_ubi "caldata" 0x5000 0x844
ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 3)
;;
*)
caldata_die "board $board is not supported yet"
;;
esac
;;
esac

View File

@ -27,10 +27,6 @@ case "$FIRMWARE" in
/usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \
/usr/bin/fritz_cal_extract -i 1 -s 0x1e800 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader")
;;
bt,homehub-v5a)
caldata_extract_ubi "caldata" 0x1000 0x1000
ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) 2) 0x10c
;;
*)
caldata_die "board $board is not supported yet"
;;

View File

@ -46,6 +46,7 @@ CONFIG_MTD_RAW_NAND=y
CONFIG_MTD_UBI=y
CONFIG_MTD_UBI_BEB_LIMIT=20
CONFIG_MTD_UBI_BLOCK=y
CONFIG_MTD_UBI_NVMEM=y
CONFIG_MTD_UBI_WL_THRESHOLD=4096
CONFIG_NEED_SRCU_NMI_SAFE=y
CONFIG_NET_DEVLINK=y