Skip to contentSkip to conversation

kernel: owl-loader for delayed Atheros ath9k fixup

PATCH New Christian Lamparter 1 participant 1 message Apr 7, 2016 1 message not in the archive Arm/actions semi architecture

lore
Share & tools
lore
#1 lore raw

PATCH 2/3 kernel: owl-loader for delayed Atheros ath9k fixup

In reply to a message not in the archive

Some devices (like the Cisco Meraki Z1 Cloud Managed Teleworker Gateway) need to be able to initialize the PCIe wifi device. Normally, this is done during the early stages of booting linux, because the necessary init code is read from the memory mapped SPI and passed to pci_enable_ath9k_fixup. However,this isn't possible for devices which have the init code for the Atheros chip stored on NAND in an UBI volume. Hence, this module can be used to initialze the chip when the user-space is ready to extract the init code.

---
I included the ath9k mailing list too as this deals with bootstrapping ath9k cards and maybe someone there is interested as well? Anyway, the original post and the following discussion can be found here:
<https://www.mail-archive.com/[email protected]/msg38296.html>

Note: We tried several methods to get the AR9280 to work. Initially, we tried just a request_firmware_nowait from the device's init (z1_setup in mach-z1.c), but this wasn't working. The issue is that openwrt has no /sbin/hotplug helper [0] and procd doesn't scan the /sys/class/firmware directory for already open request once it started.

We played around with different approaches, and also made a helper-script to fulfill the outstanding requests on boot [1]. however we found no good place for it in the start-up scripts. So that's why we developed this owl-loader module, since it won't have to deal with any procd/hotplug issues.

The original submission was ar71xx specific, but this was fixed. This module should work on all architectures (lantiq?) and has no dependencies for anything outside ath9k_platform_data.

[0] <https://www.kernel.org/doc/pending/hotplug.txt> section:
"A note about race conditions (or "why bother with netlink?"):" details on why it is a bad idea to have /sbin/hotplug

[1] <https://github.com/riptidewave93/Openwrt-Z1/commit/9a38c60a1206b4010fbfb626fc7b2ec69bbe232a>

---
 package/kernel/owl-loader/Makefile         |  59 ++++++++
 package/kernel/owl-loader/src/Makefile     |   1 +
 package/kernel/owl-loader/src/owl-loader.c | 212 +++++++++++++++++++++++++++++
 3 files changed, 272 insertions(+)
 create mode 100644 package/kernel/owl-loader/Makefile
 create mode 100644 package/kernel/owl-loader/src/Makefile
 create mode 100644 package/kernel/owl-loader/src/owl-loader.c
package/kernel/owl-loader/Makefile new file +59 -0
new file mode 100644
index 0000000..f5a95e2
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=owl-loader
+PKG_RELEASE:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/owl-loader
+  SUBMENU:=Network Support
+  TITLE:=Owl loader for initializing Atheros PCIe Wifi chips
+  DEPENDS:=@PCI_SUPPORT +kmod-ath9k
+  FILES:=$(PKG_BUILD_DIR)/owl-loader.ko
+  AUTOLOAD:=$(call AutoProbe,owl-loader)
+  KCONFIG:=
+endef
+
+define KernelPackage/owl-loader/description
+  Kernel module that helps to initialize certain Qualcomm
+  Atheros' PCIe Wifi chips, which have the pcie init data
+  stored together with the calibration data in the file
+  system.
+
+  This is necessary for devices like the Cisco Meraki Z1.
+endef
+
+EXTRA_KCONFIG:= \
+	CONFIG_OWL_LOADER=m
+
+EXTRA_CFLAGS:= \
+	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \
+	$(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) \
+
+MAKE_OPTS:= \
+	ARCH="$(LINUX_KARCH)" \
+	CROSS_COMPILE="$(TARGET_CROSS)" \
+	SUBDIRS="$(PKG_BUILD_DIR)" \
+	EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \
+	$(EXTRA_KCONFIG)
+
+define Build/Prepare
+	mkdir -p $(PKG_BUILD_DIR)
+	$(CP) ./src/* $(PKG_BUILD_DIR)/
+endef
+
+define Build/Compile
+	$(MAKE) -C "$(LINUX_DIR)" \
+		$(MAKE_OPTS) \
+		modules
+endef
+
+$(eval $(call KernelPackage,owl-loader))
package/kernel/owl-loader/src/Makefile new file +1 -0
new file mode 100644
index 0000000..6b58276
@@ -0,0 +1 @@
+obj-${CONFIG_OWL_LOADER}	+= owl-loader.o
package/kernel/owl-loader/src/owl-loader.c new file +212 -0

212 lines not on this page · raw message

Signature · 1 line
2.8.0.rc3