diff options
author | Jon Murphy <jpmurphy@google.com> | 2022-02-16 06:34:39 -0700 |
---|---|---|
committer | Felix Held <felix-coreboot@felixheld.de> | 2022-02-24 21:38:18 +0000 |
commit | 9042427ea272fae974044deca64640fc67e9773d (patch) | |
tree | d2fc00dbf833403818eb57125fa7ce0f7cebc85b /src/mainboard/google/skyrim | |
parent | 3a260ad8f15deddbac3fd37238be87d85797e053 (diff) |
mb/google/skyrim: Add stubs to configure GPIOs
BUG=b:214415401
TEST=builds
BRANCH=none
Signed-off-by: Jon Murphy <jpmurphy@google.com>
Change-Id: Ieeda9aa0c18b5befea67d2849bd4114da0c348a3
Reviewed-on: https://review.coreboot.org/c/coreboot/+/62041
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/google/skyrim')
6 files changed, 84 insertions, 1 deletions
diff --git a/src/mainboard/google/skyrim/bootblock.c b/src/mainboard/google/skyrim/bootblock.c index dd4c1516b1..d1000d30b9 100644 --- a/src/mainboard/google/skyrim/bootblock.c +++ b/src/mainboard/google/skyrim/bootblock.c @@ -7,3 +7,12 @@ void bootblock_mainboard_early_init(void) { /* TODO: Perform mainboard initialization */ } + +void bootblock_mainboard_init(void) +{ + size_t num_gpios; + const struct soc_amd_gpio *gpios; + + variant_bootblock_gpio_table(&gpios, &num_gpios); + gpio_configure_pads(gpios, num_gpios); +} diff --git a/src/mainboard/google/skyrim/mainboard.c b/src/mainboard/google/skyrim/mainboard.c index 3dc2c41d69..1ed5006ec4 100644 --- a/src/mainboard/google/skyrim/mainboard.c +++ b/src/mainboard/google/skyrim/mainboard.c @@ -1,10 +1,23 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */ +#include <baseboard/variants.h> #include <device/device.h> +static void mainboard_configure_gpios(void) +{ + size_t base_num_gpios, override_num_gpios; + const struct soc_amd_gpio *base_gpios, *override_gpios; + + variant_base_gpio_table(&base_gpios, &base_num_gpios); + variant_override_gpio_table(&override_gpios, &override_num_gpios); + + gpio_configure_pads_with_override(base_gpios, base_num_gpios, + override_gpios, override_num_gpios); +} + static void mainboard_init(void *chip_info) { - /* TODO: Perform mainboard initialization */ + mainboard_configure_gpios(); } static void mainboard_enable(struct device *dev) diff --git a/src/mainboard/google/skyrim/variants/baseboard/Makefile.inc b/src/mainboard/google/skyrim/variants/baseboard/Makefile.inc new file mode 100644 index 0000000000..9fb63f5f43 --- /dev/null +++ b/src/mainboard/google/skyrim/variants/baseboard/Makefile.inc @@ -0,0 +1,3 @@ +bootblock-y += gpio.c + +ramstage-y += gpio.c diff --git a/src/mainboard/google/skyrim/variants/baseboard/gpio.c b/src/mainboard/google/skyrim/variants/baseboard/gpio.c new file mode 100644 index 0000000000..94675feab8 --- /dev/null +++ b/src/mainboard/google/skyrim/variants/baseboard/gpio.c @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <baseboard/gpio.h> +#include <baseboard/variants.h> +#include <commonlib/helpers.h> + +/* GPIO configuration in ramstage*/ +static const struct soc_amd_gpio base_gpio_table[] = { + /* TODO: Fill gpio configuration */ +}; + +/* Early GPIO configuration in bootblock */ +static const struct soc_amd_gpio bootblock_gpio_table[] = { + /* TODO: Fill bootblock gpio configuration */ +}; + +__weak void variant_base_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) +{ + *size = ARRAY_SIZE(base_gpio_table); + *gpio = base_gpio_table; +} + +__weak void variant_override_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) +{ + *size = 0; + *gpio = NULL; +} + +__weak void variant_bootblock_gpio_table(const struct soc_amd_gpio **gpio, size_t *size) +{ + *size = ARRAY_SIZE(bootblock_gpio_table); + *gpio = bootblock_gpio_table; +} diff --git a/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/gpio.h b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/gpio.h new file mode 100644 index 0000000000..b94afac4bf --- /dev/null +++ b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/gpio.h @@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __BASEBOARD_GPIO_H__ +#define __BASEBOARD_GPIO_H__ + +#endif /* __BASEBOARD_GPIO_H__ */ diff --git a/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h index 927af2f913..725baf8b08 100644 --- a/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/skyrim/variants/baseboard/include/baseboard/variants.h @@ -3,4 +3,23 @@ #ifndef __BASEBOARD_VARIANTS_H__ #define __BASEBOARD_VARIANTS_H__ +#include <amdblocks/gpio.h> + +/* + * This function provides base GPIO configuration table. It is typically provided by + * baseboard using a weak implementation. If GPIO configuration for a variant differs + * significantly from the baseboard, then the variant can also provide a strong implementation + * of this function. + */ +void variant_base_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); + +/* + * This function allows variant to override any GPIOs that are different than the base GPIO + * configuration provided by variant_base_gpio_table(). + */ +void variant_override_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); + +/* This function provides GPIO init in bootblock. */ +void variant_bootblock_gpio_table(const struct soc_amd_gpio **gpio, size_t *size); + #endif /* __BASEBOARD_VARIANTS_H__ */ |