summaryrefslogtreecommitdiff
path: root/src/drivers/wifi/generic/generic.c
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2020-10-27 18:00:46 -0700
committerPatrick Georgi <pgeorgi@google.com>2020-11-02 06:14:12 +0000
commitd4367505f18755e435cb5f578f169318c11f4b35 (patch)
tree9062d8c7456dae0a20d59cfff5dd9fe973e74a09 /src/drivers/wifi/generic/generic.c
parent6017abbc2c725aeff2b916fe2d67f868b36f6f9d (diff)
drivers/wifi/generic: Add support for CNVi dummy device ops
This change reorganizes drivers/wifi/generic to add a new device_operations structure for dummy CNVi device. This is done to make the organization of CNVi PCI device in devicetree consistent with all the other internal PCI devices of the SoC i.e. without a chip around the PCI device. Thus, with this change, CNVi entry in devicetree can be changed from: ``` chip drivers/wifi/generic register "wake" = "xxyyzz" device pci xx.y on end # CNVi PCI device end ``` to: ``` device pci xx.y on chip drivers/wifi/generic register "wake" = "xxyyzz" device generic 0 on end # Dummy CNVi device end end # CNVi PCI device ``` The helper functions for ACPI/SMBIOS generation are also accordingly updated to include _pcie_ and _cnvi_ in the function name. Change-Id: Ib3cb9ed9b81ff8d6ac85a9aaf57b641caaa2f907 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/46862 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/drivers/wifi/generic/generic.c')
-rw-r--r--src/drivers/wifi/generic/generic.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/src/drivers/wifi/generic/generic.c b/src/drivers/wifi/generic/generic.c
index fcb7294ac8..809238e92c 100644
--- a/src/drivers/wifi/generic/generic.c
+++ b/src/drivers/wifi/generic/generic.c
@@ -15,18 +15,29 @@ static void wifi_pci_dev_init(struct device *dev)
elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI, 0);
}
-struct device_operations wifi_generic_ops = {
+struct device_operations wifi_pcie_ops = {
.read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources,
.enable_resources = pci_dev_enable_resources,
.init = wifi_pci_dev_init,
.ops_pci = &pci_dev_ops_pci,
#if CONFIG(HAVE_ACPI_TABLES)
- .acpi_name = wifi_generic_acpi_name,
- .acpi_fill_ssdt = wifi_generic_fill_ssdt,
+ .acpi_name = wifi_pcie_acpi_name,
+ .acpi_fill_ssdt = wifi_pcie_fill_ssdt,
#endif
#if CONFIG(GENERATE_SMBIOS_TABLES)
- .get_smbios_data = smbios_write_wifi,
+ .get_smbios_data = smbios_write_wifi_pcie,
+#endif
+};
+
+struct device_operations wifi_cnvi_ops = {
+ .read_resources = noop_read_resources,
+ .set_resources = noop_set_resources,
+#if CONFIG(HAVE_ACPI_TABLES)
+ .acpi_fill_ssdt = wifi_cnvi_fill_ssdt,
+#endif
+#if CONFIG(GENERATE_SMBIOS_TABLES)
+ .get_smbios_data = smbios_write_wifi_cnvi,
#endif
};
@@ -37,7 +48,10 @@ static void wifi_generic_enable(struct device *dev)
if (!config)
return;
- dev->ops = &wifi_generic_ops;
+ if (dev->path.type == DEVICE_PATH_PCI)
+ dev->ops = &wifi_pcie_ops;
+ else
+ dev->ops = &wifi_cnvi_ops;
}
struct chip_operations drivers_wifi_generic_ops = {
@@ -104,7 +118,7 @@ static const unsigned short intel_pci_device_ids[] = {
* `wifi_generic_ops`.
*/
static const struct pci_driver intel_wifi_pci_driver __pci_driver = {
- .ops = &wifi_generic_ops,
+ .ops = &wifi_pcie_ops,
.vendor = PCI_VENDOR_ID_INTEL,
.devices = intel_pci_device_ids,
};