Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Rex-BC Chen | 362a481 | 2021-12-02 19:17:06 +0800 | [diff] [blame] | 3 | #include <bootmem.h> |
Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 4 | #include <device/device.h> |
Runyang Chen | a0583a4 | 2021-12-19 21:15:03 +0800 | [diff] [blame] | 5 | #include <soc/devapc.h> |
Rex-BC Chen | 362a481 | 2021-12-02 19:17:06 +0800 | [diff] [blame] | 6 | #include <soc/dfd.h> |
Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 7 | #include <soc/emi.h> |
Rex-BC Chen | f8eed65 | 2021-11-11 15:50:42 +0800 | [diff] [blame] | 8 | #include <soc/mmu_operations.h> |
Rex-BC Chen | d8e8c87 | 2021-11-08 14:28:54 +0800 | [diff] [blame] | 9 | #include <soc/sspm.h> |
Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 10 | #include <symbols.h> |
| 11 | |
Rex-BC Chen | 362a481 | 2021-12-02 19:17:06 +0800 | [diff] [blame] | 12 | void bootmem_platform_add_ranges(void) |
| 13 | { |
| 14 | if (CONFIG(MTK_DFD)) |
| 15 | bootmem_add_range(DFD_DUMP_ADDRESS, DFD_DUMP_SIZE, BM_MEM_RESERVED); |
| 16 | } |
| 17 | |
Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 18 | static void soc_read_resources(struct device *dev) |
| 19 | { |
| 20 | ram_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size() / KiB); |
| 21 | } |
| 22 | |
| 23 | static void soc_init(struct device *dev) |
| 24 | { |
Rex-BC Chen | f8eed65 | 2021-11-11 15:50:42 +0800 | [diff] [blame] | 25 | mtk_mmu_disable_l2c_sram(); |
Rex-BC Chen | d8e8c87 | 2021-11-08 14:28:54 +0800 | [diff] [blame] | 26 | sspm_init(); |
Runyang Chen | a0583a4 | 2021-12-19 21:15:03 +0800 | [diff] [blame] | 27 | dapc_init(); |
Rex-BC Chen | 362a481 | 2021-12-02 19:17:06 +0800 | [diff] [blame] | 28 | |
| 29 | if (CONFIG(MTK_DFD)) |
| 30 | dfd_init(); |
Rex-BC Chen | 73e6b8e | 2021-11-02 10:31:53 +0800 | [diff] [blame] | 31 | } |
| 32 | |
| 33 | static struct device_operations soc_ops = { |
| 34 | .read_resources = soc_read_resources, |
| 35 | .init = soc_init, |
| 36 | }; |
| 37 | |
| 38 | static void enable_soc_dev(struct device *dev) |
| 39 | { |
| 40 | dev->ops = &soc_ops; |
| 41 | } |
| 42 | |
| 43 | struct chip_operations soc_mediatek_mt8186_ops = { |
| 44 | CHIP_NAME("SOC Mediatek MT8186") |
| 45 | .enable_dev = enable_soc_dev, |
| 46 | }; |