mb/google/fatcat/var/fatcat: Refactor GPIO programming for UFS support
[coreboot.git] / src / mainboard / google / brya / variants / riven / fw_config.c
blobba5460b604272fca407f6c8145ab442c5cbe080a
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>
8 static const struct pad_config lte_disable_pads[] = {
9 /* A8 : WWAN_RF_DISABLE_ODL */
10 PAD_NC(GPP_A8, NONE),
11 /* D6 : WWAN_EN */
12 PAD_NC(GPP_D6, NONE),
13 /* F12 : WWAN_RST_L */
14 PAD_NC_LOCK(GPP_F12, NONE, LOCK_CONFIG),
15 /* H23 : WWAN_SAR_DETECT_ODL */
16 PAD_NC(GPP_H23, NONE),
19 static const struct pad_config wfc_disable_pads[] = {
20 /* D3 : WCAM_RST_L */
21 PAD_NC_LOCK(GPP_D3, NONE, LOCK_CONFIG),
22 /* D15 : EN_PP2800_WCAM_X */
23 PAD_NC_LOCK(GPP_D15, NONE, LOCK_CONFIG),
24 /* D16 : EN_PP1800_PP1200_WCAM_X */
25 PAD_NC_LOCK(GPP_D16, NONE, LOCK_CONFIG),
26 /* H22 : WCAM_MCLK_R */
27 PAD_NC(GPP_H22, NONE),
30 static const struct pad_config stylus_disable_pads[] = {
31 /* F13 : SOC_PEN_DETECT_R_ODL */
32 PAD_NC_LOCK(GPP_F13, NONE, LOCK_CONFIG),
33 /* F15 : SOC_PEN_DETECT_ODL */
34 PAD_NC_LOCK(GPP_F15, NONE, LOCK_CONFIG),
37 static const struct pad_config emmc_disable_pads[] = {
38 /* I7 : EMMC_CMD */
39 PAD_NC(GPP_I7, NONE),
40 /* I8 : EMMC_D0 */
41 PAD_NC(GPP_I8, NONE),
42 /* I9 : EMMC_D1 */
43 PAD_NC(GPP_I9, NONE),
44 /* I10 : EMMC_D2 */
45 PAD_NC(GPP_I10, NONE),
46 /* I11 : EMMC_D3 */
47 PAD_NC(GPP_I11, NONE),
48 /* I12 : EMMC_D4 */
49 PAD_NC(GPP_I12, NONE),
50 /* I13 : EMMC_D5 */
51 PAD_NC(GPP_I13, NONE),
52 /* I14 : EMMC_D6 */
53 PAD_NC(GPP_I14, NONE),
54 /* I15 : EMMC_D7 */
55 PAD_NC(GPP_I15, NONE),
56 /* I16 : EMMC_RCLK */
57 PAD_NC(GPP_I16, NONE),
58 /* I17 : EMMC_CLK */
59 PAD_NC(GPP_I17, NONE),
60 /* I18 : EMMC_RST_L */
61 PAD_NC(GPP_I18, NONE),
64 void fw_config_gpio_padbased_override(struct pad_config *padbased_table)
66 if (!fw_config_is_provisioned()) {
67 printk(BIOS_WARNING, "FW_CONFIG is not provisioned. Exiting...\n");
68 return;
71 if (!fw_config_probe(FW_CONFIG(DB_USB, DB_1C_LTE))) {
72 printk(BIOS_INFO, "Disable LTE-related GPIO pins on Riven.\n");
73 gpio_padbased_override(padbased_table, lte_disable_pads,
74 ARRAY_SIZE(lte_disable_pads));
77 if (fw_config_probe(FW_CONFIG(WFC, WFC_ABSENT))) {
78 printk(BIOS_INFO, "Disable MIPI WFC GPIO pins.\n");
79 gpio_padbased_override(padbased_table, wfc_disable_pads,
80 ARRAY_SIZE(wfc_disable_pads));
83 if (fw_config_probe(FW_CONFIG(STYLUS, STYLUS_ABSENT))) {
84 printk(BIOS_INFO, "Disable Stylus GPIO pins.\n");
85 gpio_padbased_override(padbased_table, stylus_disable_pads,
86 ARRAY_SIZE(stylus_disable_pads));
89 if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_UNKNOWN))) {
90 if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_EMMC))) {
91 printk(BIOS_INFO, "Disable eMMC GPIO pins.\n");
92 gpio_padbased_override(padbased_table, emmc_disable_pads,
93 ARRAY_SIZE(emmc_disable_pads));