Patrick Georgi | ac95903 | 2020-05-05 22:49:26 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
T Michael Turney | 7783c60 | 2019-10-09 07:04:54 -0700 | [diff] [blame] | 2 | |
| 3 | #include <symbols.h> |
| 4 | #include <device/device.h> |
| 5 | #include <soc/mmu.h> |
| 6 | #include <soc/mmu_common.h> |
Ravi Kumar Bokka | ce97bca | 2021-03-05 16:01:07 +0530 | [diff] [blame] | 7 | #include <soc/symbols_common.h> |
Ravi Kumar Bokka | 6bbf8f2 | 2019-08-12 14:54:21 +0530 | [diff] [blame] | 8 | #include <soc/aop.h> |
T Michael Turney | 7783c60 | 2019-10-09 07:04:54 -0700 | [diff] [blame] | 9 | |
| 10 | static void soc_read_resources(struct device *dev) |
| 11 | { |
mkurumel | a9d225b | 2020-09-14 23:28:53 +0530 | [diff] [blame] | 12 | void *start = NULL; |
| 13 | void *end = NULL; |
| 14 | |
T Michael Turney | 7783c60 | 2019-10-09 07:04:54 -0700 | [diff] [blame] | 15 | ram_resource(dev, 0, (uintptr_t)ddr_region->offset / KiB, |
| 16 | ddr_region->size / KiB); |
Ravi Kumar Bokka | 6bbf8f2 | 2019-08-12 14:54:21 +0530 | [diff] [blame] | 17 | reserved_ram_resource(dev, 1, (uintptr_t)_dram_aop / KiB, |
| 18 | REGION_SIZE(dram_aop) / KiB); |
| 19 | reserved_ram_resource(dev, 2, (uintptr_t)_dram_soc / KiB, |
T Michael Turney | 7783c60 | 2019-10-09 07:04:54 -0700 | [diff] [blame] | 20 | REGION_SIZE(dram_soc) / KiB); |
mkurumel | a9d225b | 2020-09-14 23:28:53 +0530 | [diff] [blame] | 21 | if (soc_modem_carve_out(&start, &end)) |
| 22 | reserved_ram_resource(dev, 3, (uintptr_t)start / KiB, (end - start) / KiB); |
T Michael Turney | 7783c60 | 2019-10-09 07:04:54 -0700 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | static void soc_init(struct device *dev) |
| 26 | { |
Ravi Kumar Bokka | 6bbf8f2 | 2019-08-12 14:54:21 +0530 | [diff] [blame] | 27 | aop_fw_load_reset(); |
T Michael Turney | 7783c60 | 2019-10-09 07:04:54 -0700 | [diff] [blame] | 28 | } |
| 29 | |
| 30 | static struct device_operations soc_ops = { |
| 31 | .read_resources = soc_read_resources, |
| 32 | .init = soc_init, |
| 33 | }; |
| 34 | |
| 35 | static void enable_soc_dev(struct device *dev) |
| 36 | { |
| 37 | dev->ops = &soc_ops; |
| 38 | } |
| 39 | |
| 40 | struct chip_operations soc_qualcomm_sc7180_ops = { |
| 41 | CHIP_NAME("SOC Qualcomm SC7180") |
| 42 | .enable_dev = enable_soc_dev, |
| 43 | }; |