Yidi Lin | 24ea3f3 | 2021-01-07 20:25:54 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Rex-BC Chen | 61be50d | 2021-08-10 12:39:32 +0800 | [diff] [blame] | 3 | #include <bootmem.h> |
Yidi Lin | 24ea3f3 | 2021-01-07 20:25:54 +0800 | [diff] [blame] | 4 | #include <device/device.h> |
Flora Fu | 5cd1871 | 2021-06-25 23:27:56 +0800 | [diff] [blame] | 5 | #include <soc/apusys.h> |
Nina Wu | c25aa5b | 2021-06-21 09:13:19 +0800 | [diff] [blame] | 6 | #include <soc/devapc.h> |
Rex-BC Chen | 61be50d | 2021-08-10 12:39:32 +0800 | [diff] [blame] | 7 | #include <soc/dfd.h> |
Yidi Lin | 24ea3f3 | 2021-01-07 20:25:54 +0800 | [diff] [blame] | 8 | #include <soc/emi.h> |
Rex-BC Chen | 8316db2 | 2021-08-13 16:34:26 +0800 | [diff] [blame] | 9 | #include <soc/hdmi.h> |
alex.miao | 4a2887f | 2021-05-17 21:58:55 +0800 | [diff] [blame] | 10 | #include <soc/mcupm.h> |
Yidi Lin | 27be904 | 2021-03-25 17:50:14 +0800 | [diff] [blame] | 11 | #include <soc/mmu_operations.h> |
Rex-BC Chen | ab2cbf7 | 2021-05-03 20:44:09 +0800 | [diff] [blame] | 12 | #include <soc/sspm.h> |
Yidi Lin | be8621d | 2021-04-19 16:06:55 +0800 | [diff] [blame] | 13 | #include <soc/ufs.h> |
Yidi Lin | 24ea3f3 | 2021-01-07 20:25:54 +0800 | [diff] [blame] | 14 | #include <symbols.h> |
| 15 | |
Rex-BC Chen | 61be50d | 2021-08-10 12:39:32 +0800 | [diff] [blame] | 16 | void bootmem_platform_add_ranges(void) |
| 17 | { |
| 18 | if (CONFIG(MTK_DFD)) |
| 19 | bootmem_add_range(DFD_DUMP_ADDRESS, DFD_DUMP_SIZE, BM_MEM_RESERVED); |
| 20 | } |
| 21 | |
Yidi Lin | 24ea3f3 | 2021-01-07 20:25:54 +0800 | [diff] [blame] | 22 | static void soc_read_resources(struct device *dev) |
| 23 | { |
| 24 | ram_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size() / KiB); |
| 25 | } |
| 26 | |
| 27 | static void soc_init(struct device *dev) |
| 28 | { |
Yidi Lin | 27be904 | 2021-03-25 17:50:14 +0800 | [diff] [blame] | 29 | mtk_mmu_disable_l2c_sram(); |
Nina Wu | c25aa5b | 2021-06-21 09:13:19 +0800 | [diff] [blame] | 30 | dapc_init(); |
Flora Fu | 5cd1871 | 2021-06-25 23:27:56 +0800 | [diff] [blame] | 31 | apusys_init(); |
alex.miao | 4a2887f | 2021-05-17 21:58:55 +0800 | [diff] [blame] | 32 | mcupm_init(); |
Rex-BC Chen | ab2cbf7 | 2021-05-03 20:44:09 +0800 | [diff] [blame] | 33 | sspm_init(); |
Rex-BC Chen | 61be50d | 2021-08-10 12:39:32 +0800 | [diff] [blame] | 34 | |
| 35 | if (CONFIG(MTK_DFD)) |
| 36 | dfd_init(); |
| 37 | |
Yidi Lin | be8621d | 2021-04-19 16:06:55 +0800 | [diff] [blame] | 38 | ufs_disable_refclk(); |
Rex-BC Chen | 8316db2 | 2021-08-13 16:34:26 +0800 | [diff] [blame] | 39 | hdmi_low_power_setting(); |
Yidi Lin | 24ea3f3 | 2021-01-07 20:25:54 +0800 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | static struct device_operations soc_ops = { |
| 43 | .read_resources = soc_read_resources, |
| 44 | .init = soc_init, |
| 45 | }; |
| 46 | |
| 47 | static void enable_soc_dev(struct device *dev) |
| 48 | { |
| 49 | dev->ops = &soc_ops; |
| 50 | } |
| 51 | |
| 52 | struct chip_operations soc_mediatek_mt8195_ops = { |
| 53 | CHIP_NAME("SOC Mediatek MT8195") |
| 54 | .enable_dev = enable_soc_dev, |
| 55 | }; |