From 31a29699729afed2cff5419513420f72ec6d9029 Mon Sep 17 00:00:00 2001 From: Daniel Barlow Date: Sun, 26 Nov 2023 13:25:01 +0000 Subject: [PATCH] omnia: add support for wifi - ath9k and ath10k, both on PCI bus (which can be enumerated, hence they don't need to be in device tree) - need to disable PCIe ASPM for the ath9k to work - appropriate firmware files added for ath10k --- devices/turris-omnia/default.nix | 39 ++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/devices/turris-omnia/default.nix b/devices/turris-omnia/default.nix index bd22739..6725069 100644 --- a/devices/turris-omnia/default.nix +++ b/devices/turris-omnia/default.nix @@ -87,12 +87,39 @@ MV_XOR = "y"; }; }; + boot = { - commandLine = [ "console=ttyS0,115200" ]; + commandLine = [ + "console=ttyS0,115200" + "pcie_aspm=off" # ath9k pci incompatible with PCIe ASPM + ]; imageFormat = "fit"; }; + filesystem = + let + inherit (pkgs.pseudofile) dir symlink; + firmware = pkgs.stdenv.mkDerivation { + name = "wlan-firmware"; + phases = ["installPhase"]; + installPhase = '' + mkdir $out + cp -r ${pkgs.linux-firmware}/lib/firmware/ath10k/QCA988X $out + ''; + }; + in dir { + lib = dir { + firmware = dir { + ath10k = symlink firmware; + }; + }; + }; - hardware = { + hardware = let + mac80211 = pkgs.mac80211.override { + drivers = ["ath9k_pci" "ath10k_pci"]; + klibBuild = config.system.outputs.kernel.modulesupport; + }; + in { defaultOutput = "flashimage"; loadAddress = lim.parseInt "0x00008000"; entryPoint = lim.parseInt "0x00008000"; @@ -110,6 +137,14 @@ inherit (config.system.service) bridge; in rec { lan = link.build { ifname = "eth0"; }; + wlan = link.build { + ifname = "wlan0"; + dependencies = [ mac80211 ]; + }; + wlan5 = link.build { + ifname = "wlan1"; + dependencies = [ mac80211 ]; + }; }; };