blob: 60e06dc368877de8a55af75b2db062f706099673 [file] [log] [blame]
Patrick Georgiac959032020-05-05 22:49:26 +02001/* SPDX-License-Identifier: GPL-2.0-or-later */
V Sowmyac333b982017-11-27 11:31:14 +05302
3#include <device/device.h>
4#include <device/pci.h>
5#include <device/pci_ids.h>
6#include <intelblocks/sram.h>
7#include <soc/iomap.h>
8
Aaron Durbin64031672018-04-21 14:45:32 -06009__weak void soc_sram_init(struct device *dev) { /* no-op */ }
V Sowmyac333b982017-11-27 11:31:14 +053010
11static void sram_read_resources(struct device *dev)
12{
13 struct resource *res;
14 pci_dev_read_resources(dev);
15
16 res = new_resource(dev, PCI_BASE_ADDRESS_0);
17 res->base = SRAM_BASE_0;
18 res->size = SRAM_SIZE_0;
19 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
20
21 res = new_resource(dev, PCI_BASE_ADDRESS_2);
22 res->base = SRAM_BASE_2;
23 res->size = SRAM_SIZE_2;
24 res->flags = IORESOURCE_MEM | IORESOURCE_ASSIGNED | IORESOURCE_FIXED;
25}
26
27static const struct device_operations device_ops = {
28 .read_resources = sram_read_resources,
29 .set_resources = pci_dev_set_resources,
30 .enable_resources = pci_dev_enable_resources,
31 .init = soc_sram_init,
Subrata Banik6bbc91a2017-12-07 14:55:51 +053032 .ops_pci = &pci_dev_ops_pci,
V Sowmyac333b982017-11-27 11:31:14 +053033};
34
35static const unsigned short pci_device_ids[] = {
Felix Singer43b7f412022-03-07 04:34:52 +010036 PCI_DID_INTEL_APL_SRAM,
37 PCI_DID_INTEL_GLK_SRAM,
38 PCI_DID_INTEL_ICL_SRAM,
39 PCI_DID_INTEL_CMP_SRAM,
40 PCI_DID_INTEL_CMP_H_SRAM,
41 PCI_DID_INTEL_TGP_PMC_CRASHLOG_SRAM,
42 PCI_DID_INTEL_TGL_H_SRAM,
43 PCI_DID_INTEL_MCC_SRAM,
44 PCI_DID_INTEL_JSP_SRAM,
45 PCI_DID_INTEL_ADP_S_PMC_CRASHLOG_SRAM,
46 PCI_DID_INTEL_ADP_P_PMC_CRASHLOG_SRAM,
47 PCI_DID_INTEL_ADP_N_PMC_CRASHLOG_SRAM,
V Sowmyac333b982017-11-27 11:31:14 +053048 0,
49};
50
51static const struct pci_driver sram __pci_driver = {
52 .ops = &device_ops,
Felix Singer43b7f412022-03-07 04:34:52 +010053 .vendor = PCI_VID_INTEL,
V Sowmyac333b982017-11-27 11:31:14 +053054 .devices = pci_device_ids,
55};