1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/device.h>
4 #include <device/pci.h>
5 #include <device/pci_ids.h>
8 #include "wifi_private.h"
11 static void wifi_pci_dev_init(struct device
*dev
)
13 if (pci_dev_is_wake_source(PCI_BDF(dev
)))
14 elog_add_event_wake(ELOG_WAKE_SOURCE_PME_WIFI
, 0);
17 struct device_operations wifi_pcie_ops
= {
18 .read_resources
= pci_dev_read_resources
,
19 .set_resources
= pci_dev_set_resources
,
20 .enable_resources
= pci_dev_enable_resources
,
21 .init
= wifi_pci_dev_init
,
22 .ops_pci
= &pci_dev_ops_pci
,
23 #if CONFIG(HAVE_ACPI_TABLES)
24 .acpi_name
= wifi_pcie_acpi_name
,
25 .acpi_fill_ssdt
= wifi_pcie_fill_ssdt
,
27 #if CONFIG(GENERATE_SMBIOS_TABLES)
28 .get_smbios_data
= smbios_write_wifi_pcie
,
32 struct device_operations wifi_cnvi_ops
= {
33 .read_resources
= noop_read_resources
,
34 .set_resources
= noop_set_resources
,
35 #if CONFIG(HAVE_ACPI_TABLES)
36 .acpi_fill_ssdt
= wifi_cnvi_fill_ssdt
,
38 #if CONFIG(GENERATE_SMBIOS_TABLES)
39 .get_smbios_data
= smbios_write_wifi_cnvi
,
43 static bool is_cnvi(const struct device
*dev
)
45 return dev
&& dev
->path
.type
!= DEVICE_PATH_PCI
;
48 bool wifi_generic_cnvi_ddr_rfim_enabled(const struct device
*dev
)
50 const struct drivers_wifi_generic_config
*config
;
52 if (!dev
|| !is_cnvi(dev
) || !dev
->chip_info
)
55 config
= dev
->chip_info
;
56 return config
->enable_cnvi_ddr_rfim
;
59 static void wifi_generic_enable(struct device
*dev
)
63 dev
->ops
= &wifi_cnvi_ops
;
65 dev
->ops
= &wifi_pcie_ops
;
69 struct chip_operations drivers_wifi_generic_ops
= {
70 .name
= "WIFI Device",
71 .enable_dev
= wifi_generic_enable
74 static const unsigned short intel_pci_device_ids
[] = {
75 PCI_DID_1000_SERIES_WIFI
,
76 PCI_DID_6005_SERIES_WIFI
,
77 PCI_DID_6005_I_SERIES_WIFI
,
78 PCI_DID_1030_SERIES_WIFI
,
79 PCI_DID_6030_I_SERIES_WIFI
,
80 PCI_DID_6030_SERIES_WIFI
,
81 PCI_DID_6150_SERIES_WIFI
,
82 PCI_DID_2030_SERIES_WIFI
,
83 PCI_DID_2000_SERIES_WIFI
,
84 PCI_DID_0135_SERIES_WIFI
,
85 PCI_DID_0105_SERIES_WIFI
,
86 PCI_DID_6035_SERIES_WIFI
,
87 PCI_DID_5300_SERIES_WIFI
,
88 PCI_DID_5100_SERIES_WIFI
,
89 PCI_DID_6000_SERIES_WIFI
,
90 PCI_DID_6000_I_SERIES_WIFI
,
91 PCI_DID_5350_SERIES_WIFI
,
92 PCI_DID_5150_SERIES_WIFI
,
94 PCI_DID_WP_7260_SERIES_1_WIFI
,
95 PCI_DID_WP_7260_SERIES_2_WIFI
,
97 PCI_DID_SP_7265_SERIES_1_WIFI
,
98 PCI_DID_SP_7265_SERIES_2_WIFI
,
99 /* Stone Field Peak */
100 PCI_DID_SFP_8260_SERIES_1_WIFI
,
101 PCI_DID_SFP_8260_SERIES_2_WIFI
,
103 PCI_DID_WSP_8275_SERIES_1_WIFI
,
105 PCI_DID_TP_9260_SERIES_WIFI
,
106 /* Cyclone Peak (CyP) */
107 PCI_DID_CP_6SERIES_WIFI
,
108 /* Typhoon Peak (TyP) */
109 PCI_DID_TP_6SERIES_WIFI
,
110 /* Misty Peak (MtP) */
111 PCI_DID_MP_7SERIES_WIFI
,
116 * The PCI driver is retained for backward compatibility with boards that never utilized the
117 * chip driver to support Intel WiFi device. For these devices, the PCI driver helps perform the
118 * same operations as above (except exposing the wake property) by utilizing the same
119 * `wifi_generic_ops`.
121 static const struct pci_driver intel_wifi_pci_driver __pci_driver
= {
122 .ops
= &wifi_pcie_ops
,
123 .vendor
= PCI_VID_INTEL
,
124 .devices
= intel_pci_device_ids
,