mb/google/octopus: Use newly added gpio_configure_pads_with_override

This change updates mainboard_init to call
gpio_configure_pads_with_override instead of gpio_configure_pads to
allow variants to provide overrides for the GPIO config table provided
by the baseboard.

BUG=b:111743717
TEST=Verified on phaser that GPIO config with and without this change
is the same.

Change-Id: I494a950100e5ec82504d652ff6e8a75746456d1f
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://review.coreboot.org/27641
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Furquan Shaikh 2018-07-25 14:30:59 -07:00 committed by Aaron Durbin
parent 4a12a56cdf
commit 06a41f1f60
4 changed files with 18 additions and 7 deletions

View File

@ -34,14 +34,18 @@
static void mainboard_init(void *chip_info) static void mainboard_init(void *chip_info)
{ {
int boardid; int boardid;
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;
boardid = board_id(); boardid = board_id();
printk(BIOS_INFO, "Board ID: %d\n", boardid); printk(BIOS_INFO, "Board ID: %d\n", boardid);
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);
mainboard_ec_init(); mainboard_ec_init();
} }

View File

@ -281,12 +281,18 @@ static const struct pad_config gpio_table[] = {
PAD_NC(GPIO_210, DN_20K), PAD_NC(GPIO_210, DN_20K),
}; };
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;
}
/* GPIOs needed prior to ramstage. */ /* GPIOs needed prior to ramstage. */
static const struct pad_config early_gpio_table[] = { static const struct pad_config early_gpio_table[] = {
PAD_CFG_GPI(GPIO_190, NONE, DEEP), /* PCH_WP_OD */ PAD_CFG_GPI(GPIO_190, NONE, DEEP), /* PCH_WP_OD */

View File

@ -23,7 +23,8 @@
/* 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_override_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, int slp_typ); const struct pad_config *variant_sleep_gpio_table(size_t *num, int slp_typ);

View File

@ -259,7 +259,7 @@ static const struct pad_config gpio_table[] = {
PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_210, 0, DEEP, NONE, HIZCRx0, DISPUPD), PAD_CFG_GPO_IOSSTATE_IOSTERM(GPIO_210, 0, DEEP, NONE, HIZCRx0, DISPUPD),
}; };
const struct pad_config *variant_gpio_table(size_t *num) const struct pad_config *variant_base_gpio_table(size_t *num)
{ {
*num = ARRAY_SIZE(gpio_table); *num = ARRAY_SIZE(gpio_table);
return gpio_table; return gpio_table;