From 64a6bcaa4eb491170b4424f7d676f09854c2744a Mon Sep 17 00:00:00 2001 From: Tim Wawrzynczak Date: Tue, 16 Apr 2019 15:21:09 -0600 Subject: kohaku: mb/hatch/gpio: Scrub Kohaku GPIOs. Ensure Kohaku GPIO pins are configured correctly w/r/t Hatch. Implement the base/override model for GPIOs (regular and early). The 'hatch' baseboard contains the base GPIOs, and variants can override individual pads. BUG=b:129707481 BRANCH=none TEST=Compiles for all variants. Change-Id: Ie5c83a0538d367ea11e9499f21cea41891d7a78e Signed-off-by: Tim Wawrzynczak Reviewed-on: https://review.coreboot.org/c/coreboot/+/32326 Tested-by: build bot (Jenkins) Reviewed-by: Paul Fagerburg Reviewed-by: Furquan Shaikh --- .../google/hatch/variants/baseboard/gpio.c | 25 ++++++++++++++++------ .../baseboard/include/baseboard/variants.h | 13 +++++++---- 2 files changed, 27 insertions(+), 11 deletions(-) (limited to 'src/mainboard/google/hatch/variants/baseboard') diff --git a/src/mainboard/google/hatch/variants/baseboard/gpio.c b/src/mainboard/google/hatch/variants/baseboard/gpio.c index eaa8dd343a..7e82b9b6ec 100644 --- a/src/mainboard/google/hatch/variants/baseboard/gpio.c +++ b/src/mainboard/google/hatch/variants/baseboard/gpio.c @@ -232,7 +232,7 @@ static const struct pad_config gpio_table[] = { /* E0 : GPP_E0 ==> NC */ PAD_NC(GPP_E0, NONE), - /* E1 : SATAPCIE1 */ + /* E1 : M2_SSD_PEDET */ PAD_CFG_NF(GPP_E1, NONE, DEEP, NF1), /* E2 : GPP_E2 ==> NC */ PAD_NC(GPP_E2, NONE), @@ -344,7 +344,6 @@ static const struct pad_config gpio_table[] = { PAD_CFG_NF(GPP_G6, NONE, DEEP, NF1), /* G7 : SD_WP => NC */ PAD_NC(GPP_G7, DN_20K), - /* * H0 : HP_INT_L * TODO Configure it back to invert mode, when @@ -405,7 +404,7 @@ static const struct pad_config gpio_table[] = { PAD_CFG_GPI_GPIO_DRIVER(vSD3_CD_B, NONE, DEEP), }; -const struct pad_config *__weak variant_gpio_table(size_t *num) +const struct pad_config *base_gpio_table(size_t *num) { *num = ARRAY_SIZE(gpio_table); return gpio_table; @@ -429,8 +428,8 @@ static const struct pad_config s5_sleep_gpio_table[] = { PAD_CFG_GPO(GPP_A18, 0, DEEP), /* EN_PP3300_WWAN */ }; -const struct pad_config * __weak -variant_sleep_gpio_table(u8 slp_typ, size_t *num) +const struct pad_config * __weak variant_sleep_gpio_table( + u8 slp_typ, size_t *num) { if (slp_typ == ACPI_S5) { *num = ARRAY_SIZE(s5_sleep_gpio_table); @@ -470,10 +469,9 @@ static const struct pad_config early_gpio_table[] = { PAD_CFG_GPI(GPP_F21, NONE, PLTRST), /* F22 : PCH_MEM_STRAP3 */ PAD_CFG_GPI(GPP_F22, NONE, PLTRST), - }; -const struct pad_config *__weak variant_early_gpio_table(size_t *num) +const struct pad_config *base_early_gpio_table(size_t *num) { *num = ARRAY_SIZE(early_gpio_table); return early_gpio_table; @@ -489,3 +487,16 @@ const struct cros_gpio *__weak variant_cros_gpios(size_t *num) *num = ARRAY_SIZE(cros_gpios); return cros_gpios; } + +/* Weak implementation of overrides */ +const struct pad_config *__weak override_gpio_table(size_t *num) +{ + *num = 0; + return NULL; +} + +const struct pad_config *__weak override_early_gpio_table(size_t *num) +{ + *num = 0; + return NULL; +} diff --git a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h index fd39c4516f..d41ad536f2 100644 --- a/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/hatch/variants/baseboard/include/baseboard/variants.h @@ -21,10 +21,15 @@ #include #include -/* The next set of functions return the gpio table and fill in the number of - * entries for each table. */ -const struct pad_config *variant_gpio_table(size_t *num); -const struct pad_config *variant_early_gpio_table(size_t *num); +/* + * The next set of functions return the gpio table and fill in the number of + * entries for each table. The "base" GPIOs live in the "hatch" variant, and + * the overrides live with the specific board (kohaku, kled, etc.). +*/ +const struct pad_config *base_gpio_table(size_t *num); +const struct pad_config *base_early_gpio_table(size_t *num); +const struct pad_config *override_gpio_table(size_t *num); +const struct pad_config *override_early_gpio_table(size_t *num); /* Return memory SKU for the board. */ int variant_memory_sku(void); -- cgit v1.2.3