aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/wifi
diff options
context:
space:
mode:
authorTim Wawrzynczak <twawrzynczak@chromium.org>2022-02-04 12:45:37 -0700
committerTim Wawrzynczak <twawrzynczak@chromium.org>2022-03-09 18:03:28 +0000
commit6f73a202d3df000fb2fd83080e0b148add344485 (patch)
tree38df353a956e61505437c454d8aebc1c6efdc1cc /src/drivers/wifi
parent797a110856a5d2021bbad0d28f4aee357d48cee1 (diff)
drivers/wifi,soc/intel/adl: Move CnviDdrRfim property to drivers
Some non-SoC code might want to know whether or not the CNVi DDR RFIM feature is enabled. Also note that future SoCs may also support this feature. To make the CnviDdrRfim property generic, move it from soc/intel/alderlake to drivers/wifi/generic instead. Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Change-Id: Idf9fba0a79d1f431269be5851b026ed966600160 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61638 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Rizwan Qureshi <rizwan.qureshi@intel.com> Reviewed-by: Varshit B Pandya <varshit.b.pandya@intel.com>
Diffstat (limited to 'src/drivers/wifi')
-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_ */