[coreboot-gerrit] Change in coreboot[master]: drivers: Add qcom wifi driver

Furquan Shaikh (Code Review) gerrit at coreboot.org
Tue Sep 12 05:53:19 CEST 2017


Furquan Shaikh has uploaded this change for review. ( https://review.coreboot.org/21506


Change subject: drivers: Add qcom wifi driver
......................................................................

drivers: Add qcom wifi driver

Change-Id: I84c5f5a8a8c480dcfc75d25aa275e26ab0728df3
Signed-off-by: Furquan Shaikh <furquan at chromium.org>
---
A src/drivers/qcom/wifi/Kconfig
A src/drivers/qcom/wifi/Makefile.inc
A src/drivers/qcom/wifi/chip.h
A src/drivers/qcom/wifi/wifi.c
4 files changed, 136 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/06/21506/1

diff --git a/src/drivers/qcom/wifi/Kconfig b/src/drivers/qcom/wifi/Kconfig
new file mode 100644
index 0000000..ac24a90
--- /dev/null
+++ b/src/drivers/qcom/wifi/Kconfig
@@ -0,0 +1,3 @@
+config DRIVERS_QCOM_WIFI
+	bool
+	depends on HAVE_ACPI_TABLES
diff --git a/src/drivers/qcom/wifi/Makefile.inc b/src/drivers/qcom/wifi/Makefile.inc
new file mode 100644
index 0000000..fbf5a0e
--- /dev/null
+++ b/src/drivers/qcom/wifi/Makefile.inc
@@ -0,0 +1,14 @@
+#
+# This file is part of the coreboot project.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+
+ramstage-$(CONFIG_DRIVERS_QCOM_WIFI) += wifi.c
diff --git a/src/drivers/qcom/wifi/chip.h b/src/drivers/qcom/wifi/chip.h
new file mode 100644
index 0000000..4cefa15
--- /dev/null
+++ b/src/drivers/qcom/wifi/chip.h
@@ -0,0 +1,23 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __DRIVERS_QCOM_WIFI_CHIP_H__
+#define __DRIVERS_QCOM_WIFI_CHIP_H__
+
+struct drivers_qcom_wifi_config {
+	unsigned wake; /* Wake pin for ACPI _PRW */
+};
+
+#endif /* __DRIVERS_QCOM_WIFI_CHIP_H__ */
diff --git a/src/drivers/qcom/wifi/wifi.c b/src/drivers/qcom/wifi/wifi.c
new file mode 100644
index 0000000..626e31f
--- /dev/null
+++ b/src/drivers/qcom/wifi/wifi.c
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2017 Google Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 or (at your option)
+ * any later version of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <arch/acpi_device.h>
+#include <arch/acpigen.h>
+#include <console/console.h>
+#include <device/device.h>
+#include <device/path.h>
+#include <device/pci.h>
+#include "chip.h"
+
+static void qcom_wifi_fill_ssdt(struct device *dev)
+{
+	struct drivers_qcom_wifi_config *config = dev->chip_info;
+	const char *path = acpi_device_path(dev->bus->dev);
+	u32 address;
+
+	if (!dev->enabled || !path)
+		return;
+
+	/* Device */
+	acpigen_write_scope(path);
+	acpigen_write_device(acpi_device_name(dev));
+	acpigen_write_name_integer("_UID", 0);
+	if (dev->chip_ops)
+		acpigen_write_name_string("_DDN", dev->chip_ops->name);
+
+	/* Address */
+	address = PCI_SLOT(dev->path.pci.devfn) & 0xffff;
+	address <<= 16;
+	address |= PCI_FUNC(dev->path.pci.devfn) & 0xffff;
+	acpigen_write_name_dword("_ADR", address);
+
+	/* Wake capabilities */
+	if (config && config->wake)
+		acpigen_write_PRW(config->wake, 3);
+
+	acpigen_pop_len(); /* Device */
+	acpigen_pop_len(); /* Scope */
+
+	printk(BIOS_INFO, "%s.%s: %s %s\n", path, acpi_device_name(dev),
+	       dev->chip_ops ? dev->chip_ops->name : "", dev_path(dev));
+}
+
+static const char *qcom_wifi_acpi_name(struct device *dev)
+{
+	return "QWFI";
+}
+
+static struct pci_operations pci_ops = {
+	.set_subsystem			= pci_dev_set_subsystem,
+};
+
+struct device_operations qcom_wifi_ops = {
+	.read_resources			= pci_dev_read_resources,
+	.set_resources			= pci_dev_set_resources,
+	.enable_resources		= pci_dev_enable_resources,
+	.init				= pci_dev_init,
+	.ops_pci			= &pci_ops,
+	.acpi_name			= &qcom_wifi_acpi_name,
+	.acpi_fill_ssdt_generator	= &qcom_wifi_fill_ssdt,
+};
+
+static const unsigned short pci_device_ids[] = {
+	0x003E,
+	0
+};
+
+static const struct pci_driver qcom_wifi __pci_driver = {
+	.ops	 			= &qcom_wifi_ops,
+	.vendor				= 0x168C,
+	.devices			= pci_device_ids,
+};
+
+static void qcom_wifi_enable(struct device *dev)
+{
+	dev->ops			= &qcom_wifi_ops;
+}
+
+struct chip_operations drivers_qcom_wifi_ops = {
+	CHIP_NAME("QCOM WiFi")
+	.enable_dev			= &qcom_wifi_enable
+};

-- 
To view, visit https://review.coreboot.org/21506
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I84c5f5a8a8c480dcfc75d25aa275e26ab0728df3
Gerrit-Change-Number: 21506
Gerrit-PatchSet: 1
Gerrit-Owner: Furquan Shaikh <furquan at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170912/a7ccafa0/attachment.html>


More information about the coreboot-gerrit mailing list