mb/google/dedede: Add ability to provide override GPIO table

For variants with slightly different GPIO configuration, add support to
pass an override GPIO configuration table.

BUG=None
TEST=Build and boot the waddledee mainboard.

Change-Id: I2f1c6dc2ea5499bff96a471c4461339ef01ee19a
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/43279
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2020-07-07 22:27:10 -06:00 committed by Patrick Georgi
parent c8d8777750
commit c34079cea0
3 changed files with 17 additions and 6 deletions

View File

@ -22,11 +22,15 @@ static void mainboard_config_isst(void *unused)
static void mainboard_init(void *chip_info) static void mainboard_init(void *chip_info)
{ {
const struct pad_config *pads; const struct pad_config *base_pads;
size_t num; const struct pad_config *override_pads;
size_t base_num, override_num;
pads = variant_gpio_table(&num); base_pads = variant_base_gpio_table(&base_num);
gpio_configure_pads(pads, num); override_pads = variant_override_gpio_table(&override_num);
gpio_configure_pads_with_override(base_pads, base_num,
override_pads, override_num);
} }
static void mainboard_dev_init(struct device *dev) static void mainboard_dev_init(struct device *dev)

View File

@ -420,12 +420,18 @@ static const struct pad_config early_gpio_table[] = {
PAD_CFG_GPI(GPP_S0, NONE, DEEP), PAD_CFG_GPI(GPP_S0, NONE, DEEP),
}; };
const struct pad_config *__weak variant_gpio_table(size_t *num) const struct pad_config *__weak variant_base_gpio_table(size_t *num)
{ {
*num = ARRAY_SIZE(gpio_table); *num = ARRAY_SIZE(gpio_table);
return gpio_table; return gpio_table;
} }
const struct pad_config *__weak variant_override_gpio_table(size_t *num)
{
*num = 0;
return NULL;
}
const struct pad_config *__weak variant_early_gpio_table(size_t *num) const struct pad_config *__weak variant_early_gpio_table(size_t *num)
{ {
*num = ARRAY_SIZE(early_gpio_table); *num = ARRAY_SIZE(early_gpio_table);

View File

@ -13,10 +13,11 @@
/* The next set of functions return the gpio table and fill in the number of /* The next set of functions return the gpio table and fill in the number of
* entries for each table. */ * entries for each table. */
const struct pad_config *variant_gpio_table(size_t *num); const struct pad_config *variant_base_gpio_table(size_t *num);
const struct pad_config *variant_early_gpio_table(size_t *num); const struct pad_config *variant_early_gpio_table(size_t *num);
const struct pad_config *variant_sleep_gpio_table(size_t *num); const struct pad_config *variant_sleep_gpio_table(size_t *num);
const struct cros_gpio *variant_cros_gpios(size_t *num); const struct cros_gpio *variant_cros_gpios(size_t *num);
const struct pad_config *variant_override_gpio_table(size_t *num);
/** /**
* Get board's Hardware features as defined in FW_CONFIG * Get board's Hardware features as defined in FW_CONFIG