Felix Held has submitted this change. ( https://review.coreboot.org/c/coreboot/+/59563 )
Change subject: mb/google/brya/variants/primus: update gpios for power consumption ......................................................................
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 malik_hsu@wistron.corp-partner.google.com Change-Id: I753e41dec1825299e6cd437b5f67e2d957bc6148 Reviewed-on: https://review.coreboot.org/c/coreboot/+/59563 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Tim Wawrzynczak twawrzynczak@chromium.org --- M src/mainboard/google/brya/variants/primus/variant.c 1 file changed, 27 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Tim Wawrzynczak: Looks good to me, approved
diff --git a/src/mainboard/google/brya/variants/primus/variant.c b/src/mainboard/google/brya/variants/primus/variant.c index e10648d..4c2458a 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 @@ 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); }