Angel Pons | c3f58f6 | 2020-04-05 15:46:41 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 2 | |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <device/pci.h> |
| 5 | #include <arch/pci_ops.h> |
| 6 | |
Julius Werner | 18ea2d3 | 2014-10-07 16:42:17 -0700 | [diff] [blame] | 7 | #include <soc/pci_devs.h> |
| 8 | #include <soc/ramstage.h> |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 9 | #include "chip.h" |
| 10 | |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 11 | static struct device_operations pci_domain_ops = { |
| 12 | .read_resources = pci_domain_read_resources, |
| 13 | .set_resources = pci_domain_set_resources, |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 14 | .scan_bus = pci_domain_scan_bus, |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 15 | }; |
| 16 | |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 17 | static struct device_operations cpu_bus_ops = { |
Nico Huber | 2f8ba69 | 2020-04-05 14:05:24 +0200 | [diff] [blame] | 18 | .read_resources = noop_read_resources, |
| 19 | .set_resources = noop_set_resources, |
Felix Held | 37e160e | 2021-10-20 23:43:12 +0200 | [diff] [blame] | 20 | .init = mp_cpu_bus_init, |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 21 | }; |
| 22 | |
Elyes HAOUAS | 17a3ceb | 2018-05-22 10:42:28 +0200 | [diff] [blame] | 23 | static void enable_dev(struct device *dev) |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 24 | { |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 25 | /* Set the operations if it is a special bus type */ |
| 26 | if (dev->path.type == DEVICE_PATH_DOMAIN) { |
| 27 | dev->ops = &pci_domain_ops; |
| 28 | } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { |
| 29 | dev->ops = &cpu_bus_ops; |
Aaron Durbin | d7bc23a | 2013-10-29 16:37:10 -0500 | [diff] [blame] | 30 | } else if (dev->path.type == DEVICE_PATH_PCI) { |
| 31 | /* Handle south cluster enablement. */ |
| 32 | if (PCI_SLOT(dev->path.pci.devfn) > GFX_DEV && |
| 33 | (dev->ops == NULL || dev->ops->enable == NULL)) { |
| 34 | southcluster_enable_dev(dev); |
| 35 | } |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 36 | } |
| 37 | } |
| 38 | |
Aaron Durbin | 452d31a | 2013-09-24 16:47:49 -0500 | [diff] [blame] | 39 | /* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */ |
| 40 | static void soc_init(void *chip_info) |
| 41 | { |
Kein Yuan | 3511023 | 2014-02-22 12:26:55 -0800 | [diff] [blame] | 42 | baytrail_init_pre_device(chip_info); |
Aaron Durbin | 452d31a | 2013-09-24 16:47:49 -0500 | [diff] [blame] | 43 | } |
| 44 | |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 45 | struct chip_operations soc_intel_baytrail_ops = { |
| 46 | CHIP_NAME("Intel BayTrail SoC") |
| 47 | .enable_dev = enable_dev, |
Aaron Durbin | 452d31a | 2013-09-24 16:47:49 -0500 | [diff] [blame] | 48 | .init = soc_init, |
Aaron Durbin | 9a7d7bc | 2013-09-07 00:41:48 -0500 | [diff] [blame] | 49 | }; |
Aaron Durbin | fda56a6 | 2013-09-24 12:29:57 -0500 | [diff] [blame] | 50 | |
Aaron Durbin | fda56a6 | 2013-09-24 12:29:57 -0500 | [diff] [blame] | 51 | struct pci_operations soc_pci_ops = { |
Subrata Banik | 4a0f071 | 2019-03-20 14:29:47 +0530 | [diff] [blame] | 52 | .set_subsystem = &pci_dev_set_subsystem, |
Aaron Durbin | fda56a6 | 2013-09-24 12:29:57 -0500 | [diff] [blame] | 53 | }; |