diff options
author | Justin TerAvest <teravest@chromium.org> | 2018-02-14 19:10:15 -0700 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2018-02-17 00:18:38 +0000 |
commit | 3fe3f0409cd340112d62283bf79be9f106a6dff8 (patch) | |
tree | 5df7ca98aa87050586b382be1e83920684a80ba1 /src/mainboard/google/kahlee | |
parent | 5b131e27c5d21d006950337cfd00e5fb35c7ed3b (diff) |
soc/amd/stoneyridge: Normalize GPIO init
This makes the flow for GPIO initialization more closely follow that
what is performed for other boards so that it's easier to read the flow
(and stops relying on BS_WRITE_TABLES).
BUG=b:72875858
TEST=Built and booted grunt, built gardenia.
Change-Id: Ic97db96581a69798b193a6bdeb93644f6a74fc9d
Signed-off-by: Justin TerAvest <teravest@chromium.org>
Reviewed-on: https://review.coreboot.org/23679
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/google/kahlee')
5 files changed, 30 insertions, 11 deletions
diff --git a/src/mainboard/google/kahlee/bootblock/bootblock.c b/src/mainboard/google/kahlee/bootblock/bootblock.c index 90c8acbabf..244abe051f 100644 --- a/src/mainboard/google/kahlee/bootblock/bootblock.c +++ b/src/mainboard/google/kahlee/bootblock/bootblock.c @@ -13,12 +13,18 @@ * GNU General Public License for more details. */ +#include <baseboard/variants.h> #include <bootblock_common.h> #include <soc/southbridge.h> #include <variant/ec.h> void bootblock_mainboard_init(void) { + size_t num_gpios; + const struct soc_amd_stoneyridge_gpio *gpios; + gpios = variant_early_gpio_table(&num_gpios); + sb_program_gpios(gpios, num_gpios); + /* Enable the EC as soon as we have visibility */ mainboard_ec_init(); diff --git a/src/mainboard/google/kahlee/mainboard.c b/src/mainboard/google/kahlee/mainboard.c index b7adfc026a..aa8d080b6a 100644 --- a/src/mainboard/google/kahlee/mainboard.c +++ b/src/mainboard/google/kahlee/mainboard.c @@ -156,11 +156,16 @@ static void mainboard_init(void *chip_info) const struct sci_source *gpes; size_t num; int boardid = board_id(); + size_t num_gpios; + const struct soc_amd_stoneyridge_gpio *gpios; printk(BIOS_INFO, "Board ID: %d\n", boardid); mainboard_ec_init(); + gpios = variant_gpio_table(&num_gpios); + sb_program_gpios(gpios, num_gpios); + gpes = get_gpe_table(&num); gpe_configure_sci(gpes, num); diff --git a/src/mainboard/google/kahlee/variants/baseboard/gpio.c b/src/mainboard/google/kahlee/variants/baseboard/gpio.c index a6bcea5c86..1e1f34b005 100644 --- a/src/mainboard/google/kahlee/variants/baseboard/gpio.c +++ b/src/mainboard/google/kahlee/variants/baseboard/gpio.c @@ -258,13 +258,16 @@ const static struct soc_amd_stoneyridge_gpio gpio_set_stage_ram[] = { { GPIO_135, Function1, FCH_GPIO_PULL_UP_ENABLE | INPUT }, }; -const __attribute__((weak)) const struct soc_amd_stoneyridge_gpio - *board_get_gpio(size_t *size) +const __attribute__((weak)) +struct soc_amd_stoneyridge_gpio *variant_early_gpio_table(size_t *size) +{ + *size = ARRAY_SIZE(gpio_set_stage_reset); + return gpio_set_stage_reset; +} + +const __attribute__((weak)) +struct soc_amd_stoneyridge_gpio *variant_gpio_table(size_t *size) { - if (GPIO_TABLE_BOOTBLOCK) { - *size = ARRAY_SIZE(gpio_set_stage_reset); - return gpio_set_stage_reset; - } *size = ARRAY_SIZE(gpio_set_stage_ram); return gpio_set_stage_ram; } diff --git a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h index bf14ef4d7c..83ee1190e3 100644 --- a/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/kahlee/variants/baseboard/include/baseboard/variants.h @@ -19,6 +19,7 @@ #include <stddef.h> #include <soc/smi.h> +#include <soc/southbridge.h> #include <amdblocks/agesawrapper.h> const struct sci_source *get_gpe_table(size_t *num); @@ -26,5 +27,7 @@ uint8_t variant_memory_sku(void); int variant_mainboard_read_spd(uint8_t spdAddress, char *buf, size_t len); int variant_get_xhci_oc_map(uint16_t *usb_oc_map); int variant_get_ehci_oc_map(uint16_t *usb_oc_map); +const struct soc_amd_stoneyridge_gpio *variant_early_gpio_table(size_t *size); +const struct soc_amd_stoneyridge_gpio *variant_gpio_table(size_t *size); #endif /* __BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/google/kahlee/variants/kahlee/gpio.c b/src/mainboard/google/kahlee/variants/kahlee/gpio.c index e357c7e2c3..d1cc017c93 100644 --- a/src/mainboard/google/kahlee/variants/kahlee/gpio.c +++ b/src/mainboard/google/kahlee/variants/kahlee/gpio.c @@ -96,12 +96,14 @@ const struct soc_amd_stoneyridge_gpio gpio_set_stage_ram[] = { {GPIO_119, Function2, FCH_GPIO_PULL_UP_ENABLE | OUTPUT_H }, }; -const struct soc_amd_stoneyridge_gpio *board_get_gpio(size_t *size) +const struct soc_amd_stoneyridge_gpio *variant_early_gpio_table(size_t *size) +{ + *size = ARRAY_SIZE(gpio_set_stage_reset); + return gpio_set_stage_reset; +} + +const struct soc_amd_stoneyridge_gpio *variant_gpio_table(size_t *size) { - if (GPIO_TABLE_BOOTBLOCK) { - *size = ARRAY_SIZE(gpio_set_stage_reset); - return gpio_set_stage_reset; - } *size = ARRAY_SIZE(gpio_set_stage_ram); return gpio_set_stage_ram; } |