about summary refs log tree commit diff
path: root/modules/hardware
diff options
context:
space:
mode:
Diffstat (limited to 'modules/hardware')
-rw-r--r--modules/hardware/t100ha/brcmfmac43340-sdio.txtbin0 -> 3239 bytes
-rw-r--r--modules/hardware/t100ha/default.nix12
-rw-r--r--modules/hardware/t100ha/sdio.patch52
3 files changed, 64 insertions, 0 deletions
diff --git a/modules/hardware/t100ha/brcmfmac43340-sdio.txt b/modules/hardware/t100ha/brcmfmac43340-sdio.txt
new file mode 100644
index 00000000..db22fef6
--- /dev/null
+++ b/modules/hardware/t100ha/brcmfmac43340-sdio.txt
Binary files differdiff --git a/modules/hardware/t100ha/default.nix b/modules/hardware/t100ha/default.nix
index 3a209777..a1fc746d 100644
--- a/modules/hardware/t100ha/default.nix
+++ b/modules/hardware/t100ha/default.nix
@@ -8,6 +8,15 @@ in {
   options.vuizvui.hardware.t100ha.enable = lib.mkEnableOption desc;
 
   config = lib.mkIf cfg.enable {
+    hardware.firmware = lib.singleton (pkgs.runCommand "brcm43340-firmware" {
+      params = ./brcmfmac43340-sdio.txt;
+      fwbase = "lib/firmware/brcm/brcmfmac43340-sdio";
+      install = "install -vD -m 0644";
+    } ''
+      $install "${pkgs.firmwareLinuxNonfree}/$fwbase.bin" "$out/$fwbase.bin"
+      $install "$params" "$out/$fwbase.txt"
+    '');
+
     boot.kernelPackages = let
       nixpkgs = import ../../../nixpkgs-path.nix;
       t100haKernel = pkgs.linux_4_7.override {
@@ -18,6 +27,9 @@ in {
           { name = "meta-keys";
             patch = ./meta-keys.patch;
           }
+          { name = "sdio";
+            patch = ./sdio.patch;
+          }
         ];
 
         # Missing device drivers:
diff --git a/modules/hardware/t100ha/sdio.patch b/modules/hardware/t100ha/sdio.patch
new file mode 100644
index 00000000..3bfef26d
--- /dev/null
+++ b/modules/hardware/t100ha/sdio.patch
@@ -0,0 +1,52 @@
+Patch from https://github.com/hadess/rtl8723bs/issues/80#issuecomment-252259702
+
+diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
+index 159f7f1..2076427 100644
+--- a/drivers/acpi/acpi_platform.c
++++ b/drivers/acpi/acpi_platform.c
+@@ -50,8 +50,10 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
+ 	int count;
+ 
+ 	/* If the ACPI node already has a physical device attached, skip it. */
+-	if (adev->physical_node_count)
+-		return NULL;
++	if (adev->physical_node_count && !(
++	    !strcmp(acpi_device_hid(adev), "80860F14") &&
++	    !strcmp(adev->pnp.unique_id, "2")
++	)) return NULL;
+ 
+ 	if (!acpi_match_device_ids(adev, forbidden_id_list))
+ 		return ERR_PTR(-EINVAL);
+diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c
+index 458ffb7..2807f78 100644
+--- a/drivers/mmc/host/sdhci-acpi.c
++++ b/drivers/mmc/host/sdhci-acpi.c
+@@ -47,6 +47,7 @@
+ #endif
+ 
+ #include "sdhci.h"
++#include <linux/pci.h>
+ 
+ enum {
+ 	SDHCI_ACPI_SD_CD		= BIT(0),
+@@ -381,6 +382,7 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
+ 	struct acpi_device *device, *child;
+ 	struct sdhci_acpi_host *c;
+ 	struct sdhci_host *host;
++	struct pci_dev *pcidev = NULL;
+ 	struct resource *iomem;
+ 	resource_size_t len;
+ 	const char *hid;
+@@ -404,6 +406,12 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
+ 	hid = acpi_device_hid(device);
+ 	uid = device->pnp.unique_id;
+ 
++	/* Workaround for CherryTrail x5-z8xxx: Make sure the SDIO controller
++	 * doesn't get added via PCI. */
++	if (!strcmp(hid, "80860F14") && !strcmp(uid, "1") &&
++	    (pcidev = pci_get_device(0x8086, 0x2280, NULL)) != NULL)
++		pci_stop_and_remove_bus_device(pcidev);
++
+ 	iomem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ 	if (!iomem)
+ 		return -ENOMEM;