<p>Furquan Shaikh has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/21506">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">drivers: Add qcom wifi driver<br><br>Change-Id: I84c5f5a8a8c480dcfc75d25aa275e26ab0728df3<br>Signed-off-by: Furquan Shaikh <furquan@chromium.org><br>---<br>A src/drivers/qcom/wifi/Kconfig<br>A src/drivers/qcom/wifi/Makefile.inc<br>A src/drivers/qcom/wifi/chip.h<br>A src/drivers/qcom/wifi/wifi.c<br>4 files changed, 136 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/21506/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/drivers/qcom/wifi/Kconfig b/src/drivers/qcom/wifi/Kconfig<br>new file mode 100644<br>index 0000000..ac24a90<br>--- /dev/null<br>+++ b/src/drivers/qcom/wifi/Kconfig<br>@@ -0,0 +1,3 @@<br>+config DRIVERS_QCOM_WIFI<br>+      bool<br>+ depends on HAVE_ACPI_TABLES<br>diff --git a/src/drivers/qcom/wifi/Makefile.inc b/src/drivers/qcom/wifi/Makefile.inc<br>new file mode 100644<br>index 0000000..fbf5a0e<br>--- /dev/null<br>+++ b/src/drivers/qcom/wifi/Makefile.inc<br>@@ -0,0 +1,14 @@<br>+#<br>+# This file is part of the coreboot project.<br>+#<br>+# This program is free software; you can redistribute it and/or modify<br>+# it under the terms of the GNU General Public License as published by<br>+# the Free Software Foundation; version 2 of the License.<br>+#<br>+# This program is distributed in the hope that it will be useful,<br>+# but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+# GNU General Public License for more details.<br>+#<br>+<br>+ramstage-$(CONFIG_DRIVERS_QCOM_WIFI) += wifi.c<br>diff --git a/src/drivers/qcom/wifi/chip.h b/src/drivers/qcom/wifi/chip.h<br>new file mode 100644<br>index 0000000..4cefa15<br>--- /dev/null<br>+++ b/src/drivers/qcom/wifi/chip.h<br>@@ -0,0 +1,23 @@<br>+/*<br>+ * This file is part of the coreboot project.<br>+ *<br>+ * Copyright 2017 Google Inc.<br>+ *<br>+ * This program is free software; you can redistribute it and/or modify<br>+ * it under the terms of the GNU General Public License as published by<br>+ * the Free Software Foundation; version 2 of the License.<br>+ *<br>+ * This program is distributed in the hope that it will be useful,<br>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ * GNU General Public License for more details.<br>+ */<br>+<br>+#ifndef __DRIVERS_QCOM_WIFI_CHIP_H__<br>+#define __DRIVERS_QCOM_WIFI_CHIP_H__<br>+<br>+struct drivers_qcom_wifi_config {<br>+  unsigned wake; /* Wake pin for ACPI _PRW */<br>+};<br>+<br>+#endif /* __DRIVERS_QCOM_WIFI_CHIP_H__ */<br>diff --git a/src/drivers/qcom/wifi/wifi.c b/src/drivers/qcom/wifi/wifi.c<br>new file mode 100644<br>index 0000000..626e31f<br>--- /dev/null<br>+++ b/src/drivers/qcom/wifi/wifi.c<br>@@ -0,0 +1,96 @@<br>+/*<br>+ * This file is part of the coreboot project.<br>+ *<br>+ * Copyright 2017 Google Inc.<br>+ *<br>+ * This program is free software; you can redistribute it and/or modify<br>+ * it under the terms of the GNU General Public License as published by<br>+ * the Free Software Foundation; version 2 or (at your option)<br>+ * any later version of the License.<br>+ *<br>+ * This program is distributed in the hope that it will be useful,<br>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ * GNU General Public License for more details.<br>+ */<br>+<br>+#include <arch/acpi_device.h><br>+#include <arch/acpigen.h><br>+#include <console/console.h><br>+#include <device/device.h><br>+#include <device/path.h><br>+#include <device/pci.h><br>+#include "chip.h"<br>+<br>+static void qcom_wifi_fill_ssdt(struct device *dev)<br>+{<br>+      struct drivers_qcom_wifi_config *config = dev->chip_info;<br>+ const char *path = acpi_device_path(dev->bus->dev);<br>+    u32 address;<br>+<br>+      if (!dev->enabled || !path)<br>+               return;<br>+<br>+   /* Device */<br>+ acpigen_write_scope(path);<br>+   acpigen_write_device(acpi_device_name(dev));<br>+ acpigen_write_name_integer("_UID", 0);<br>+     if (dev->chip_ops)<br>+                acpigen_write_name_string("_DDN", dev->chip_ops->name);<br>+<br>+   /* Address */<br>+        address = PCI_SLOT(dev->path.pci.devfn) & 0xffff;<br>+     address <<= 16;<br>+        address |= PCI_FUNC(dev->path.pci.devfn) & 0xffff;<br>+    acpigen_write_name_dword("_ADR", address);<br>+<br>+      /* Wake capabilities */<br>+      if (config && config->wake)<br>+               acpigen_write_PRW(config->wake, 3);<br>+<br>+    acpigen_pop_len(); /* Device */<br>+      acpigen_pop_len(); /* Scope */<br>+<br>+    printk(BIOS_INFO, "%s.%s: %s %s\n", path, acpi_device_name(dev),<br>+          dev->chip_ops ? dev->chip_ops->name : "", dev_path(dev));<br>+}<br>+<br>+static const char *qcom_wifi_acpi_name(struct device *dev)<br>+{<br>+  return "QWFI";<br>+}<br>+<br>+static struct pci_operations pci_ops = {<br>+   .set_subsystem                  = pci_dev_set_subsystem,<br>+};<br>+<br>+struct device_operations qcom_wifi_ops = {<br>+        .read_resources                 = pci_dev_read_resources,<br>+    .set_resources                  = pci_dev_set_resources,<br>+     .enable_resources               = pci_dev_enable_resources,<br>+  .init                           = pci_dev_init,<br>+      .ops_pci                        = &pci_ops,<br>+      .acpi_name                      = &qcom_wifi_acpi_name,<br>+  .acpi_fill_ssdt_generator       = &qcom_wifi_fill_ssdt,<br>+};<br>+<br>+static const unsigned short pci_device_ids[] = {<br>+       0x003E,<br>+      0<br>+};<br>+<br>+static const struct pci_driver qcom_wifi __pci_driver = {<br>+        .ops                            = &qcom_wifi_ops,<br>+        .vendor                         = 0x168C,<br>+    .devices                        = pci_device_ids,<br>+};<br>+<br>+static void qcom_wifi_enable(struct device *dev)<br>+{<br>+     dev->ops                     = &qcom_wifi_ops;<br>+}<br>+<br>+struct chip_operations drivers_qcom_wifi_ops = {<br>+      CHIP_NAME("QCOM WiFi")<br>+     .enable_dev                     = &qcom_wifi_enable<br>+};<br></pre><p>To view, visit <a href="https://review.coreboot.org/21506">change 21506</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/21506"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I84c5f5a8a8c480dcfc75d25aa275e26ab0728df3 </div>
<div style="display:none"> Gerrit-Change-Number: 21506 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Furquan Shaikh <furquan@google.com> </div>