mb/google/fatcat/var/fatcat: Refactor GPIO programming for UFS support
[coreboot.git] / src / mainboard / google / myst / variants / baseboard / fw_config.c
blob9d5c9236d8f28d1588033664b71f9efb9c6769e2
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootstate.h>
4 #include <console/console.h>
5 #include <fw_config.h>
6 #include <gpio.h>
8 static const struct soc_amd_gpio fp_spi_gpio_table[] = {
9 /* SOC_CLK_FPMCU_R */
10 PAD_NF(GPIO_70, SPI2_CLK, PULL_NONE),
11 /* SOC_CLK_FPMCU_R_L */
12 PAD_NF(GPIO_75, SPI2_CS1_L, PULL_NONE),
13 /* SPI_SOC_DO_FPMCU_DI_R */
14 PAD_NF(GPIO_104, SPI2_DAT0, PULL_NONE),
15 /* SPI_SOC_DI_FPMCU_DO_R */
16 PAD_NF(GPIO_105, SPI2_DAT1, PULL_NONE),
19 static const struct soc_amd_gpio fp_uart_gpio_table[] = {
20 /* UART1_TXD / FPMCU */
21 PAD_NF(GPIO_140, UART1_TXD, PULL_NONE),
22 /* UART1_RXD / FPMCU */
23 PAD_NF(GPIO_142, UART1_RXD, PULL_NONE),
26 static void fw_config_handle(void *unused)
28 if (!fw_config_is_provisioned() || fw_config_probe(FW_CONFIG(FP, DISABLED))) {
29 return;
31 if (fw_config_probe(FW_CONFIG(FP, SPI))) {
32 printk(BIOS_INFO, "Enabling SPI FP.\n");
33 gpio_configure_pads(fp_spi_gpio_table, ARRAY_SIZE(fp_spi_gpio_table));
34 } else if (fw_config_probe(FW_CONFIG(FP, UART))) {
35 printk(BIOS_INFO, "Enabling UART FP.\n");
36 gpio_configure_pads(fp_uart_gpio_table, ARRAY_SIZE(fp_uart_gpio_table));
37 } else {
38 printk(BIOS_INFO, "Invalid Fingerprint Setting, leaving FP disabled.");
42 BOOT_STATE_INIT_ENTRY(BS_DEV_ENABLE, BS_ON_ENTRY, fw_config_handle, NULL);