1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <console/console.h>
8 static const struct pad_config lte_disable_pads_yavilla
[] = {
9 /* A8 : WWAN_RF_DISABLE_ODL */
13 /* F12 : WWAN_RST_L */
14 PAD_NC(GPP_F12
, NONE
),
15 /* H23 : WWAN_SAR_DETECT_ODL */
16 PAD_NC(GPP_H23
, NONE
),
19 static const struct pad_config emmc_disable_pads
[] = {
27 PAD_NC(GPP_I10
, NONE
),
29 PAD_NC(GPP_I11
, NONE
),
31 PAD_NC(GPP_I12
, NONE
),
33 PAD_NC(GPP_I13
, NONE
),
35 PAD_NC(GPP_I14
, NONE
),
37 PAD_NC(GPP_I15
, NONE
),
39 PAD_NC(GPP_I16
, NONE
),
41 PAD_NC(GPP_I17
, NONE
),
42 /* I18 : EMMC_RST_L */
43 PAD_NC(GPP_I18
, NONE
),
46 static const struct pad_config stylus_disable_pads
[] = {
47 /* F13 : SOC_PEN_DETECT_R_ODL */
48 PAD_NC_LOCK(GPP_F13
, NONE
, LOCK_CONFIG
),
49 /* F15 : SOC_PEN_DETECT_ODL */
50 PAD_NC_LOCK(GPP_F15
, NONE
, LOCK_CONFIG
),
53 static const struct pad_config sd_disable_pads
[] = {
54 /* D8 : SD_CLKREQ_ODL */
57 PAD_NC_LOCK(GPP_D17
, NONE
, LOCK_CONFIG
),
58 /* H12 : SD_PERST_L */
59 PAD_NC_LOCK(GPP_H12
, NONE
, LOCK_CONFIG
),
60 /* H13 : EN_PP3300_SD_X */
61 PAD_NC_LOCK(GPP_H13
, NONE
, LOCK_CONFIG
),
64 static const struct pad_config disable_wifi_pch_susclk
[] = {
69 static const struct pad_config disable_usbc1_pins
[] = {
70 /* GPP_A21: USB_C1_AUX_DC_P => NC */
71 PAD_NC(GPP_A21
, NONE
),
72 /* GPP_A22: USB_C1_AUX_DC_N => NC */
73 PAD_NC(GPP_A22
, NONE
),
76 void fw_config_gpio_padbased_override(struct pad_config
*padbased_table
)
78 if (fw_config_is_provisioned() && !fw_config_probe(FW_CONFIG(STORAGE
, STORAGE_EMMC
))) {
79 printk(BIOS_INFO
, "Disable eMMC GPIO pins.\n");
80 gpio_padbased_override(padbased_table
, emmc_disable_pads
,
81 ARRAY_SIZE(emmc_disable_pads
));
83 if (fw_config_is_provisioned() && fw_config_probe(FW_CONFIG(DB_USB
, DB_1A
))) {
84 printk(BIOS_INFO
, "Disable USBC1 AUX Pins.\n");
85 gpio_padbased_override(padbased_table
, disable_usbc1_pins
,
86 ARRAY_SIZE(disable_usbc1_pins
));
88 if (!fw_config_probe(FW_CONFIG(DB_USB
, DB_1C_LTE
))) {
89 printk(BIOS_INFO
, "Disable LTE-related GPIO pins on yavilla.\n");
90 gpio_padbased_override(padbased_table
, lte_disable_pads_yavilla
,
91 ARRAY_SIZE(lte_disable_pads_yavilla
));
93 if (fw_config_probe(FW_CONFIG(STYLUS
, STYLUS_ABSENT
))) {
94 printk(BIOS_INFO
, "Disable Stylus GPIO pins.\n");
95 gpio_padbased_override(padbased_table
, stylus_disable_pads
,
96 ARRAY_SIZE(stylus_disable_pads
));
98 if (fw_config_probe(FW_CONFIG(SD_CARD
, SD_ABSENT
))) {
99 printk(BIOS_INFO
, "Disable SD card GPIO pins.\n");
100 gpio_padbased_override(padbased_table
, sd_disable_pads
,
101 ARRAY_SIZE(sd_disable_pads
));
103 /* SAR_ID_3 for MT7922 */
104 if (fw_config_probe(FW_CONFIG(WIFI_SAR_ID
, SAR_ID_3
))) {
105 printk(BIOS_INFO
, "Disable PCH SUSCLK.\n");
106 gpio_padbased_override(padbased_table
, disable_wifi_pch_susclk
,
107 ARRAY_SIZE(disable_wifi_pch_susclk
));