blob: d899750009709b4d1a2a0d16f223e0aae51a2db6 [file] [log] [blame]
Reka Norman457d98d2022-02-04 11:17:32 +11001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#include <baseboard/gpio.h>
4#include <bootstate.h>
5#include <console/console.h>
6#include <fw_config.h>
7
8static 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(GPP_F12, NONE),
15 /* H19 : SOC_I2C_SUB_INT_ODL */
16 PAD_NC(GPP_H19, NONE),
17 /* H23 : WWAN_SAR_DETECT_ODL */
18 PAD_NC(GPP_H23, NONE),
19};
20
Reka Normanbaf22462022-05-06 19:55:11 +100021static const struct pad_config sd_disable_pads[] = {
22 /* D8 : SD_CLKREQ_ODL */
23 PAD_NC(GPP_D8, NONE),
24 /* H12 : SD_PERST_L */
25 PAD_NC(GPP_H12, NONE),
26 /* H13 : EN_PP3300_SD_X */
27 PAD_NC(GPP_H13, NONE),
28};
29
Reka Normanf1b8cee2022-05-06 20:04:54 +100030static const struct pad_config wfc_disable_pads[] = {
31 /* D3 : WCAM_RST_L */
32 PAD_NC(GPP_D3, NONE),
33 /* D15 : EN_PP2800_WCAM_X */
34 PAD_NC(GPP_D15, NONE),
35 /* D16 : EN_PP1800_PP1200_WCAM_X */
36 PAD_NC(GPP_D16, NONE),
37 /* H22 : WCAM_MCLK_R */
38 PAD_NC(GPP_H22, NONE),
39 /* R6 : DMIC_WCAM_CLK_R */
40 PAD_NC(GPP_R6, NONE),
41 /* R7 : DMIC_WCAM_DATA */
42 PAD_NC(GPP_R7, NONE),
43};
44
Reka Norman457d98d2022-02-04 11:17:32 +110045static void fw_config_handle(void *unused)
46{
47 if (!fw_config_probe(FW_CONFIG(DB_USB, DB_1C_LTE))) {
48 printk(BIOS_INFO, "Disable LTE-related GPIO pins.\n");
49 gpio_configure_pads(lte_disable_pads, ARRAY_SIZE(lte_disable_pads));
50 }
Reka Normanbaf22462022-05-06 19:55:11 +100051
52 if (fw_config_probe(FW_CONFIG(SD_CARD, SD_ABSENT))) {
53 printk(BIOS_INFO, "Disable SD card GPIO pins.\n");
54 gpio_configure_pads(sd_disable_pads, ARRAY_SIZE(sd_disable_pads));
55 }
Reka Normanf1b8cee2022-05-06 20:04:54 +100056
57 if (fw_config_probe(FW_CONFIG(WFC, WFC_ABSENT))) {
58 printk(BIOS_INFO, "Disable MIPI WFC GPIO pins.\n");
59 gpio_configure_pads(wfc_disable_pads, ARRAY_SIZE(wfc_disable_pads));
60 }
Reka Norman457d98d2022-02-04 11:17:32 +110061}
62BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);