cpu/x86/smm/pci_resource_store: Store DEV/VEN ID
[coreboot2.git] / src / mainboard / google / corsola / mainboard.c
bloba1ba5f9356b46b4fe3dacb22d6954a3a00a12e14
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootmode.h>
4 #include <console/console.h>
5 #include <device/device.h>
6 #include <fw_config.h>
7 #include <gpio.h>
8 #include <soc/bl31.h>
9 #include <soc/display.h>
10 #include <soc/i2c.h>
11 #include <soc/msdc.h>
12 #include <soc/spm.h>
13 #include <soc/usb.h>
15 #include "gpio.h"
16 #include "panel.h"
18 static void configure_alc1019(void)
20 mtcmos_audio_power_on();
22 /* Set up I2S */
23 gpio_set_mode(GPIO(I2S2_MCK), PAD_I2S2_MCK_FUNC_I2S2_MCK);
24 gpio_set_mode(GPIO(I2S2_BCK), PAD_I2S2_BCK_FUNC_I2S2_BCK);
25 gpio_set_mode(GPIO(I2S2_LRCK), PAD_I2S2_LRCK_FUNC_I2S2_LRCK);
26 gpio_set_mode(GPIO(EINT4), PAD_EINT4_FUNC_I2S3_DO);
29 static void configure_alc5645(void)
31 mtcmos_audio_power_on();
33 /* Set up I2S */
34 gpio_set_mode(GPIO(I2S1_MCK), PAD_I2S1_MCK_FUNC_I2S1_MCK);
35 gpio_set_mode(GPIO(I2S1_BCK), PAD_I2S1_BCK_FUNC_I2S1_BCK);
36 gpio_set_mode(GPIO(I2S1_LRCK), PAD_I2S1_LRCK_FUNC_I2S1_LRCK);
37 gpio_set_mode(GPIO(I2S1_DO), PAD_I2S1_DO_FUNC_I2S1_DO);
39 /* Init I2C bus timing register for audio codecs */
40 mtk_i2c_bus_init(I2C5, I2C_SPEED_STANDARD);
43 static void mainboard_init(struct device *dev)
45 mtk_msdc_configure_emmc(true);
47 if (CONFIG(CORSOLA_SDCARD_INIT)) {
48 printk(BIOS_INFO, "SD card init\n");
50 /* External SD Card connected via USB */
51 gpio_output(GPIO_EN_PP3300_SDBRDG_X, 1);
54 setup_usb_host();
56 if (!fw_config_is_provisioned() ||
57 fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_ALC1019)))
58 configure_alc1019();
59 else if (fw_config_probe(FW_CONFIG(AUDIO_AMP, AMP_ALC5645)))
60 configure_alc5645();
62 if (spm_init())
63 printk(BIOS_ERR, "spm init failed, system suspend may not work\n");
65 if (CONFIG(ARM64_USE_ARM_TRUSTED_FIRMWARE))
66 register_reset_to_bl31(GPIO_RESET.id, true);
68 if (display_init_required()) {
69 if (mtk_display_init() < 0)
70 printk(BIOS_ERR, "%s: Failed to init display\n", __func__);
71 } else {
72 if (CONFIG(BOARD_GOOGLE_STARYU_COMMON)) {
73 mtk_i2c_bus_init(PMIC_I2C_BUS, I2C_SPEED_FAST);
74 if (is_pmic_aw37503(PMIC_I2C_BUS)) {
75 printk(BIOS_DEBUG, "Initialize PMIC AW37503\n");
76 aw37503_init(PMIC_I2C_BUS);
79 printk(BIOS_INFO, "%s: Skipped display init\n", __func__);
83 static void mainboard_enable(struct device *dev)
85 dev->ops->init = &mainboard_init;
88 struct chip_operations mainboard_ops = {
89 .enable_dev = mainboard_enable,