From db4f158c0330658e2c8528c28575e82f3dc6ca99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Mon, 10 Apr 2023 11:54:02 +0200 Subject: [PATCH] bmips: hg556a: switch to kmod-owl-loader MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Stop using custom ath9k fixup and switch to standard kmod-owl-loader Signed-off-by: Álvaro Fernández Rojas --- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 34 ++++++++++++++ .../bmips/dts/bcm6358-huawei-hg556a-b.dts | 44 +++++++++++++------ target/linux/bmips/image/Makefile | 2 +- 3 files changed, 66 insertions(+), 14 deletions(-) create mode 100644 target/linux/bmips/bcm6358/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom diff --git a/target/linux/bmips/bcm6358/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/bmips/bcm6358/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom new file mode 100644 index 0000000000..b12d89f29d --- /dev/null +++ b/target/linux/bmips/bcm6358/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -0,0 +1,34 @@ +#!/bin/sh + +[ -e /lib/firmware/$FIRMWARE ] && exit 0 + +. /lib/functions/caldata.sh + +caldata_extract_swap() { + local part=$1 + local offset=$2 + local count=$3 + local mtd + + mtd=$(find_mtd_chardev $part) + [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" + + offset=$(($offset / 2)) + count=$(($count / 2)) + + 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 + "ath9k-eeprom-pci-0000:00:01.0.bin") + case "$(board_name)" in + huawei,hg556a-b) + caldata_extract_swap "cal_data" 0x1e000 0xeb8 + ;; + *) + caldata_die "board $board is not supported yet" + ;; + esac + ;; +esac diff --git a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts index 273470b1bd..18adc73b63 100644 --- a/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts +++ b/target/linux/bmips/dts/bcm6358-huawei-hg556a-b.dts @@ -119,20 +119,14 @@ }; }; - ath9k-fixup { - compatible = "brcm,ath9k-fixup"; - reg = <0x30000000 0x8000000>; - - pci-dev = <1>; - - nvmem-cells = <&macaddr_cfe_6a0>; - nvmem-cell-names = "mac-address"; - mac-address-increment = <1>; + ath9k-leds { + compatible = "gpio-leds"; - ath,eeprom = <&cal_data 0x1e000>; - ath,endian-check; - ath,led-pin = <2>; - ath,led-active-high; + wlan { + label = "red:wlan"; + gpios = <&ath9k 2 GPIO_ACTIVE_HIGH>; + linux,default-trigger = "phy0tpt"; + }; }; }; @@ -164,6 +158,20 @@ &pci { status = "okay"; + + ath9k: wifi@1,0 { + compatible = "pci168c,0029"; + reg = <0x0800 0 0 0 0>; + + qca,no-eeprom; + + nvmem-cells = <&macaddr_cfe_6a0>; + nvmem-cell-names = "mac-address"; + mac-address-increment = <1>; + + #gpio-cells = <2>; + gpio-controller; + }; }; &pflash { @@ -207,6 +215,16 @@ status = "okay"; }; +&cal_data { + compatible = "nvmem-cells"; + #address-cells = <1>; + #size-cells = <1>; + + cal_data_1e000: cal@1e000 { + reg = <0x1e000 0xeb8>; + }; +}; + &cfe { compatible = "nvmem-cells"; #address-cells = <1>; diff --git a/target/linux/bmips/image/Makefile b/target/linux/bmips/image/Makefile index 8369a86669..f86e46e0b9 100644 --- a/target/linux/bmips/image/Makefile +++ b/target/linux/bmips/image/Makefile @@ -324,7 +324,7 @@ define Device/sercomm-nand endef ### Package helpers ### -ATH9K_PACKAGES := kmod-ath9k wpad-basic-mbedtls +ATH9K_PACKAGES := kmod-ath9k kmod-owl-loader wpad-basic-mbedtls B43_PACKAGES := kmod-b43 wpad-basic-mbedtls USB1_PACKAGES := kmod-usb-ohci kmod-usb-ledtrig-usbport USB2_PACKAGES := $(USB1_PACKAGES) kmod-usb2 -- 2.30.2