drivers/wifi: Remove unnecessary data structure copy
[coreboot2.git] / src / soc / mediatek / mt8188 / soc.c
blobf2911aec1044821681f5baa8d78afe9e1d5570e0
1 /* SPDX-License-Identifier: GPL-2.0-only OR MIT */
3 #include <bootmem.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <soc/cpu_input_gating.h>
7 #include <soc/devapc.h>
8 #include <soc/dfd.h>
9 #include <soc/dpm.h>
10 #include <soc/emi.h>
11 #include <soc/mcupm.h>
12 #include <soc/mmu_operations.h>
13 #include <soc/spm.h>
14 #include <soc/sspm.h>
15 #include <symbols.h>
17 #define OPTEE_ADDRESS 0x43000000
18 #define OPTEE_SIZE (70 * MiB)
20 void bootmem_platform_add_ranges(void)
22 if (CONFIG(MTK_DFD))
23 bootmem_add_range(DFD_DUMP_ADDRESS, DFD_DUMP_SIZE, BM_MEM_RESERVED);
24 if (CONFIG(ARM64_BL31_OPTEE_WITH_SMC))
25 bootmem_add_range(OPTEE_ADDRESS, OPTEE_SIZE, BM_MEM_RESERVED);
28 static void soc_read_resources(struct device *dev)
30 ram_range(dev, 0, (uintptr_t)_dram, sdram_size());
33 static void soc_init(struct device *dev)
35 mtk_mmu_disable_l2c_sram();
37 disable_cpu_input_gating();
39 dapc_init();
40 mcupm_init();
41 sspm_init();
43 if (dpm_init())
44 printk(BIOS_ERR, "dpm init failed, DVFS may not work\n");
47 * For MT8188, SPM will handshake with DPM to do initialization, so
48 * this must run after dpm_init().
50 if (spm_init())
51 printk(BIOS_ERR, "spm init failed, system suspend may not work\n");
53 if (CONFIG(MTK_DFD))
54 dfd_init();
57 static struct device_operations soc_ops = {
58 .read_resources = soc_read_resources,
59 .set_resources = noop_set_resources,
60 .init = soc_init,
63 static void enable_soc_dev(struct device *dev)
65 dev->ops = &soc_ops;
68 struct chip_operations soc_mediatek_mt8188_ops = {
69 .name = "SOC Mediatek MT8188",
70 .enable_dev = enable_soc_dev,