blob: fdfd1299e6873d6ef72bc44a546c1037273afa79 [file] [log] [blame]
Angel Ponsc3f58f62020-04-05 15:46:41 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -05002
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -05003#include <device/device.h>
4#include <device/pci.h>
5#include <arch/pci_ops.h>
6
Julius Werner18ea2d32014-10-07 16:42:17 -07007#include <soc/pci_devs.h>
8#include <soc/ramstage.h>
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -05009#include "chip.h"
10
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050011static struct device_operations pci_domain_ops = {
12 .read_resources = pci_domain_read_resources,
13 .set_resources = pci_domain_set_resources,
Arthur Heymans0b0113f2023-08-31 17:09:28 +020014 .scan_bus = pci_host_bridge_scan_bus,
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050015};
16
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050017static struct device_operations cpu_bus_ops = {
Nico Huber2f8ba692020-04-05 14:05:24 +020018 .read_resources = noop_read_resources,
19 .set_resources = noop_set_resources,
Felix Held37e160e2021-10-20 23:43:12 +020020 .init = mp_cpu_bus_init,
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050021};
22
Elyes HAOUAS17a3ceb2018-05-22 10:42:28 +020023static void enable_dev(struct device *dev)
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050024{
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050025 /* 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 Durbind7bc23a2013-10-29 16:37:10 -050030 } 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 Durbin9a7d7bc2013-09-07 00:41:48 -050036 }
37}
38
Aaron Durbin452d31a2013-09-24 16:47:49 -050039/* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */
40static void soc_init(void *chip_info)
41{
Kein Yuan35110232014-02-22 12:26:55 -080042 baytrail_init_pre_device(chip_info);
Aaron Durbin452d31a2013-09-24 16:47:49 -050043}
44
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050045struct chip_operations soc_intel_baytrail_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090046 .name = "Intel BayTrail SoC",
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050047 .enable_dev = enable_dev,
Aaron Durbin452d31a2013-09-24 16:47:49 -050048 .init = soc_init,
Aaron Durbin9a7d7bc2013-09-07 00:41:48 -050049};
Aaron Durbinfda56a62013-09-24 12:29:57 -050050
Aaron Durbinfda56a62013-09-24 12:29:57 -050051struct pci_operations soc_pci_ops = {
Subrata Banik4a0f0712019-03-20 14:29:47 +053052 .set_subsystem = &pci_dev_set_subsystem,
Aaron Durbinfda56a62013-09-24 12:29:57 -050053};