From patchwork Mon Oct 14 12:02:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Schmutzler X-Patchwork-Id: 1176291 X-Patchwork-Delegate: mail@david-bauer.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adrianschmutzler.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="L9tgyItg"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46sHJR4Tzyz9sPT for ; Mon, 14 Oct 2019 23:03:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=PAul6QOgPNpVZBTHLQtlGWb1GAAc2ZEAGUCApeuELDw=; b=L9tgyItgOZ48nx s1lfcBZGJSoaXYos6yFjQv/f4+Vyt7gosbKwazLtT2ydKsTpdNqlAus2dQ/Yut8i93eBku+Z0h7je y4RukNTdJtyvX9kOf6KS61M/+HHdqyVAItIGweFjxzRk2aI1hBlszfqW4cBKoXdq/pkqJrN/Cibun 3V97fiwWVEZyEt/WZQHxN09/eIy4eKtx38MrLus5ZnpLmO40VQiL95XoqXfkM+5RVnCWPdT8KhCMG HV3PfOkstkngxS/mydvEgMGGxSXWjECgCkwdzlz5s+R0cTKVzvqvH4Shcvg9tWPR0kjhh0Z9sQl3N ZI8sWTVlxcA0ySpIPT6A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iJz44-0003lA-GY; Mon, 14 Oct 2019 12:03:04 +0000 Received: from mout.kundenserver.de ([212.227.17.24]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iJz3p-0003Zl-0n for openwrt-devel@lists.openwrt.org; Mon, 14 Oct 2019 12:02:51 +0000 Received: from buildfff.adridolf.com ([188.192.135.195]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MBmI6-1iCGLo2g2O-00CChY for ; Mon, 14 Oct 2019 14:02:44 +0200 From: Adrian Schmutzler To: openwrt-devel@lists.openwrt.org Date: Mon, 14 Oct 2019 14:02:40 +0200 Message-Id: <20191014120241.2420-1-freifunk@adrianschmutzler.de> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:FHuZpKtQPDHqKQavqjeue0q5ZLaonlaL5tNuOwa1ai1Hk8ayR3F PfHiHBiZ2Fcf7PLw+ccmmwHIe4qqo3QCZl+un+S3eQtvhYwU+r0a5/WQSSoW9tCFU7YjeD7 AQStAlzdqQvilJcAJ3pGjR3rUvq2xgXJm64v0a2BmxLxusPZ45xa7z1PJPzQbIhKaFR4e61 SH/44P/CkO2jngX11ZlXA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:8Sh3v2dTY5w=:JG4B081m341L9/i/HchyZp drHdugpkYdp+WNuZQZn6XhSakOmCA29tjaA1DfvSRcXwoLWWKEEQlQQybnSKD99lPCUzcjeYm 0IAEtqVdPWxaND5fOGSVTHIRRVHSXgvFs4UmijSWr38hZjMovdQWECBEyji4Hs4uO+WYord2/ CUvCSydZi4q13qPSVa03OXFNWCeO8jc66YShSAiCgWur4kTM3dYdUwXhWoM6sqh+VB/iMhUWx zkKzHTgxCChStj+aiESC1HAiAYcVKL9Mlnh3bJAU7HRJEDuTc88DUNIo8sPpECXi+so63o9Sy 22Zbm/kYj6DNasTRzFmNQ8WjYByGlOHfGTtQtMmCcCs7T8/Idq70+exUnnuq5l0iZqhVu8TB9 gEexG2DMKPRyHg+ASZpQUTDcTZECIjQmNKf/xHW6Q3c6CptcRKaY/OS/DGa3pMA5+xnO+R2ds oHUR51xZoPMlbYJNE7WuGgEBnjAuZWNxOsdMJsDd7nG2P+BMrLjbeM/y4AJoQXb8aMu8gYeLQ f2encH0cM4VoFJBHmPdEhL8M3Onr+v3oSkNx0l5jdzDro2RmermCzA7teGtFaTu7gSck0Fw+6 v+uqo9jwl34AByoQ6+jn6NadiM70DW/wZ3pBHX72xSV1BFQyM1MS1ATTSBB896dzm3uuSsl3p tMf0Vs9gv0Dh62rCEEgqWUBtfscP1FF+zCp4lzCwSKFfwH/cBX1cLU13SF+kCBmYLR7/ZXk9y YJND3amVplMzcTvv+xZ4lun48ZrkPX42yDxHGeVD8NJ+xeNouTQjSQ9L5RZrOoZuf9jqUsxMI hQjryLFghuL1gl9g55B44buVcTRajl7DVS2H+eI+R6r9AaH1LcRuFA/XJRZP5GeDvc0uITakf RV4FFXYnhFoAD0pMIlQyVd4RAFjCESsvj5+RFyCXY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191014_050249_363622_5AE7DB4B X-CRM114-Status: UNSURE ( 9.71 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.17.24 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH v3 1/2] treewide: use a single ath10k MAC patching function with checksum X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org While all ath10k eeproms have a checksum field, so far two functions for patching ath10k MAC address have been present (and been used). This merges code to provide a single function ath10k_patch_mac in caldata.sh, having its name in accordance with ath9k functions. By doing so, correct MAC patching for current and future ath10k devices should be ensured. This patch adds checksum adjustments for several targets on ath79 and lantiq. Signed-off-by: Adrian Schmutzler --- v3: Merged ath79 and lantiq patches, rename function to be consistent --- .../base-files/files/lib/functions/caldata.sh | 8 +--- .../etc/hotplug.d/firmware/11-ath10k-caldata | 44 +++++++++---------- .../etc/hotplug.d/firmware/11-ath10k-caldata | 24 +++++----- .../etc/hotplug.d/firmware/11-ath10k-caldata | 28 ++++++------ .../etc/hotplug.d/firmware/11-ath10k-caldata | 2 +- 5 files changed, 50 insertions(+), 56 deletions(-) diff --git a/package/base-files/files/lib/functions/caldata.sh b/package/base-files/files/lib/functions/caldata.sh index 004bcfa990..1ff69ce1ae 100644 --- a/package/base-files/files/lib/functions/caldata.sh +++ b/package/base-files/files/lib/functions/caldata.sh @@ -121,13 +121,7 @@ ath9k_patch_mac_crc() { caldata_patch_mac "$mac" "$mac_offset" "$chksum_offset" } -ath10kcal_patch_mac() { - local mac=$1 - - caldata_patch_mac "$mac" 0x6 -} - -ath10kcal_patch_mac_crc() { +ath10k_patch_mac() { local mac=$1 caldata_patch_mac "$mac" 0x6 0x2 diff --git a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index ebc1fc24d0..3b7d5b0682 100644 --- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -22,54 +22,54 @@ case "$FIRMWARE" in devolo,dvl1750i|\ devolo,dvl1750x) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x0) -1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) -1) ;; dlink,dir-859-a1) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac") + ath10k_patch_mac $(mtd_get_mac_ascii devdata "wlan5mac") ;; elecom,wrc-1750ghbk2-i) caldata_extract "art" 0x5000 0x844 ;; engenius,ecb1750) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr) + ath10k_patch_mac $(mtd_get_mac_ascii u-boot-env athaddr) ;; engenius,epg5000|\ iodata,wn-ac1167dgr|\ iodata,wn-ac1600dgr2) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +1) ;; engenius,ews511ap) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +1) ;; glinet,gl-ar750|\ glinet,gl-ar750s) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +1) ;; glinet,gl-x750) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x0) +2) ;; nec,wg800hp) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac_crc $(mtd_get_mac_text board_data 0x880) + ath10k_patch_mac $(mtd_get_mac_text board_data 0x880) ;; ocedo,koala|\ ocedo,ursus) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(mtd_get_mac_binary art 0xc) + ath10k_patch_mac $(mtd_get_mac_binary art 0xc) ;; openmesh,om5p-ac-v2) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) +16) ;; qihoo,c301) caldata_extract "radiocfg" 0x5000 0x844 - ath10kcal_patch_mac_crc $(mtd_get_mac_ascii devdata wlan5mac) + ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) ;; tplink,archer-a7-v5|\ tplink,archer-c2-v3|\ @@ -77,29 +77,29 @@ case "$FIRMWARE" in tplink,archer-c7-v5|\ tplink,archer-c25-v1) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) -1) ;; tplink,archer-c5-v1|\ tplink,archer-c7-v2) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x1fc00) -1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary u-boot 0x1fc00) -1) ;; tplink,archer-d50-v1) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary romfile 0xf100) +2) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary romfile 0xf100) +2) ;; tplink,re350k-v1) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary config 0x10008) +2) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary config 0x10008) +2) ;; tplink,re355-v1|\ tplink,re450-v1) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) ;; tplink,re450-v2) caldata_extract "art" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) +1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary info 0x8) +1) ;; ubnt,unifiac-lite|\ ubnt,unifiac-mesh|\ @@ -117,7 +117,7 @@ case "$FIRMWARE" in case $board in comfast,cf-e313ac) caldata_extract "art" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary art 0x6) + ath10k_patch_mac $(mtd_get_mac_binary art 0x6) ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin rm /lib/firmware/ath10k/QCA9888/hw2.0/board-2.bin @@ -127,18 +127,18 @@ case "$FIRMWARE" in dlink,dir-842-c3|\ nec,wg1200cr) caldata_extract "art" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_ascii devdata wlan5mac) + ath10k_patch_mac $(mtd_get_mac_ascii devdata wlan5mac) ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; netgear,ex6400|\ netgear,ex7300) caldata_extract "caldata" 0x5000 0x2f20 - ath10kcal_patch_mac $(mtd_get_mac_binary caldata 0xc) + ath10k_patch_mac $(mtd_get_mac_binary caldata 0xc) ;; phicomm,k2t) caldata_extract "art" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(k2t_get_mac "5g_mac") + ath10k_patch_mac $(k2t_get_mac "5g_mac") ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; @@ -149,7 +149,7 @@ case "$FIRMWARE" in tplink,archer-c60-v2|\ tplink,archer-c6-v2) caldata_extract "art" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary mac 0x8) -1) ln -sf /lib/firmware/ath10k/pre-cal-pci-0000\:00\:00.0.bin \ /lib/firmware/ath10k/QCA9888/hw2.0/board.bin ;; diff --git a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 898e0bb074..bdb12b2921 100644 --- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -12,7 +12,7 @@ case "$FIRMWARE" in meraki,mr33) caldata_extract_ubi "ART" 0x9000 0x844 caldata_valid "4408" || caldata_extract "ART" 0x9000 0x844 - ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1) + ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +1) ;; esac ;; @@ -34,7 +34,7 @@ case "$FIRMWARE" in linksys,ea8300) caldata_extract "ART" 0x9000 0x2f20 # OEM assigns 4 sequential MACs - ath10kcal_patch_mac_crc $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4)) + ath10k_patch_mac $(macaddr_setbit_la $(macaddr_add "$(cat /sys/class/net/eth0/address)" 4)) ;; openmesh,a62) caldata_extract "0:ART" 0x9000 0x2f20 @@ -79,26 +79,26 @@ case "$FIRMWARE" in ;; engenius,ens620ext) caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +2) ;; linksys,ea8300) caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) + ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 2) ;; meraki,mr33) caldata_extract_ubi "ART" 0x1000 0x2f20 caldata_valid "202f" || caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2) + ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +2) ;; netgear,ex6100v2 |\ netgear,ex6150v2) caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0x0) + ath10k_patch_mac $(mtd_get_mac_binary dnidata 0x0) ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -2) + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -2) ;; esac ;; @@ -140,26 +140,26 @@ case "$FIRMWARE" in ;; engenius,ens620ext) caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii u-boot-env ethaddr) +3) ;; linksys,ea8300) caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) + ath10k_patch_mac $(macaddr_add "$(cat /sys/class/net/eth0/address)" 3) ;; meraki,mr33) caldata_extract_ubi "ART" 0x5000 0x2f20 caldata_valid "202f" || caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3) + ath10k_patch_mac $(macaddr_add $(get_mac_binary "/sys/bus/i2c/devices/0-0050/eeprom" 0x66) +3) ;; netgear,ex6100v2 |\ netgear,ex6150v2) caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary dnidata 0xc) + ath10k_patch_mac $(mtd_get_mac_binary dnidata 0xc) ;; zyxel,nbg6617 |\ zyxel,wre6606) caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(cat /sys/class/net/eth0/address) -1) + ath10k_patch_mac $(macaddr_add $(cat /sys/class/net/eth0/address) -1) ;; esac ;; diff --git a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index f8a4c98542..6013bb100c 100644 --- a/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ipq806x/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -11,33 +11,33 @@ case "$FIRMWARE" in case $board in buffalo,wxr-2533dhp) caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 0x1e) + ath10k_patch_mac $(mtd_get_mac_binary ART 0x1e) ;; linksys,ea8500) caldata_extract "art" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +1) ;; nec,wg2600hp) caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 0xc) +1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary PRODUCTDATA 0xc) +1) ;; netgear,d7800 |\ netgear,r7500v2 |\ netgear,r7800) caldata_extract "art" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x6) +1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) +1) ;; tplink,c2600) caldata_extract "radio" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 0x8) -1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 0x8) -1) ;; tplink,vr2600v) caldata_extract "ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary default-mac 0x0) -1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary default-mac 0x0) -1) ;; zyxel,nbg6817) caldata_extract "0:ART" 0x1000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) +1) ;; esac ;; @@ -45,33 +45,33 @@ case "$FIRMWARE" in case $board in buffalo,wxr-2533dhp) caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary ART 0x18) + ath10k_patch_mac $(mtd_get_mac_binary ART 0x18) ;; linksys,ea8500) caldata_extract "art" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +2) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_ascii devinfo hw_mac_addr) +2) ;; nec,wg2600hp) caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary PRODUCTDATA 0xc) + ath10k_patch_mac $(mtd_get_mac_binary PRODUCTDATA 0xc) ;; netgear,d7800 |\ netgear,r7500v2 |\ netgear,r7800) caldata_extract "art" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary art 0x6) +2) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary art 0x6) +2) ;; tplink,c2600) caldata_extract "radio" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 0x8) + ath10k_patch_mac $(mtd_get_mac_binary default-mac 0x8) ;; tplink,vr2600v) caldata_extract "ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_binary default-mac 0x0) + ath10k_patch_mac $(mtd_get_mac_binary default-mac 0x0) ;; zyxel,nbg6817) caldata_extract "0:ART" 0x5000 0x2f20 - ath10kcal_patch_mac_crc $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) + ath10k_patch_mac $(mtd_get_mac_ascii 0:APPSBLENV ethaddr) ;; esac ;; diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 244635c6db..0b48b77d41 100644 --- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -11,7 +11,7 @@ case "$FIRMWARE" in case $board in bt,homehub-v5a) caldata_extract_ubi "caldata" 0x5000 0x844 - ath10kcal_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +3) + ath10k_patch_mac $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +3) ;; *) caldata_die "board $board is not supported yet" From patchwork Mon Oct 14 12:02:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Schmutzler X-Patchwork-Id: 1176288 X-Patchwork-Delegate: mail@david-bauer.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adrianschmutzler.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HEalEkai"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46sHJ06f7sz9sPh for ; Mon, 14 Oct 2019 23:02:56 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=1smNgh8F74MByzmh25KkKGmmi1o5VI5yecI1CWtVqlM=; b=HEalEkaidjsZ2BA7vcUnxAmEPg nsHmFc/L6405D4RoZVSt3IqBsPdlf6EEJNT4TbL2IFv6f0WwSIz2JeUB1DCA+od5/4SZ6rArHH4eZ UqUXlpKzFWFlOIKyZYYbQwMnYjos/fx38YF4GouuyxCI1ejm0Kwohq2Yg9Qj1fYf3m50DA+rHZKE1 KChZ9pZWYnfKh2yMhPJJLP/GabvKxIRDl/SMpDVP32fdppvrdlOPZ93knk9Yo3NixGVCSTq8cW/Fp Yun+tPLjA6NaXt6K7CdfKBKdjxAxXLvigCy++Xu2Lq5Qzj8UZdNjjuNIUQECb4P9wSqXF6qtX6i6b IJqwrZEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iJz3t-0003ah-4a; Mon, 14 Oct 2019 12:02:53 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iJz3p-0003Zo-8c for openwrt-devel@lists.openwrt.org; Mon, 14 Oct 2019 12:02:51 +0000 Received: from buildfff.adridolf.com ([188.192.135.195]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MvaSG-1i1uB03FqA-00sams for ; Mon, 14 Oct 2019 14:02:44 +0200 From: Adrian Schmutzler To: openwrt-devel@lists.openwrt.org Date: Mon, 14 Oct 2019 14:02:41 +0200 Message-Id: <20191014120241.2420-2-freifunk@adrianschmutzler.de> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191014120241.2420-1-freifunk@adrianschmutzler.de> References: <20191014120241.2420-1-freifunk@adrianschmutzler.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:BsswGJRRE6EE+8Myr9sszmeFQEPJoLqXWd0vGs2mB7xyA6LbSsY tvtPjqLnl4q/H8fAaV/1OwplEAw3Hdn9V+Rtdmzj/IOlc2LdkRCwZzETS4VsZ8YZgl9Tn5P hQqdukMHHxAVxCl9h7/awRK76b+6Icx3KfthRORe1pXTpkw0/N/gfAkduoCBzPk9bbX2eph sKZud9D3zQgku8B5Axa3w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:OxddgkL2Ygg=:Na4EYZhoildZxd9Tl1Q79M fAkfT0Bp7dazfOjh6iCZbnYVpvW8SieTUP5tM8WQZs9LfmypLYJIyhb1Qk9WBvGvQSGXNdKET ssCnmJ2u0+OxGgUauZj5FwNFtoMeF3F+DYbfvWGkUVWDoybov510zJaKdetFy8jKEUWmsDgTc +XCnqnxJoj9GpazLWTsJhKbyZxFWIH2I3mvNFjzk7ccWQLWjtPnyM8kJhrVXL/iFIEHlu9EfP N0ilHMf+sDU55INMBg31MiciQ/rVDQT/AV5zxIKSQ9pP3p0oXxAuSVXvJLJ0lFe2D0ewwTy0Z k8VhypWGMlaKhbw6HJt4Jd1j0F1dRoDdTariYocmJ0PBcpdges90FvyuKpWf9Fcwezq75vQAN PABLPecqjCz4ZQ1slyLaqO6rmdw3hipN2DdsJEQEesy72ICkzR/gU+0dAh7DmmD/sxuNo60/O nG91MVN3fJtHw4FQFx+rFrCwCcMS8VZjY5Opp2IiH/49snHNAF4nL+iwZNxEwZOXubPeUjJSK PsAPa0/Bkk51TESTDMSZWSkkHSVp8M75gCFjbEn8bV6J1AOQd1nEQn+xrthJ1MfKRZGekmvhC ikbL/cIN+emFwihTbof0sISMgDOOOgD9+TSGiDg95qQ5AkcQyxHFaaD5Oprw9N4f2YSCT0J50 Zt+xsbtCKAORnsrOBN3FGe14d+bm/LvUdsf9EG76xlmJB3k158xUlJ0lxbwEdFbRsDOGTJ+5X Kj8fy0F575zVFeREa5get9K8mKRMt6d6aTQsnH+XfcbqQsERgqx4VqPg4aupry9LQQsleMSlt pNeQdolFYbBVsL/zhHZtgXYWg5Ox9JpSZdZLpFyOdtaQcQG4jONT7j4ExPQ2/yRkXmk70stDt maZtndXhQlqG/20fRBfpbcbeU6WL6j6uMuL+7UzBY= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191014_050249_599218_A57B5AC2 X-CRM114-Status: GOOD ( 12.58 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [212.227.17.13 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH v3 2/2] lantiq: modify ath9k caldata extraction to reuse caldata.sh X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org In lantiq, ath9k caldata extraction is implemented to work in two alternate "modes", the standard one and another one with swapped byte pairs. This rearranges the functions so "standard" use is based on the caldata.sh library, while only a single local function is required for the special case. Note that while the parameter for switching between normal and swab is removed, the size of the caldata is added to the function calls to stay consistent. Signed-off-by: Adrian Schmutzler --- v2: - Added this patch (previously separate [5/5] lantiq: modify ath9k caldata extraction to reuse caldata.sh) - Made size in caldata_extract_swap a parameter to match other functions v3: - Rebase, no other changes --- .../etc/hotplug.d/firmware/12-ath9k-eeprom | 62 +++++-------------- 1 file changed, 15 insertions(+), 47 deletions(-) diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom index d0bef23045..5a6e8d360b 100644 --- a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom +++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/12-ath9k-eeprom @@ -1,55 +1,23 @@ #!/bin/sh -# Based on ar71xx 10-ath9k-eeprom [ -e /lib/firmware/$FIRMWARE ] && exit 0 . /lib/functions/caldata.sh -. /lib/upgrade/nand.sh -ath9k_eeprom_extract_raw() { - local source=$1 - local offset=$(($2)) - local swap=$3 - local size=4096 - local bs=1 - local conv= - - if [ $swap -gt 0 ]; then - bs=2 - conv="conv=swab" - size=$((size / bs)) - offset=$((offset / bs)) - fi - - dd if=$source of=/lib/firmware/$FIRMWARE bs=$bs skip=$offset count=$size $conv 2>/dev/null || \ - caldata_die "failed to extract from $mtd" -} - -ath9k_eeprom_extract() { +caldata_extract_swap() { local part=$1 local offset=$2 - local swap=$3 + local count=$3 local mtd mtd=$(find_mtd_chardev $part) - [ -n "$mtd" ] || \ - caldata_die "no mtd device found for partition $part" - - ath9k_eeprom_extract_raw $mtd $offset $swap -} - -ath9k_ubi_eeprom_extract() { - local part=$1 - local offset=$2 - local swap=$3 - local ubidev=$(nand_find_ubi $CI_UBIPART) - local ubi + [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" - ubi=$(nand_find_volume $ubidev $part) - [ -n "$ubi" ] || \ - caldata_die "no UBI volume found for $part" + offset=$(($offset / 2)) + count=$(($count / 2)) - ath9k_eeprom_extract_raw /dev/$ubi $offset $swap + dd if=$mtd of=/lib/firmware/$FIRMWARE bs=2 skip=$offset count=$count conv=swab 2>/dev/null || \ + caldata_die "failed to extract calibration data from $mtd" } case "$FIRMWARE" in @@ -60,25 +28,25 @@ case "$FIRMWARE" in case "$board" in arcadyan,arv7518pw) - ath9k_eeprom_extract "boardconfig" 0x400 1 + caldata_extract_swap "boardconfig" 0x400 0x1000 ;; arcadyan,arv8539pw22) - ath9k_eeprom_extract "art" 0x400 1 + caldata_extract_swap "art" 0x400 0x1000 ;; bt,homehub-v2b) - ath9k_eeprom_extract "art" 0x0 1 + caldata_extract_swap "art" 0x0 0x1000 ath9k_patch_mac_crc "00:00:00:00:00:00" 0x20c ;; bt,homehub-v3a) - ath9k_eeprom_extract "art-copy" 0x0 1 + caldata_extract_swap "art-copy" 0x0 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot_env ethaddr) +2) 0x10c ;; bt,homehub-v5a) - ath9k_ubi_eeprom_extract "caldata" 0x1000 0 + caldata_extract_ubi "caldata" 0x1000 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_binary_ubi caldata 0x110c) +2) 0x10c ;; netgear,dgn3500|netgear,dgn3500b) - ath9k_eeprom_extract "calibration" 0xf000 0 + caldata_extract "calibration" 0xf000 0x1000 ath9k_patch_mac_crc $(macaddr_add $(mtd_get_mac_ascii uboot-env ethaddr) +2) 0x20c ;; avm,fritz3370-rev2-hynix|\ @@ -87,13 +55,13 @@ case "$FIRMWARE" in caldata_extract_reverse "urlader" 0x1541 0x440 ;; avm,fritz7312|avm,fritz7320|avm,fritz7360sl) - ath9k_eeprom_extract "urlader" 0x985 0 + caldata_extract "urlader" 0x985 0x1000 ;; avm,fritz7412) /usr/bin/fritz_cal_extract -i 1 -s 0x1e000 -e 0x207 -l 4096 -o /lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader") ;; tplink,tdw8970|tplink,tdw8980) - ath9k_eeprom_extract "boardconfig" 0x21000 0 + caldata_extract "boardconfig" 0x21000 0x1000 ;; *) caldata_die "board $board is not supported yet"