Ravi Kumar Bokka | 0c9eb31 | 2021-03-31 08:04:13 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Ravi Kumar Bokka | 0c9eb31 | 2021-03-31 08:04:13 +0530 | [diff] [blame] | 3 | #include <device/device.h> |
| 4 | #include <soc/mmu.h> |
| 5 | #include <soc/mmu_common.h> |
| 6 | #include <soc/symbols_common.h> |
Ravi Kumar Bokka | 5fa09cb | 2021-10-21 20:18:12 +0530 | [diff] [blame] | 7 | #include <soc/aop_common.h> |
Ravi Kumar Bokka | b0d48ed | 2021-01-21 02:54:48 +0530 | [diff] [blame] | 8 | #include <soc/cpucp.h> |
Ravi Kumar Bokka | 0c9eb31 | 2021-03-31 08:04:13 +0530 | [diff] [blame] | 9 | |
| 10 | static void soc_read_resources(struct device *dev) |
| 11 | { |
T Michael Turney | 730107e | 2022-01-19 18:27:47 -0800 | [diff] [blame] | 12 | void *start = NULL; |
| 13 | void *end = NULL; |
| 14 | |
Kyösti Mälkki | f35c074 | 2021-06-26 14:12:54 +0300 | [diff] [blame] | 15 | ram_range(dev, 0, (uintptr_t)ddr_region->offset, ddr_region->size); |
| 16 | reserved_ram_range(dev, 1, (uintptr_t)_dram_soc, REGION_SIZE(dram_soc)); |
| 17 | reserved_ram_range(dev, 2, (uintptr_t)_dram_wlan, REGION_SIZE(dram_wlan)); |
| 18 | reserved_ram_range(dev, 3, (uintptr_t)_dram_wpss, REGION_SIZE(dram_wpss)); |
| 19 | reserved_ram_range(dev, 4, (uintptr_t)_dram_aop, REGION_SIZE(dram_aop)); |
| 20 | reserved_ram_range(dev, 5, (uintptr_t)_dram_cpucp, REGION_SIZE(dram_cpucp)); |
T Michael Turney | 730107e | 2022-01-19 18:27:47 -0800 | [diff] [blame] | 21 | if (soc_modem_carve_out(&start, &end)) |
Kyösti Mälkki | f35c074 | 2021-06-26 14:12:54 +0300 | [diff] [blame] | 22 | reserved_ram_range(dev, 6, (uintptr_t)start, end - start); |
Ravi Kumar Bokka | 0c9eb31 | 2021-03-31 08:04:13 +0530 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | static void soc_init(struct device *dev) |
| 26 | { |
Ravi Kumar Bokka | 5fa09cb | 2021-10-21 20:18:12 +0530 | [diff] [blame] | 27 | aop_fw_load_reset(); |
Ravi Kumar Bokka | b0d48ed | 2021-01-21 02:54:48 +0530 | [diff] [blame] | 28 | cpucp_fw_load_reset(); |
Ravi Kumar Bokka | 0c9eb31 | 2021-03-31 08:04:13 +0530 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | static struct device_operations soc_ops = { |
| 32 | .read_resources = soc_read_resources, |
Kshitiz Godara | b53ef22 | 2022-06-23 10:20:38 +0530 | [diff] [blame] | 33 | .set_resources = noop_set_resources, |
Ravi Kumar Bokka | 0c9eb31 | 2021-03-31 08:04:13 +0530 | [diff] [blame] | 34 | .init = soc_init, |
| 35 | }; |
| 36 | |
| 37 | static void enable_soc_dev(struct device *dev) |
| 38 | { |
| 39 | dev->ops = &soc_ops; |
| 40 | } |
| 41 | |
| 42 | struct chip_operations soc_qualcomm_sc7280_ops = { |
| 43 | CHIP_NAME("SOC Qualcomm SC7280") |
| 44 | .enable_dev = enable_soc_dev, |
| 45 | }; |