CK Hu | 958ab46 | 2020-04-07 12:06:31 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Rex-BC Chen | eef442d | 2021-07-12 15:01:11 +0800 | [diff] [blame] | 3 | #include <bootmem.h> |
CK Hu | 958ab46 | 2020-04-07 12:06:31 +0800 | [diff] [blame] | 4 | #include <device/device.h> |
Chien-Chih Tseng | a39ea90 | 2020-12-14 14:59:39 +0800 | [diff] [blame] | 5 | #include <soc/apusys.h> |
Nina Wu | 87c30a0 | 2020-09-04 10:11:27 +0800 | [diff] [blame] | 6 | #include <soc/devapc.h> |
Rex-BC Chen | eef442d | 2021-07-12 15:01:11 +0800 | [diff] [blame] | 7 | #include <soc/dfd.h> |
CK Hu | 958ab46 | 2020-04-07 12:06:31 +0800 | [diff] [blame] | 8 | #include <soc/emi.h> |
Yidi Lin | f4bf8f5f | 2020-07-29 19:18:38 +0800 | [diff] [blame] | 9 | #include <soc/mcupm.h> |
CK Hu | 3398f315 | 2020-06-16 11:54:38 +0800 | [diff] [blame] | 10 | #include <soc/mmu_operations.h> |
TingHan.Shen | be404c2 | 2020-11-20 14:42:23 +0800 | [diff] [blame] | 11 | #include <soc/sspm.h> |
Wenbin Mei | 1985894 | 2020-09-25 10:03:02 +0800 | [diff] [blame] | 12 | #include <soc/ufs.h> |
CK Hu | 958ab46 | 2020-04-07 12:06:31 +0800 | [diff] [blame] | 13 | #include <symbols.h> |
| 14 | |
Rex-BC Chen | eef442d | 2021-07-12 15:01:11 +0800 | [diff] [blame] | 15 | void bootmem_platform_add_ranges(void) |
| 16 | { |
| 17 | if (CONFIG(MTK_DFD)) |
| 18 | bootmem_add_range(DFD_DUMP_ADDRESS, DFD_DUMP_SIZE, BM_MEM_RESERVED); |
| 19 | } |
| 20 | |
CK Hu | 958ab46 | 2020-04-07 12:06:31 +0800 | [diff] [blame] | 21 | static void soc_read_resources(struct device *dev) |
| 22 | { |
| 23 | ram_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size() / KiB); |
| 24 | } |
| 25 | |
| 26 | static void soc_init(struct device *dev) |
| 27 | { |
CK Hu | 3398f315 | 2020-06-16 11:54:38 +0800 | [diff] [blame] | 28 | mtk_mmu_disable_l2c_sram(); |
Chien-Chih Tseng | a39ea90 | 2020-12-14 14:59:39 +0800 | [diff] [blame] | 29 | apusys_init(); |
Nina Wu | 87c30a0 | 2020-09-04 10:11:27 +0800 | [diff] [blame] | 30 | dapc_init(); |
Yidi Lin | f4bf8f5f | 2020-07-29 19:18:38 +0800 | [diff] [blame] | 31 | mcupm_init(); |
TingHan.Shen | be404c2 | 2020-11-20 14:42:23 +0800 | [diff] [blame] | 32 | sspm_init(); |
Rex-BC Chen | eef442d | 2021-07-12 15:01:11 +0800 | [diff] [blame] | 33 | if (CONFIG(MTK_DFD)) |
| 34 | dfd_init(); |
Wenbin Mei | 1985894 | 2020-09-25 10:03:02 +0800 | [diff] [blame] | 35 | ufs_disable_refclk(); |
CK Hu | 958ab46 | 2020-04-07 12:06:31 +0800 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | static struct device_operations soc_ops = { |
| 39 | .read_resources = soc_read_resources, |
| 40 | .init = soc_init, |
| 41 | }; |
| 42 | |
| 43 | static void enable_soc_dev(struct device *dev) |
| 44 | { |
| 45 | dev->ops = &soc_ops; |
| 46 | } |
| 47 | |
| 48 | struct chip_operations soc_mediatek_mt8192_ops = { |
| 49 | CHIP_NAME("SOC Mediatek MT8192") |
| 50 | .enable_dev = enable_soc_dev, |
| 51 | }; |