blob: 8dd53cc14fd9f4304b62dae5d81e4cb2666500ee [file] [log] [blame]
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +05301/* SPDX-License-Identifier: GPL-2.0-only */
2
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +05303#include <device/device.h>
4#include <soc/mmu.h>
5#include <soc/mmu_common.h>
6#include <soc/symbols_common.h>
Ravi Kumar Bokkab0d48ed2021-01-21 02:54:48 +05307#include <soc/cpucp.h>
Prasad Malisetty78298f52022-07-25 13:35:05 +05308#include <soc/pcie.h>
9
10static struct device_operations pci_domain_ops = {
11 .read_resources = &qcom_pci_domain_read_resources,
12 .set_resources = &pci_domain_set_resources,
Arthur Heymans0b0113f2023-08-31 17:09:28 +020013 .scan_bus = &pci_host_bridge_scan_bus,
Prasad Malisetty78298f52022-07-25 13:35:05 +053014 .enable = &qcom_setup_pcie_host,
15};
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053016
17static void soc_read_resources(struct device *dev)
18{
T Michael Turney730107e2022-01-19 18:27:47 -080019 void *start = NULL;
20 void *end = NULL;
21
Nico Huberf55b7112024-01-11 18:50:50 +010022 ram_range(dev, 0, (uintptr_t)region_offset(ddr_region), region_sz(ddr_region));
Kyösti Mälkkif35c0742021-06-26 14:12:54 +030023 reserved_ram_range(dev, 1, (uintptr_t)_dram_soc, REGION_SIZE(dram_soc));
24 reserved_ram_range(dev, 2, (uintptr_t)_dram_wlan, REGION_SIZE(dram_wlan));
25 reserved_ram_range(dev, 3, (uintptr_t)_dram_wpss, REGION_SIZE(dram_wpss));
26 reserved_ram_range(dev, 4, (uintptr_t)_dram_aop, REGION_SIZE(dram_aop));
27 reserved_ram_range(dev, 5, (uintptr_t)_dram_cpucp, REGION_SIZE(dram_cpucp));
T Michael Turney730107e2022-01-19 18:27:47 -080028 if (soc_modem_carve_out(&start, &end))
Kyösti Mälkkif35c0742021-06-26 14:12:54 +030029 reserved_ram_range(dev, 6, (uintptr_t)start, end - start);
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053030}
31
32static void soc_init(struct device *dev)
33{
Ravi Kumar Bokkab0d48ed2021-01-21 02:54:48 +053034 cpucp_fw_load_reset();
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053035}
36
37static struct device_operations soc_ops = {
38 .read_resources = soc_read_resources,
Kshitiz Godarab53ef222022-06-23 10:20:38 +053039 .set_resources = noop_set_resources,
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053040 .init = soc_init,
41};
42
43static void enable_soc_dev(struct device *dev)
44{
Prasad Malisetty78298f52022-07-25 13:35:05 +053045 /* Set the operations if it is a special bus type */
Shelley Chenf6307ca2022-11-16 17:02:32 -080046 if (dev->path.type == DEVICE_PATH_DOMAIN) {
47 if (mainboard_needs_pcie_init())
48 dev->ops = &pci_domain_ops;
49 else
50 printk(BIOS_DEBUG, "Skip setting PCIe ops\n");
51 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
Prasad Malisetty78298f52022-07-25 13:35:05 +053052 dev->ops = &soc_ops;
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053053}
54
55struct chip_operations soc_qualcomm_sc7280_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090056 .name = "SOC Qualcomm SC7280",
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053057 .enable_dev = enable_soc_dev,
58};