mb/google/fatcat/var/fatcat: Refactor GPIO programming for UFS support
[coreboot.git] / src / mainboard / google / brya / variants / yavilla / fw_config.c
blob0f08a43b83a3b87c89160a3a235c44ae8d0055cb
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <console/console.h>
6 #include <fw_config.h>
9 static const struct pad_config lte_disable_pads[] = {
10 /* A8 : WWAN_RF_DISABLE_ODL */
11 PAD_NC(GPP_A8, NONE),
12 /* D6 : WWAN_EN */
13 PAD_NC(GPP_D6, NONE),
14 /* F12 : WWAN_RST_L */
15 PAD_NC(GPP_F12, NONE),
16 /* H23 : WWAN_SAR_DETECT_ODL */
17 PAD_NC(GPP_H23, NONE),
20 static const struct pad_config wfc_disable_pads[] = {
21 /* D3 : WCAM_RST_L */
22 PAD_NC_LOCK(GPP_D3, NONE, LOCK_CONFIG),
23 /* D15 : EN_PP2800_WCAM_X */
24 PAD_NC_LOCK(GPP_D15, NONE, LOCK_CONFIG),
25 /* D16 : EN_PP1800_PP1200_WCAM_X */
26 PAD_NC_LOCK(GPP_D16, NONE, LOCK_CONFIG),
27 /* H22 : WCAM_MCLK_R */
28 PAD_NC(GPP_H22, NONE),
29 /* R6 : DMIC_WCAM_CLK_R */
30 PAD_NC(GPP_R6, NONE),
31 /* R7 : DMIC_WCAM_DATA */
32 PAD_NC(GPP_R7, NONE),
35 static const struct pad_config emmc_disable_pads[] = {
36 /* I7 : EMMC_CMD */
37 PAD_NC(GPP_I7, NONE),
38 /* I8 : EMMC_D0 */
39 PAD_NC(GPP_I8, NONE),
40 /* I9 : EMMC_D1 */
41 PAD_NC(GPP_I9, NONE),
42 /* I10 : EMMC_D2 */
43 PAD_NC(GPP_I10, NONE),
44 /* I11 : EMMC_D3 */
45 PAD_NC(GPP_I11, NONE),
46 /* I12 : EMMC_D4 */
47 PAD_NC(GPP_I12, NONE),
48 /* I13 : EMMC_D5 */
49 PAD_NC(GPP_I13, NONE),
50 /* I14 : EMMC_D6 */
51 PAD_NC(GPP_I14, NONE),
52 /* I15 : EMMC_D7 */
53 PAD_NC(GPP_I15, NONE),
54 /* I16 : EMMC_RCLK */
55 PAD_NC(GPP_I16, NONE),
56 /* I17 : EMMC_CLK */
57 PAD_NC(GPP_I17, NONE),
58 /* I18 : EMMC_RST_L */
59 PAD_NC(GPP_I18, NONE),
62 static const struct pad_config stylus_disable_pads[] = {
63 /* F13 : SOC_PEN_DETECT_R_ODL */
64 PAD_NC_LOCK(GPP_F13, NONE, LOCK_CONFIG),
65 /* F15 : SOC_PEN_DETECT_ODL */
66 PAD_NC_LOCK(GPP_F15, NONE, LOCK_CONFIG),
69 static const struct pad_config disable_wifi_pch_susclk[] = {
70 /* GPD8 ==> NC */
71 PAD_NC(GPD8, NONE),
74 void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
76 if (!fw_config_probe(FW_CONFIG(DB_USB, DB_1C_LTE))) {
77 printk(BIOS_INFO, "Disable LTE-related GPIO pins.\n");
78 gpio_padbased_override(padbased_table, lte_disable_pads,
79 ARRAY_SIZE(lte_disable_pads));
81 if (fw_config_probe(FW_CONFIG(WFC, WFC_ABSENT))) {
82 printk(BIOS_INFO, "Disable MIPI WFC GPIO pins.\n");
83 gpio_padbased_override(padbased_table, wfc_disable_pads,
84 ARRAY_SIZE(wfc_disable_pads));
86 if (fw_config_is_provisioned() && !fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) {
87 printk(BIOS_INFO, "Disable eMMC GPIO pins.\n");
88 gpio_padbased_override(padbased_table, emmc_disable_pads,
89 ARRAY_SIZE(emmc_disable_pads));
91 if (fw_config_probe(FW_CONFIG(STYLUS, STYLUS_ABSENT))) {
92 printk(BIOS_INFO, "Disable Stylus GPIO pins.\n");
93 gpio_padbased_override(padbased_table, stylus_disable_pads,
94 ARRAY_SIZE(stylus_disable_pads));
96 if (fw_config_probe(FW_CONFIG(WIFI_SAR_ID, SAR_ID_3))) {
97 printk(BIOS_INFO, "Disable PCH SUSCLK.\n");
98 gpio_padbased_override(padbased_table, disable_wifi_pch_susclk,
99 ARRAY_SIZE(disable_wifi_pch_susclk));