mb/google/nissa/var/rull: add ssd timing and modify ssd GPIO pins of rtd3
[coreboot2.git] / src / mainboard / google / volteer / fw_config.c
blob1025119658dc981ca6f51088b70badfa5245beee
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootstate.h>
4 #include <console/console.h>
5 #include <fw_config.h>
6 #include <gpio.h>
8 static const struct pad_config dmic_enable_pads[] = {
9 PAD_CFG_NF(GPP_S4, NONE, DEEP, NF2), /* DMIC_CLK1 */
10 PAD_CFG_NF(GPP_S5, NONE, DEEP, NF2), /* DMIC_DATA1 */
11 PAD_CFG_NF(GPP_S6, NONE, DEEP, NF2), /* DMIC_CLK0 */
12 PAD_CFG_NF(GPP_S7, NONE, DEEP, NF2), /* DMIC_DATA0 */
15 static const struct pad_config dmic_disable_pads[] = {
16 PAD_NC(GPP_S4, NONE),
17 PAD_NC(GPP_S5, NONE),
18 PAD_NC(GPP_S6, NONE),
19 PAD_NC(GPP_S7, NONE),
22 static const struct pad_config sndw_enable_pads[] = {
23 PAD_CFG_NF(GPP_S0, NONE, DEEP, NF1), /* SNDW0_CLK */
24 PAD_CFG_NF(GPP_S1, NONE, DEEP, NF1), /* SNDW0_DATA */
25 PAD_CFG_NF(GPP_S2, NONE, DEEP, NF1), /* SNDW1_CLK */
26 PAD_CFG_NF(GPP_S3, NONE, DEEP, NF1), /* SNDW1_DATA */
29 static const struct pad_config sndw_disable_pads[] = {
30 PAD_NC(GPP_S0, NONE),
31 PAD_NC(GPP_S1, NONE),
32 PAD_NC(GPP_S2, NONE),
33 PAD_NC(GPP_S3, NONE),
36 static const struct pad_config i2s_up3_enable_pads[] = {
37 PAD_CFG_NF(GPP_A23, NONE, DEEP, NF1), /* I2S1_SCLK */
38 PAD_CFG_NF(GPP_D19, NONE, DEEP, NF1), /* I2S_MCLK1 */
39 PAD_CFG_NF(GPP_R0, NONE, DEEP, NF2), /* I2S0_SCLK */
40 PAD_CFG_NF(GPP_R1, NONE, DEEP, NF2), /* I2S0_SFRM */
41 PAD_CFG_NF(GPP_R2, DN_20K, DEEP, NF2), /* I2S0_TXD */
42 PAD_CFG_NF(GPP_R3, NONE, DEEP, NF2), /* I2S0_RXD */
43 PAD_CFG_NF(GPP_R5, NONE, DEEP, NF2), /* I2S1_RXD */
44 PAD_CFG_NF(GPP_R6, NONE, DEEP, NF2), /* I2S1_TXD */
45 PAD_CFG_NF(GPP_R7, NONE, DEEP, NF2), /* I2S1_SFRM */
48 static const struct pad_config i2s_up4_enable_pads[] = {
49 PAD_CFG_NF(GPP_A7, NONE, DEEP, NF1), /* I2S2_SCLK */
50 PAD_CFG_NF(GPP_D19, NONE, DEEP, NF1), /* I2S_MCLK1 */
51 PAD_CFG_NF(GPP_R0, NONE, DEEP, NF2), /* I2S0_SCLK */
52 PAD_CFG_NF(GPP_R1, NONE, DEEP, NF2), /* I2S0_SFRM */
53 PAD_CFG_NF(GPP_R2, DN_20K, DEEP, NF2), /* I2S0_TXD */
54 PAD_CFG_NF(GPP_R3, NONE, DEEP, NF2), /* I2S0_RXD */
57 static const struct pad_config i2s_disable_pads[] = {
58 PAD_NC(GPP_A23, NONE),
59 PAD_NC(GPP_D19, NONE),
60 PAD_NC(GPP_R0, NONE),
61 PAD_NC(GPP_R1, NONE),
62 PAD_NC(GPP_R2, DN_20K),
63 PAD_NC(GPP_R3, NONE),
64 PAD_NC(GPP_R5, NONE),
65 PAD_NC(GPP_R6, NONE),
66 PAD_NC(GPP_R7, NONE),
69 static const struct pad_config sd_power_enable_pads[] = {
70 PAD_CFG_GPO(GPP_D16, 1, DEEP),
73 static void fw_config_handle(void *unused)
75 if (!fw_config_is_provisioned()) {
76 gpio_configure_pads(i2s_disable_pads, ARRAY_SIZE(i2s_disable_pads));
77 gpio_configure_pads(dmic_disable_pads, ARRAY_SIZE(dmic_disable_pads));
78 gpio_configure_pads(sndw_disable_pads, ARRAY_SIZE(sndw_disable_pads));
79 return;
82 if (fw_config_probe(FW_CONFIG(AUDIO, NONE))) {
83 printk(BIOS_INFO, "Configure GPIOs for no audio.\n");
84 gpio_configure_pads(i2s_disable_pads, ARRAY_SIZE(i2s_disable_pads));
85 gpio_configure_pads(dmic_disable_pads, ARRAY_SIZE(dmic_disable_pads));
86 gpio_configure_pads(sndw_disable_pads, ARRAY_SIZE(sndw_disable_pads));
88 if (fw_config_probe(FW_CONFIG(AUDIO, MAX98373_ALC5682_SNDW))) {
89 printk(BIOS_INFO, "Configure GPIOs for SoundWire audio.\n");
90 gpio_configure_pads(sndw_enable_pads, ARRAY_SIZE(sndw_enable_pads));
91 gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads));
92 gpio_configure_pads(i2s_disable_pads, ARRAY_SIZE(i2s_disable_pads));
94 if (fw_config_probe(FW_CONFIG(AUDIO, MAX98357_ALC5682I_I2S)) ||
95 fw_config_probe(FW_CONFIG(AUDIO, MAX98373_ALC5682I_I2S)) ||
96 fw_config_probe(FW_CONFIG(AUDIO, MAX98360_ALC5682I_I2S)) ||
97 fw_config_probe(FW_CONFIG(AUDIO, RT1011_ALC5682I_I2S))) {
98 printk(BIOS_INFO, "Configure GPIOs for I2S audio on UP3.\n");
99 gpio_configure_pads(i2s_up3_enable_pads, ARRAY_SIZE(i2s_up3_enable_pads));
100 gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads));
101 gpio_configure_pads(sndw_disable_pads, ARRAY_SIZE(sndw_disable_pads));
103 if (fw_config_probe(FW_CONFIG(AUDIO, MAX98373_ALC5682I_I2S_UP4))) {
104 printk(BIOS_INFO, "Configure GPIOs for I2S audio on UP4.\n");
105 gpio_configure_pads(i2s_up4_enable_pads, ARRAY_SIZE(i2s_up4_enable_pads));
106 gpio_configure_pads(dmic_enable_pads, ARRAY_SIZE(dmic_enable_pads));
107 gpio_configure_pads(sndw_disable_pads, ARRAY_SIZE(sndw_disable_pads));
109 if (fw_config_probe(FW_CONFIG(DB_SD, SD_GL9755S)) ||
110 fw_config_probe(FW_CONFIG(DB_SD, SD_RTS5227S)) ||
111 fw_config_probe(FW_CONFIG(DB_SD, SD_GL9750)) ||
112 fw_config_probe(FW_CONFIG(DB_SD, SD_OZ711LV2LN))) {
113 printk(BIOS_INFO, "Configure GPIOs for SD power enable.\n");
114 gpio_configure_pads(sd_power_enable_pads, ARRAY_SIZE(sd_power_enable_pads));
117 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);