blob: 2407439b0b4ddc5673226944a11fb6ed9ad7dd95 [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>
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +05309
10static void soc_read_resources(struct device *dev)
11{
T Michael Turney730107e2022-01-19 18:27:47 -080012 void *start = NULL;
13 void *end = NULL;
14
Kyösti Mälkki27d62992022-05-24 20:25:58 +030015 ram_resource_kb(dev, 0, (uintptr_t)ddr_region->offset / KiB,
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053016 ddr_region->size / KiB);
Kyösti Mälkki27d62992022-05-24 20:25:58 +030017 reserved_ram_resource_kb(dev, 1, (uintptr_t)_dram_soc / KiB,
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053018 REGION_SIZE(dram_soc) / KiB);
Kyösti Mälkki27d62992022-05-24 20:25:58 +030019 reserved_ram_resource_kb(dev, 2, (uintptr_t)_dram_wlan / KiB,
Ravi Kumar Bokkab0d48ed2021-01-21 02:54:48 +053020 REGION_SIZE(dram_wlan) / KiB);
Kyösti Mälkki27d62992022-05-24 20:25:58 +030021 reserved_ram_resource_kb(dev, 3, (uintptr_t)_dram_wpss / KiB,
Ravi Kumar Bokkab0d48ed2021-01-21 02:54:48 +053022 REGION_SIZE(dram_wpss) / KiB);
Kyösti Mälkki27d62992022-05-24 20:25:58 +030023 reserved_ram_resource_kb(dev, 4, (uintptr_t)_dram_aop / KiB,
Ravi Kumar Bokkaf8e4ba02021-10-21 20:14:09 +053024 REGION_SIZE(dram_aop) / KiB);
Kyösti Mälkki27d62992022-05-24 20:25:58 +030025 reserved_ram_resource_kb(dev, 5, (uintptr_t)_dram_cpucp / KiB,
Ravi Kumar Bokkab0d48ed2021-01-21 02:54:48 +053026 REGION_SIZE(dram_cpucp) / KiB);
T Michael Turney730107e2022-01-19 18:27:47 -080027 if (soc_modem_carve_out(&start, &end))
Kyösti Mälkki27d62992022-05-24 20:25:58 +030028 reserved_ram_resource_kb(dev, 6, (uintptr_t)start / KiB, (end - start) / KiB);
Ravi Kumar Bokka0c9eb312021-03-31 08:04:13 +053029}
30
31static void soc_init(struct device *dev)
32{
Ravi Kumar Bokka5fa09cb2021-10-21 20:18:12 +053033 aop_fw_load_reset();
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,
39 .init = soc_init,
40};
41
42static void enable_soc_dev(struct device *dev)
43{
44 dev->ops = &soc_ops;
45}
46
47struct chip_operations soc_qualcomm_sc7280_ops = {
48 CHIP_NAME("SOC Qualcomm SC7280")
49 .enable_dev = enable_soc_dev,
50};