| 1 |
|
| 2 |
|
| 3 |
#include <bootstate.h> |
| 4 |
#include <baseboard/gpio.h> |
| 5 |
#include <baseboard/variants.h> |
| 6 |
#include <console/console.h> |
| 7 |
#include <fw_config.h> |
| 8 |
|
| 9 |
static const struct pad_config fp_disable_pads[] = { |
| 10 |
|
| 11 |
PAD_NC(GPP_D2, NONE), |
| 12 |
|
| 13 |
PAD_NC(GPP_D3, NONE), |
| 14 |
|
| 15 |
PAD_NC(GPP_D15, NONE), |
| 16 |
|
| 17 |
PAD_NC(GPP_D13, NONE), |
| 18 |
|
| 19 |
PAD_NC(GPP_F11, NONE), |
| 20 |
|
| 21 |
PAD_NC(GPP_F12, NONE), |
| 22 |
|
| 23 |
PAD_NC(GPP_F13, NONE), |
| 24 |
|
| 25 |
PAD_NC(GPP_F16, NONE), |
| 26 |
}; |
| 27 |
|
| 28 |
static const struct pad_config lte_disable_pads[] = { |
| 29 |
|
| 30 |
PAD_NC(GPP_E11, NONE), |
| 31 |
|
| 32 |
PAD_NC(GPP_E17, NONE), |
| 33 |
|
| 34 |
PAD_NC(GPP_D7, NONE), |
| 35 |
|
| 36 |
PAD_NC(GPP_D5, NONE), |
| 37 |
|
| 38 |
PAD_NC(GPP_F21, NONE), |
| 39 |
|
| 40 |
PAD_NC(GPP_S4, NONE), |
| 41 |
|
| 42 |
PAD_NC(GPP_S5, NONE), |
| 43 |
|
| 44 |
PAD_NC(GPP_F6, NONE), |
| 45 |
|
| 46 |
PAD_NC(GPP_A12, NONE), |
| 47 |
|
| 48 |
PAD_NC(GPP_H23, NONE), |
| 49 |
|
| 50 |
PAD_NC(GPP_H19, NONE), |
| 51 |
}; |
| 52 |
|
| 53 |
static const struct pad_config lte_sar_disable_pads[] = { |
| 54 |
|
| 55 |
PAD_NC(GPP_D5, NONE), |
| 56 |
|
| 57 |
PAD_NC(GPP_S4, NONE), |
| 58 |
|
| 59 |
PAD_NC(GPP_S5, NONE), |
| 60 |
|
| 61 |
PAD_NC(GPP_F6, NONE), |
| 62 |
|
| 63 |
PAD_NC(GPP_H19, NONE), |
| 64 |
}; |
| 65 |
|
| 66 |
static const struct pad_config nvme_disable_pads[] = { |
| 67 |
|
| 68 |
PAD_NC(GPP_F9, NONE), |
| 69 |
|
| 70 |
PAD_NC(GPP_D11, NONE), |
| 71 |
|
| 72 |
PAD_NC(GPP_D8, NONE), |
| 73 |
}; |
| 74 |
|
| 75 |
static void fw_config_handle(void *unused) |
| 76 |
{ |
| 77 |
if (!fw_config_is_provisioned()) { |
| 78 |
printk(BIOS_WARNING, "FW_CONFIG is unprovisioned. Skip disable device's pads.\n"); |
| 79 |
return; |
| 80 |
} |
| 81 |
|
| 82 |
if (fw_config_probe(FW_CONFIG(FPMCU, FPMCU_ABSENT))) { |
| 83 |
printk(BIOS_INFO, "Disable Fingerprint GPIOs by fw_config.\n"); |
| 84 |
gpio_configure_pads(fp_disable_pads, ARRAY_SIZE(fp_disable_pads)); |
| 85 |
} |
| 86 |
|
| 87 |
if (fw_config_probe(FW_CONFIG(DB_USB, DB_1A))) { |
| 88 |
printk(BIOS_INFO, "Disable LTE-related GPIO pins by fw_config.\n"); |
| 89 |
gpio_configure_pads(lte_disable_pads, ARRAY_SIZE(lte_disable_pads)); |
| 90 |
} |
| 91 |
|
| 92 |
if (fw_config_probe(FW_CONFIG(DB_USB, DB_1A_LTE))) { |
| 93 |
printk(BIOS_INFO, "Disable LTE's Sar sensor related GPIO pins by fw_config.\n"); |
| 94 |
gpio_configure_pads(lte_sar_disable_pads, ARRAY_SIZE(lte_sar_disable_pads)); |
| 95 |
} |
| 96 |
|
| 97 |
if (!fw_config_probe(FW_CONFIG(STORAGE, STORAGE_NVME))) { |
| 98 |
printk(BIOS_INFO, "Disable NVMe GPIO pins by fw_config.\n"); |
| 99 |
gpio_configure_pads(nvme_disable_pads, ARRAY_SIZE(nvme_disable_pads)); |
| 100 |
} |
| 101 |
} |
| 102 |
BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL); |