Debian Codegraph @

src/soc/qualcomm/x1p42100/soc.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <device/device.h>
4 #include <soc/mmu.h>
5 #include <soc/mmu_common.h>
6 #include <soc/symbols_common.h>
7 #include <soc/pcie.h>
8 #include <soc/cpucp.h>
9
10 static struct device_operations pci_domain_ops = {
11 .read_resources = &qcom_pci_domain_read_resources,
12 .set_resources = &pci_domain_set_resources,
13 .scan_bus = &pci_host_bridge_scan_bus,
14 .enable = &qcom_setup_pcie_host,
15 };
16
17 static void soc_read_resources(struct device *dev)
18 {
19 int index = 0;
20 int count;
21 struct region *config = qc_get_soc_dram_space_config(region_sz(ddr_region),
22 &count);
23
24 for (int i = 0; i < count; i++)
25 ram_range(dev, index++, (uintptr_t)config[i].offset, config[i].size);
26
27 reserved_ram_range(dev, index++, (uintptr_t)_dram_cpucp, REGION_SIZE(dram_cpucp));
28
29 reserved_ram_range(dev, index++, (uintptr_t)_dram_ramdump, REGION_SIZE(dram_ramdump));
30
31 reserved_ram_range(dev, index++, (uintptr_t)_dram_tz, REGION_SIZE(dram_tz));
32 reserved_ram_range(dev, index++, (uintptr_t)_dram_tz_rem, REGION_SIZE(dram_tz_rem));
33
34 reserved_ram_range(dev, index++, (uintptr_t)_dram_aop, REGION_SIZE(dram_aop));
35
36 reserved_ram_range(dev, index++, (uintptr_t)_dram_smem, REGION_SIZE(dram_smem));
37 }
38
39 static void soc_init(struct device *dev)
40 {
41 cpucp_fw_load_reset();
42 }
43
44 static struct device_operations soc_ops = {
45 .read_resources = soc_read_resources,
46 .set_resources = noop_set_resources,
47 .init = soc_init,
48 };
49
50 static void enable_soc_dev(struct device *dev)
51 {
52 /* Set the operations if it is a special bus type */
53 if (dev->path.type == DEVICE_PATH_DOMAIN) {
54 if (mainboard_needs_pcie_init())
55 dev->ops = &pci_domain_ops;
56 else
57 printk(BIOS_DEBUG, "Skip setting PCIe ops\n");
58 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER)
59 dev->ops = &soc_ops;
60 }
61
62 struct chip_operations soc_qualcomm_x1p42100_ops = {
63 .name = "SOC Qualcomm X1P-42-100",
64 .enable_dev = enable_soc_dev,
65 };