1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <console/console.h>
9 static const struct pad_config lte_disable_pads
[] = {
10 /* A8 : WWAN_RF_DISABLE_ODL */
12 /* B5 : I2C_P_SENSOR_SDA */
14 /* B6 : I2C_P_SENSOR_SCL */
18 /* F12 : WWAN_RST_L */
19 PAD_NC(GPP_F12
, NONE
),
20 /* H19 : P_SENSOR_INT_L */
21 PAD_NC(GPP_H19
, NONE
),
22 /* H23 : WWAN_SAR_DETECT_ODL */
23 PAD_NC(GPP_H23
, NONE
),
26 static const struct pad_config emmc_disable_pads
[] = {
34 PAD_NC(GPP_I10
, NONE
),
36 PAD_NC(GPP_I11
, NONE
),
38 PAD_NC(GPP_I12
, NONE
),
40 PAD_NC(GPP_I13
, NONE
),
42 PAD_NC(GPP_I14
, NONE
),
44 PAD_NC(GPP_I15
, NONE
),
46 PAD_NC(GPP_I16
, NONE
),
48 PAD_NC(GPP_I17
, NONE
),
49 /* I18 : EMMC_RST_L */
50 PAD_NC(GPP_I18
, NONE
),
53 static const struct pad_config stylus_disable_pads
[] = {
54 /* F13 : SOC_PEN_DETECT_R_ODL */
55 PAD_NC_LOCK(GPP_F13
, NONE
, LOCK_CONFIG
),
56 /* F15 : SOC_PEN_DETECT_ODL */
57 PAD_NC_LOCK(GPP_F15
, NONE
, LOCK_CONFIG
),
60 static const struct pad_config sd_disable_pads
[] = {
61 /* D8 : SD_CLKREQ_ODL */
64 PAD_NC_LOCK(GPP_D17
, NONE
, LOCK_CONFIG
),
65 /* H12 : SD_PERST_L */
66 PAD_NC_LOCK(GPP_H12
, NONE
, LOCK_CONFIG
),
67 /* H13 : EN_PP3300_SD_X */
68 PAD_NC_LOCK(GPP_H13
, NONE
, LOCK_CONFIG
),
71 static const struct pad_config disable_wifi_pch_susclk
[] = {
76 void fw_config_gpio_padbased_override(struct pad_config
*padbased_table
)
78 if (!fw_config_probe(FW_CONFIG(DB_USB
, DB_1C_LTE
)) &&
79 !fw_config_probe(FW_CONFIG(DB_USB
, DB_LTE
))) {
80 printk(BIOS_INFO
, "Disable LTE-related GPIO pins.\n");
81 gpio_padbased_override(padbased_table
, lte_disable_pads
,
82 ARRAY_SIZE(lte_disable_pads
));
84 if (fw_config_is_provisioned() && !fw_config_probe(FW_CONFIG(STORAGE
, STORAGE_EMMC
))) {
85 printk(BIOS_INFO
, "Disable eMMC GPIO pins.\n");
86 gpio_padbased_override(padbased_table
, emmc_disable_pads
,
87 ARRAY_SIZE(emmc_disable_pads
));
89 if (fw_config_probe(FW_CONFIG(STYLUS
, STYLUS_ABSENT
))) {
90 printk(BIOS_INFO
, "Disable Stylus GPIO pins.\n");
91 gpio_padbased_override(padbased_table
, stylus_disable_pads
,
92 ARRAY_SIZE(stylus_disable_pads
));
94 if (fw_config_probe(FW_CONFIG(SD_CARD
, SD_ABSENT
))) {
95 printk(BIOS_INFO
, "Disable SD card GPIO pins.\n");
96 gpio_padbased_override(padbased_table
, sd_disable_pads
,
97 ARRAY_SIZE(sd_disable_pads
));
99 if (fw_config_probe(FW_CONFIG(WIFI_SAR_ID
, SAR_ID_3
))) {
100 printk(BIOS_INFO
, "Disable PCH SUSCLK.\n");
101 gpio_padbased_override(padbased_table
, disable_wifi_pch_susclk
,
102 ARRAY_SIZE(disable_wifi_pch_susclk
));