summaryrefslogtreecommitdiff
path: root/src/drivers/wifi/generic/generic.c
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/generic/generic.c
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/generic/generic.c')
-rw-r--r--src/drivers/wifi/generic/generic.c31
1 files changed, 27 insertions, 4 deletions
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 = {