Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
V Sowmya | c333b98 | 2017-11-27 11:31:14 +0530 | [diff] [blame] | 2 | |
| 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 Durbin | 6403167 | 2018-04-21 14:45:32 -0600 | [diff] [blame] | 9 | __weak void soc_sram_init(struct device *dev) { /* no-op */ } |
V Sowmya | c333b98 | 2017-11-27 11:31:14 +0530 | [diff] [blame] | 10 | |
| 11 | static 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 | |
| 27 | static 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 Banik | 6bbc91a | 2017-12-07 14:55:51 +0530 | [diff] [blame] | 32 | .ops_pci = &pci_dev_ops_pci, |
V Sowmya | c333b98 | 2017-11-27 11:31:14 +0530 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | static const unsigned short pci_device_ids[] = { |
| 36 | PCI_DEVICE_ID_INTEL_APL_SRAM, |
| 37 | PCI_DEVICE_ID_INTEL_GLK_SRAM, |
Aamir Bohra | 9eac039 | 2018-06-30 12:07:04 +0530 | [diff] [blame] | 38 | PCI_DEVICE_ID_INTEL_ICL_SRAM, |
Ronak Kanabar | da7ffb48 | 2019-02-05 01:51:13 +0530 | [diff] [blame] | 39 | PCI_DEVICE_ID_INTEL_CMP_SRAM, |
Gaggery Tsai | 12a651c | 2019-12-05 11:23:20 -0800 | [diff] [blame] | 40 | PCI_DEVICE_ID_INTEL_CMP_H_SRAM, |
Ravi Sarawadi | 6b5bf40 | 2019-10-21 22:25:04 -0700 | [diff] [blame] | 41 | PCI_DEVICE_ID_INTEL_TGL_SRAM, |
Jeremy Soller | 191a8d7 | 2021-08-10 14:06:51 -0600 | [diff] [blame^] | 42 | PCI_DEVICE_ID_INTEL_TGL_H_SRAM, |
Tan, Lean Sheng | 2613609 | 2020-01-20 19:13:56 -0800 | [diff] [blame] | 43 | PCI_DEVICE_ID_INTEL_MCC_SRAM, |
Meera Ravindranath | 3f4af0d | 2020-02-12 16:01:22 +0530 | [diff] [blame] | 44 | PCI_DEVICE_ID_INTEL_JSP_SRAM, |
Subrata Banik | f672f7f | 2020-08-03 14:29:25 +0530 | [diff] [blame] | 45 | PCI_DEVICE_ID_INTEL_ADP_P_SRAM, |
| 46 | PCI_DEVICE_ID_INTEL_ADP_S_SRAM, |
Varshit Pandya | f4d98fdd2 | 2021-01-17 18:39:29 +0530 | [diff] [blame] | 47 | PCI_DEVICE_ID_INTEL_ADP_M_SRAM, |
V Sowmya | c333b98 | 2017-11-27 11:31:14 +0530 | [diff] [blame] | 48 | 0, |
| 49 | }; |
| 50 | |
| 51 | static const struct pci_driver sram __pci_driver = { |
| 52 | .ops = &device_ops, |
| 53 | .vendor = PCI_VENDOR_ID_INTEL, |
| 54 | .devices = pci_device_ids, |
| 55 | }; |