From: Rosen Penev Date: Tue, 17 Dec 2024 00:55:55 +0000 (-0800) Subject: lantiq: use nvmem for bthomehub v5a X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fmaster;p=thirdparty%2Fopenwrt.git 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 Link: https://github.com/openwrt/openwrt/pull/17289 Signed-off-by: Robert Marko --- diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi index e0e49f377a7..10fb8d4934e 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9.dtsi @@ -509,7 +509,7 @@ interrupts = <63>; }; - ppe@e234000 { + ppe: ppe@e234000 { compatible = "lantiq,ppe-xrx200"; reg = <0xe234000 0x3ffd>; interrupt-parent = <&icu0>; diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts index cb6cb74af82..994b5083233 100644 --- a/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts +++ b/target/linux/lantiq/files/arch/mips/boot/dts/lantiq/vr9_bt_homehub-v5a.dts @@ -151,6 +151,11 @@ }; }; +ð0 { + nvmem-cells = <&macaddr_caldata_110c 0>; + nvmem-cell-names = "mac-address"; +}; + &gswip { pinctrl-0 = <&mdio_pins>; pinctrl-names = "default"; @@ -210,9 +215,17 @@ tx-internal-delay-ps = <1500>; rx-internal-delay-ps = <1500>; phy-handle = <&phy5>; + + nvmem-cells = <&macaddr_caldata_110c 4>; + nvmem-cell-names = "mac-address"; }; }; +&ppe { + nvmem-cells = <&macaddr_caldata_110c 5>; + nvmem-cell-names = "mac-address"; +}; + &localbus { flash@1 { compatible = "lantiq,nand-xway"; @@ -248,8 +261,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 +302,32 @@ 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 { + pcie@0 { + reg = <0x0000 0 0 0 0>; + #interrupt-cells = <1>; + #size-cells = <2>; + #address-cells = <3>; + device_type = "pci"; + + wifi@0,0 { + compatible = "qcom,ath10k"; + reg = <0x0000 0 0 0 0>; + nvmem-cells = <&cal_caldata_5000>, <&macaddr_caldata_110c 3>; + nvmem-cell-names = "calibration", "mac-address"; + }; + }; +}; + &usb_phy0 { status = "okay"; }; diff --git a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network index bf907578970..ca40c9cbd68 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network +++ b/target/linux/lantiq/xrx200/base-files/etc/board.d/02_network @@ -128,8 +128,7 @@ lantiq_setup_macs() label_mac=$lan_mac ;; bt,homehub-v5a) - lan_mac=$(mtd_get_mac_binary_ubi caldata 0x110c) - wan_mac=$(macaddr_add "$lan_mac" 1) + wan_mac=$(macaddr_add "$(mtd_get_mac_binary_ubi caldata 0x110c)" 5) ;; buffalo,wbmr-300hpd) lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr) diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata deleted file mode 100644 index c555aa2c12c..00000000000 --- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ /dev/null @@ -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 diff --git a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index cb3fef91687..a3968b2303e 100644 --- a/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/xrx200/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -27,10 +27,6 @@ case "$FIRMWARE" in /usr/bin/fritz_cal_extract -r -i 4 -s 0x1e000 -e 0x207 -l 5120 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") || \ /usr/bin/fritz_cal_extract -r -i 4 -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" ;; diff --git a/target/linux/lantiq/xrx200/config-6.12 b/target/linux/lantiq/xrx200/config-6.12 index ab46229c0e3..ad8a4544cec 100644 --- a/target/linux/lantiq/xrx200/config-6.12 +++ b/target/linux/lantiq/xrx200/config-6.12 @@ -44,6 +44,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