blob: a6851dfcd7e8197c09ca832472c571fa298b8806 [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 Bokka5fa09cb2021-10-21 20:18:12 +05307#include <soc/aop_common.h>
Ravi Kumar Bokkab0d48ed2021-01-21 02:54:48 +05308#include <soc/cpucp.h>
Prasad Malisetty78298f52022-07-25 13:35:05 +05309#include <soc/pcie.h>
10
11static struct device_operations pci_domain_ops = {
12 .read_resources = &qcom_pci_domain_read_resources,
13 .set_resources = &pci_domain_set_resources,
14 .scan_bus = &pci_domain_scan_bus,
15 .enable = &qcom_setup_pcie_host,
16};
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053017
18static void soc_read_resources(struct device *dev)
19{
T Michael Turney730107e2022-01-19 18:27:47 -080020 void *start = NULL;
21 void *end = NULL;
22
Kyösti Mälkkif35c0742021-06-26 14:12:54 +030023 ram_range(dev, 0, (uintptr_t)ddr_region->offset, ddr_region->size);
24 reserved_ram_range(dev, 1, (uintptr_t)_dram_soc, REGION_SIZE(dram_soc));
25 reserved_ram_range(dev, 2, (uintptr_t)_dram_wlan, REGION_SIZE(dram_wlan));
26 reserved_ram_range(dev, 3, (uintptr_t)_dram_wpss, REGION_SIZE(dram_wpss));
27 reserved_ram_range(dev, 4, (uintptr_t)_dram_aop, REGION_SIZE(dram_aop));
28 reserved_ram_range(dev, 5, (uintptr_t)_dram_cpucp, REGION_SIZE(dram_cpucp));
T Michael Turney730107e2022-01-19 18:27:47 -080029 if (soc_modem_carve_out(&start, &end))
Kyösti Mälkkif35c0742021-06-26 14:12:54 +030030 reserved_ram_range(dev, 6, (uintptr_t)start, end - start);
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053031}
32
33static void soc_init(struct device *dev)
34{
Ravi Kumar Bokka5fa09cb2021-10-21 20:18:12 +053035 aop_fw_load_reset();
Ravi Kumar Bokkab0d48ed2021-01-21 02:54:48 +053036 cpucp_fw_load_reset();
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053037}
38
39static struct device_operations soc_ops = {
40 .read_resources = soc_read_resources,
Kshitiz Godarab53ef222022-06-23 10:20:38 +053041 .set_resources = noop_set_resources,
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053042 .init = soc_init,
43};
44
45static void enable_soc_dev(struct device *dev)
46{
Prasad Malisetty78298f52022-07-25 13:35:05 +053047 /* Set the operations if it is a special bus type */
48 if (dev->path.type == DEVICE_PATH_DOMAIN)
49 dev->ops = &pci_domain_ops;
50 else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
51 dev->ops = &soc_ops;
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053052}
53
54struct chip_operations soc_qualcomm_sc7280_ops = {
55 CHIP_NAME("SOC Qualcomm SC7280")
56 .enable_dev = enable_soc_dev,
57};