Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Bo-Chen Chen | c1345d6 | 2022-09-29 17:32:02 +0800 | [diff] [blame] | 3 | #include <bootmode.h> |
Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 4 | #include <device/device.h> |
Bo-Chen Chen | bc18fb3 | 2022-09-06 14:41:57 +0800 | [diff] [blame] | 5 | #include <soc/bl31.h> |
Andy-ld Lu | 05c48ec | 2022-07-15 15:55:29 +0800 | [diff] [blame] | 6 | #include <soc/msdc.h> |
Shaocheng Wang | 1ad10ee | 2022-07-05 15:42:21 +0800 | [diff] [blame] | 7 | #include <soc/usb.h> |
Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 8 | |
Bo-Chen Chen | c1345d6 | 2022-09-29 17:32:02 +0800 | [diff] [blame] | 9 | #include "display.h" |
Bo-Chen Chen | bc18fb3 | 2022-09-06 14:41:57 +0800 | [diff] [blame] | 10 | #include "gpio.h" |
| 11 | |
Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 12 | static void mainboard_init(struct device *dev) |
| 13 | { |
Bo-Chen Chen | c1345d6 | 2022-09-29 17:32:02 +0800 | [diff] [blame] | 14 | if (display_init_required()) { |
| 15 | if (configure_display() < 0) |
| 16 | printk(BIOS_ERR, "%s: Failed to init display\n", __func__); |
| 17 | } else { |
| 18 | printk(BIOS_INFO, "%s: Skipped display initialization\n", __func__); |
| 19 | } |
| 20 | |
Andy-ld Lu | 05c48ec | 2022-07-15 15:55:29 +0800 | [diff] [blame] | 21 | mtk_msdc_configure_emmc(true); |
Liju-Clr Chen | aa9bb44 | 2022-12-20 15:52:50 +0800 | [diff] [blame^] | 22 | |
| 23 | if (CONFIG(SDCARD_INIT)) |
| 24 | mtk_msdc_configure_sdcard(); |
| 25 | |
Shaocheng Wang | 1ad10ee | 2022-07-05 15:42:21 +0800 | [diff] [blame] | 26 | setup_usb_host(); |
Bo-Chen Chen | bc18fb3 | 2022-09-06 14:41:57 +0800 | [diff] [blame] | 27 | |
| 28 | if (CONFIG(ARM64_USE_ARM_TRUSTED_FIRMWARE)) |
| 29 | register_reset_to_bl31(GPIO_AP_EC_WARM_RST_REQ.id, true); |
Rex-BC Chen | db8442b | 2022-07-01 17:37:37 +0800 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | static void mainboard_enable(struct device *dev) |
| 33 | { |
| 34 | dev->ops->init = &mainboard_init; |
| 35 | } |
| 36 | |
| 37 | struct chip_operations mainboard_ops = { |
| 38 | .name = CONFIG_MAINBOARD_PART_NUMBER, |
| 39 | .enable_dev = mainboard_enable, |
| 40 | }; |