Angel Pons | e67ab18 | 2020-04-04 18:51:11 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Tristan Shieh | 0eb92df | 2018-06-08 18:21:45 +0800 | [diff] [blame] | 2 | |
| 3 | #include <device/device.h> |
Tristan Shieh | 9315a04 | 2018-08-06 13:57:50 +0800 | [diff] [blame] | 4 | #include <soc/emi.h> |
Yanjie Jiang | 64dea2e | 2019-05-07 10:31:07 +0800 | [diff] [blame] | 5 | #include <soc/md_ctrl.h> |
Tristan Shieh | 0eb92df | 2018-06-08 18:21:45 +0800 | [diff] [blame] | 6 | #include <soc/mmu_operations.h> |
Weiyi Lu | e78d140 | 2019-08-05 17:45:24 +0800 | [diff] [blame] | 7 | #include <soc/rtc.h> |
Erin Lo | bbeed7a | 2019-07-16 10:08:33 +0800 | [diff] [blame] | 8 | #include <soc/sspm.h> |
Tristan Shieh | 9315a04 | 2018-08-06 13:57:50 +0800 | [diff] [blame] | 9 | #include <symbols.h> |
| 10 | |
Tristan Shieh | 9315a04 | 2018-08-06 13:57:50 +0800 | [diff] [blame] | 11 | static void soc_read_resources(struct device *dev) |
| 12 | { |
| 13 | ram_resource(dev, 0, (uintptr_t)_dram / KiB, sdram_size() / KiB); |
| 14 | } |
Tristan Shieh | 0eb92df | 2018-06-08 18:21:45 +0800 | [diff] [blame] | 15 | |
| 16 | static void soc_init(struct device *dev) |
| 17 | { |
| 18 | mtk_mmu_disable_l2c_sram(); |
Yanjie Jiang | 64dea2e | 2019-05-07 10:31:07 +0800 | [diff] [blame] | 19 | mtk_md_early_init(); |
Weiyi Lu | e78d140 | 2019-08-05 17:45:24 +0800 | [diff] [blame] | 20 | mt6358_dcxo_disable_unused(); |
Erin Lo | bbeed7a | 2019-07-16 10:08:33 +0800 | [diff] [blame] | 21 | sspm_init(); |
Tristan Shieh | 0eb92df | 2018-06-08 18:21:45 +0800 | [diff] [blame] | 22 | } |
| 23 | |
| 24 | static struct device_operations soc_ops = { |
Tristan Shieh | 9315a04 | 2018-08-06 13:57:50 +0800 | [diff] [blame] | 25 | .read_resources = soc_read_resources, |
Tristan Shieh | 0eb92df | 2018-06-08 18:21:45 +0800 | [diff] [blame] | 26 | .init = soc_init, |
| 27 | }; |
| 28 | |
| 29 | static void enable_soc_dev(struct device *dev) |
| 30 | { |
| 31 | dev->ops = &soc_ops; |
| 32 | } |
| 33 | |
| 34 | struct chip_operations soc_mediatek_mt8183_ops = { |
| 35 | CHIP_NAME("SOC Mediatek MT8183") |
| 36 | .enable_dev = enable_soc_dev, |
| 37 | }; |