soc/mediatek/mt8196: Initialize SSPM
[coreboot2.git] / src / mainboard / google / dedede / variants / cret / gpio.c
blob8cff3656eff1a677f224982e80f23dcd07ab43c9
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <bootstate.h>
6 #include <fw_config.h>
8 /* Pad configuration in ramstage */
9 static const struct pad_config override_gpio_table[] = {
10 /* A10 : WWAN_EN */
11 PAD_CFG_GPO(GPP_A10, 1, PWROK),
12 /* C12 : AP_PEN_DET_ODL ==> NC */
13 PAD_NC(GPP_C12, UP_20K),
14 /* C18 : AP_I2C_EMR_SDA */
15 PAD_NC(GPP_C18, NONE),
16 /* C19 : AP_I2C_EMR_SCL */
17 PAD_NC(GPP_C19, NONE),
18 /* C22 : UART2_RTS_N ==> NC */
19 PAD_NC(GPP_C22, UP_20K),
20 /* D0 : WWAN_HOST_WAKE ==> WWAN_WDISABLE_L */
21 PAD_CFG_GPO(GPP_D0, 1, DEEP),
22 /* D12 : WCAM_RST_L ==> NC */
23 PAD_NC(GPP_D12, NONE),
24 /* D14 : EN_PP1200_CAMERA ==> NC */
25 PAD_NC(GPP_D14, NONE),
26 /* D15 : UCAM_RST_L ==> NC */
27 PAD_NC(GPP_D15, NONE),
28 /* D19 : WWAN_WLAN_COEX1 ==> NC */
29 PAD_NC(GPP_D19, NONE),
30 /* D20 : WWAN_WLAN_COEX2 ==> NC */
31 PAD_NC(GPP_D20, NONE),
32 /* D21 : WWAN_WLAN_COEX3 ==> NC */
33 PAD_NC(GPP_D21, NONE),
34 /* E0 : CLK_24M_UCAM ==> NC */
35 PAD_NC(GPP_E0, NONE),
36 /* E2 : CLK_24M_WCAM ==> NC */
37 PAD_NC(GPP_E2, NONE),
38 /* H1 : EN_PP3300_SD_U ==> NC */
39 PAD_NC(GPP_H1, NONE),
40 /* H6 : AP_I2C_CAM_SDA ==> NC */
41 PAD_NC(GPP_H6, NONE),
42 /* H7 : AP_I2C_CAM_SCL ==> NC */
43 PAD_NC(GPP_H7, NONE),
44 /* H16 : AP_SUB_IO_L ==> HP_RST_ODL */
45 PAD_CFG_GPO(GPP_H16, 1, PWROK),
46 /* H17 : WWAN_RST_L */
47 PAD_CFG_GPO(GPP_H17, 1, PLTRST),
48 /* G0 : SD_CMD ==> NC */
49 PAD_NC(GPP_G0, NONE),
50 /* G1 : SD_DATA0 ==> NC */
51 PAD_NC(GPP_G1, NONE),
52 /* G2 : SD_DATA1 ==> NC */
53 PAD_NC(GPP_G2, NONE),
54 /* G3 : SD_DATA2 ==> NC */
55 PAD_NC(GPP_G3, NONE),
56 /* G4 : SD_DATA3 ==> NC */
57 PAD_NC(GPP_G4, NONE),
58 /* G5 : SD_CD_ODL ==> NC */
59 PAD_NC(GPP_G5, UP_20K),
60 /* G6 : SD_CLK ==> NC */
61 PAD_NC(GPP_G6, NONE),
62 /* G7 : SD_SDIO_WP ==> NC */
63 PAD_NC(GPP_G7, NONE),
66 static const struct pad_config lte_disable_pads[] = {
67 PAD_NC(GPP_A10, NONE),
68 PAD_NC(GPP_D0, NONE),
69 PAD_NC(GPP_H17, NONE),
72 static const struct pad_config codec_da7219_pads[] = {
73 PAD_NC(GPP_H16, NONE),
76 static const struct pad_config codec_cs42l42_pads[] = {
77 PAD_NC(GPP_D18, NONE),
80 const struct pad_config *variant_override_gpio_table(size_t *num)
82 *num = ARRAY_SIZE(override_gpio_table);
83 return override_gpio_table;
86 static void fw_config_handle(void *unused)
88 if (!fw_config_probe(FW_CONFIG(LTE, LTE_PRESENT)))
89 gpio_configure_pads(lte_disable_pads, ARRAY_SIZE(lte_disable_pads));
90 if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE, AUDIO_CODEC_DA7219)))
91 gpio_configure_pads(codec_da7219_pads, ARRAY_SIZE(codec_da7219_pads));
92 if (fw_config_probe(FW_CONFIG(AUDIO_CODEC_SOURCE, AUDIO_CODEC_CS42l42)))
93 gpio_configure_pads(codec_cs42l42_pads, ARRAY_SIZE(codec_cs42l42_pads));
95 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);