From 82a741c774dc1aa1e2c2e4b2e445bf79158de1a1 Mon Sep 17 00:00:00 2001 From: Christian Lamparter Date: Sat, 16 Nov 2019 17:08:07 +0100 Subject: mac80211: switch to upstream owl-loader driver The Owl Loader (named after the codename that Atheros gave these devices back in the day) has been accepted upstream. This patch removes the "misc" driver OpenWrt had and adds the remaining differences against the version that ships with 5.4-rc1 into a separate "120-owl-loader-compat.patch" file that can be cut down once AR71XX is being dealt with. Note: I decided to keep the existing (kmod-)owl-loader package name around for now. The kernel module file in the kmod package will be called ath9k_pci_owl_loader.ko though. Acked-by: Hauke Mehrtens Signed-off-by: Christian Lamparter --- package/kernel/linux/modules/wireless.mk | 21 --------- package/kernel/mac80211/ath.mk | 20 +++++++- ...101-ath9k-use-iowrite32-over-__raw_writel.patch | 40 ++++++++++++++++ .../patches/ath/120-owl-loader-compat.patch | 53 ++++++++++++++++++++++ 4 files changed, 112 insertions(+), 22 deletions(-) create mode 100644 package/kernel/mac80211/patches/ath/101-ath9k-use-iowrite32-over-__raw_writel.patch create mode 100644 package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch (limited to 'package/kernel') diff --git a/package/kernel/linux/modules/wireless.mk b/package/kernel/linux/modules/wireless.mk index 7b1c663567..72e2bf477b 100644 --- a/package/kernel/linux/modules/wireless.mk +++ b/package/kernel/linux/modules/wireless.mk @@ -41,24 +41,3 @@ define KernelPackage/net-rtl8192su/description endef $(eval $(call KernelPackage,net-rtl8192su)) - - -define KernelPackage/owl-loader - SUBMENU:=$(WIRELESS_MENU) - TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips - DEPENDS:=@PCI_SUPPORT - KCONFIG:=CONFIG_OWL_LOADER - FILES:=$(LINUX_DIR)/drivers/misc/owl-loader.ko - AUTOLOAD:=$(call AutoProbe,owl-loader) -endef - -define KernelPackage/owl-loader/description - Kernel module that helps to initialize certain Qualcomm - Atheros' PCI(e) Wifi chips, which have the init data - (which contains the PCI device ID for example) stored - together with the calibration data in the file system. - - This is necessary for devices like the Cisco Meraki Z1. -endef - -$(eval $(call KernelPackage,owl-loader)) diff --git a/package/kernel/mac80211/ath.mk b/package/kernel/mac80211/ath.mk index 64aac41b4d..788131b751 100644 --- a/package/kernel/mac80211/ath.mk +++ b/package/kernel/mac80211/ath.mk @@ -1,6 +1,6 @@ PKG_DRIVERS += \ ath ath5k ath6kl ath6kl-sdio ath6kl-usb ath9k ath9k-common ath9k-htc ath10k \ - carl9170 + carl9170 owl-loader PKG_CONFIG_DEPENDS += \ CONFIG_PACKAGE_ATH_DEBUG \ @@ -38,6 +38,7 @@ config-$(CONFIG_PACKAGE_ATH_SPECTRAL) += ATH9K_COMMON_SPECTRAL ATH10K_SPECTRAL config-$(CONFIG_PACKAGE_ATH_DYNACK) += ATH9K_DYNACK config-$(call config_package,ath9k) += ATH9K config-$(call config_package,ath9k-common) += ATH9K_COMMON +config-$(call config_package,owl-loader) += ATH9K_PCI_NO_EEPROM config-$(CONFIG_TARGET_ar71xx) += ATH9K_AHB config-$(CONFIG_TARGET_ath79) += ATH9K_AHB config-$(CONFIG_TARGET_ipq40xx) += ATH10K_AHB @@ -274,3 +275,20 @@ define KernelPackage/carl9170 FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/carl9170/carl9170.ko AUTOLOAD:=$(call AutoProbe,carl9170) endef + +define KernelPackage/owl-loader + $(call KernelPackage/mac80211/Default) + TITLE:=Owl loader for initializing Atheros PCI(e) Wifi chips + DEPENDS:=@PCI_SUPPORT +kmod-ath9k + FILES:=$(PKG_BUILD_DIR)/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.ko + AUTOLOAD:=$(call AutoProbe,ath9k_pci_owl_loader) +endef + +define KernelPackage/owl-loader/description + Kernel module that helps to initialize certain Qualcomm + Atheros' PCI(e) Wifi chips, which have the init data + (which contains the PCI device ID for example) stored + together with the calibration data in the file system. + + This is necessary for devices like the Cisco Meraki Z1. +endef diff --git a/package/kernel/mac80211/patches/ath/101-ath9k-use-iowrite32-over-__raw_writel.patch b/package/kernel/mac80211/patches/ath/101-ath9k-use-iowrite32-over-__raw_writel.patch new file mode 100644 index 0000000000..dade5cfe3a --- /dev/null +++ b/package/kernel/mac80211/patches/ath/101-ath9k-use-iowrite32-over-__raw_writel.patch @@ -0,0 +1,40 @@ +From bd8eca2c0f5542c5b20b1c2cc506b8b8a46018df Mon Sep 17 00:00:00 2001 +From: Christian Lamparter +Date: Sun, 24 Nov 2019 15:22:55 +0100 +Subject: [PATCH] ath9k: use iowrite32 over __raw_writel +To: linux-wireless@vger.kernel.org +Cc: QCA ath9k Development , + Kalle Valo , + Hauke Mehrtens , + Mathias Kresin , + Martin Blumenstingl + +This patch changes the ath9k_pci_owl_loader to use the +same iowrite32 memory accessor that ath9k_pci is using +to communicate with the PCI(e) chip. + +This will fix endian issues that came up during testing +with loaned AVM Fritz!Box 7360 (Lantiq MIPS SoCs + AR9287). + +Fixes: 5a4f2040fd07 ("ath9k: add loader for AR92XX (and older) pci(e)") +Signed-off-by: Christian Lamparter +--- + drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c +index 956fa7828d0c..56d1a7764b9f 100644 +--- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c ++++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c +@@ -83,7 +83,7 @@ static int ath9k_pci_fixup(struct pci_dev *pdev, const u16 *cal_data, + val = swahb32(val); + } + +- __raw_writel(val, mem + reg); ++ iowrite32(val, mem + reg); + usleep_range(100, 120); + } + +-- +2.24.0 + diff --git a/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch new file mode 100644 index 0000000000..afd5e3eef0 --- /dev/null +++ b/package/kernel/mac80211/patches/ath/120-owl-loader-compat.patch @@ -0,0 +1,53 @@ +From: Christian Lamparter +Date: Sat, 16 Nov 2019 19:25:24 +0100 +Subject: [PATCH] owl_loader: compatibility patch + +This patch includes OpenWrt specific changes that are +not included in the upstream owl-loader. + +This includes a platform data handling changes for ar71xx. + +Signed-off-by: Christian Lamparter + +--- a/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c ++++ b/drivers/net/wireless/ath/ath9k/ath9k_pci_owl_loader.c +@@ -104,6 +104,7 @@ + { + struct pci_dev *pdev = (struct pci_dev *)context; + struct owl_ctx *ctx = (struct owl_ctx *)pci_get_drvdata(pdev); ++ struct ath9k_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct pci_bus *bus; + + complete(&ctx->eeprom_load); +@@ -121,6 +122,16 @@ + goto release; + } + ++ if (pdata) { ++ memcpy(pdata->eeprom_data, fw->data, fw->size); ++ ++ /* ++ * eeprom has been successfully loaded - pass the data to ath9k ++ * but remove the eeprom_name, so it doesn't try to load it too. ++ */ ++ pdata->eeprom_name = NULL; ++ } ++ + if (ath9k_pci_fixup(pdev, (const u16 *)fw->data, fw->size)) + goto release; + +@@ -138,8 +149,14 @@ + static const char *owl_get_eeprom_name(struct pci_dev *pdev) + { + struct device *dev = &pdev->dev; ++ struct ath9k_platform_data *pdata; + char *eeprom_name; + ++ /* try the existing platform data first */ ++ pdata = dev_get_platdata(dev); ++ if (pdata && pdata->eeprom_name) ++ return pdata->eeprom_name; ++ + dev_dbg(dev, "using auto-generated eeprom filename\n"); + + eeprom_name = devm_kzalloc(dev, EEPROM_FILENAME_LEN, GFP_KERNEL); -- cgit v1.2.3