From 655fa5c39b34caa5fade7a3d69a2ef074ed01247 Mon Sep 17 00:00:00 2001 From: Malik_Hsu Date: Tue, 23 Nov 2021 15:14:08 +0800 Subject: [PATCH] mb/google/brya/variants/primus: update gpios for power consumption In different sku, some unused GPIO pins are processed by NC for power consumption. BUG=b:196790249 TEST=emerge-brya coreboot chromeos-bootimage and check power Signed-off-by: Malik_Hsu Change-Id: I753e41dec1825299e6cd437b5f67e2d957bc6148 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59563 Tested-by: build bot (Jenkins) Reviewed-by: Tim Wawrzynczak --- .../google/brya/variants/primus/variant.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) 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 #include #include +#include +#include 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); }