diff options
-rw-r--r-- | src/mainboard/google/brya/variants/primus/variant.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/mainboard/google/brya/variants/primus/variant.c b/src/mainboard/google/brya/variants/primus/variant.c index e10648d6c3..4c2458acf7 100644 --- a/src/mainboard/google/brya/variants/primus/variant.c +++ b/src/mainboard/google/brya/variants/primus/variant.c @@ -5,6 +5,8 @@ #include <device/device.h> #include <drivers/i2c/hid/chip.h> #include <fw_config.h> +#include <gpio.h> +#include <soc/gpio.h> static void devtree_update_emmc_rtd3(uint32_t board_ver) { @@ -27,9 +29,34 @@ static void devtree_update_audio_codec(uint32_t board_ver) config->hid = "RTL5682"; } +static const struct pad_config nvme_disable_pads[] = { + PAD_NC(GPP_B2, NONE), /* B2 : VRALERT# ==> M2_SSD_PLA_L */ + PAD_NC(GPP_B4, NONE), /* B4 : PROC_GP3 ==> SSD_PERST_L */ + PAD_NC(GPP_D3, NONE), /* D3 : ISH_GP3 ==> M2_SSD_PLN_L */ + PAD_NC(GPP_D5, NONE), /* D5 : SRCCLKREQ0# ==> SSD_CLKREQ_ODL */ + PAD_NC(GPP_D11, NONE), /* D11 : ISH_SPI_MISO ==> EN_PP3300_SSD */ +}; + +static const struct pad_config emmc_disable_pads[] = { + PAD_NC(GPP_B3, NONE), /* B3 : PROC_GP2 ==> eMMC_PERST_L */ + PAD_NC(GPP_E20, NONE), /* E20 : USB_C1_LSX_SOC_TX ==> EN_PP3300_eMMC */ + PAD_NC(GPP_F19, NONE), /* F19 : SRCCLKREQ6# ==> EMMC_CLKREQ_ODL */ +}; + +static void disable_unused_gpios(void) +{ + int emmc_detected = gpio_get(GPP_T2); + + if (emmc_detected == 1) + gpio_configure_pads(nvme_disable_pads, ARRAY_SIZE(nvme_disable_pads)); + else + gpio_configure_pads(emmc_disable_pads, ARRAY_SIZE(emmc_disable_pads)); +} + void variant_devtree_update(void) { uint32_t board_ver = board_id(); + disable_unused_gpios(); devtree_update_emmc_rtd3(board_ver); devtree_update_audio_codec(board_ver); } |