summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/wifi/generic/Makefile.inc2
-rw-r--r--src/drivers/wifi/generic/chip.h7
-rw-r--r--src/drivers/wifi/generic/generic.c31
-rw-r--r--src/drivers/wifi/generic/wifi.h10
4 files changed, 46 insertions, 4 deletions
diff --git a/src/drivers/wifi/generic/Makefile.inc b/src/drivers/wifi/generic/Makefile.inc
index 5650d8ab6f..91f22d163e 100644
--- a/src/drivers/wifi/generic/Makefile.inc
+++ b/src/drivers/wifi/generic/Makefile.inc
@@ -1,6 +1,8 @@
ifeq ($(CONFIG_DRIVERS_WIFI_GENERIC),y)
+romstage-y += generic.c
+
ramstage-y += generic.c
ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c
ramstage-$(CONFIG_HAVE_ACPI_TABLES) += acpi.c
diff --git a/src/drivers/wifi/generic/chip.h b/src/drivers/wifi/generic/chip.h
index 907b260fa3..56a4afc5e4 100644
--- a/src/drivers/wifi/generic/chip.h
+++ b/src/drivers/wifi/generic/chip.h
@@ -12,6 +12,13 @@ struct drivers_wifi_generic_config {
/* When set to true, this will add a _DSD which contains a single
property, `DmaProperty`, set to 1, under the ACPI Device. */
bool is_untrusted;
+
+ /*
+ * Applicable for Intel chipsets that use CNVi WiFi only. Set this to 1
+ * to enable CNVi DDR RFIM (radio frequency interference mitigation);
+ * SoC code propagates this value the applicable FSP UPD.
+ */
+ bool enable_cnvi_ddr_rfim;
};
#endif /* _GENERIC_WIFI_H_ */
diff --git a/src/drivers/wifi/generic/generic.c b/src/drivers/wifi/generic/generic.c
index de93741f27..a6936f1d11 100644
--- a/src/drivers/wifi/generic/generic.c
+++ b/src/drivers/wifi/generic/generic.c
@@ -7,6 +7,7 @@
#include <elog.h>
#include "chip.h"
#include "wifi_private.h"
+#include "wifi.h"
static void wifi_pci_dev_init(struct device *dev)
{
@@ -40,17 +41,39 @@ struct device_operations wifi_cnvi_ops = {
#endif
};
+static bool is_cnvi(const struct device *dev)
+{
+#if !DEVTREE_EARLY
+ return dev && dev->ops == &wifi_cnvi_ops;
+#else
+ return dev && dev->path.type != DEVICE_PATH_PCI;
+#endif
+}
+
+bool wifi_generic_cnvi_ddr_rfim_enabled(const struct device *dev)
+{
+ const struct drivers_wifi_generic_config *config;
+
+ if (!dev || !is_cnvi(dev) || !dev->chip_info)
+ return false;
+
+ config = dev->chip_info;
+ return config->enable_cnvi_ddr_rfim;
+}
+
static void wifi_generic_enable(struct device *dev)
{
- struct drivers_wifi_generic_config *config = dev ? dev->chip_info : NULL;
+ DEVTREE_CONST struct drivers_wifi_generic_config *config = dev ? dev->chip_info : NULL;
if (!config)
return;
- if (dev->path.type == DEVICE_PATH_PCI)
- dev->ops = &wifi_pcie_ops;
- else
+#if !DEVTREE_EARLY
+ if (is_cnvi(dev))
dev->ops = &wifi_cnvi_ops;
+ else
+ dev->ops = &wifi_pcie_ops;
+#endif
}
struct chip_operations drivers_wifi_generic_ops = {
diff --git a/src/drivers/wifi/generic/wifi.h b/src/drivers/wifi/generic/wifi.h
new file mode 100644
index 0000000000..54acfa440f
--- /dev/null
+++ b/src/drivers/wifi/generic/wifi.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#include <device/device.h>
+
+#ifndef _WIFI_GENERIC_WIFI_H_
+#define _WIFI_GENERIC_WIFI_H_
+
+bool wifi_generic_cnvi_ddr_rfim_enabled(const struct device *dev);
+
+#endif /* _WIFI_GENERIC_WIFI_H_ */