mb/google/myst: Add stubs to configure GPIOs
Add configuration stubs for GPIOs to be implemented later.
BUG=b:270596581
TEST=builds
Signed-off-by: Jon Murphy <jpmurphy@google.com>
Change-Id: I3228f857da7c8c76cf32faf4a23418aedaf40875
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74094
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
diff --git a/src/mainboard/google/myst/bootblock.c b/src/mainboard/google/myst/bootblock.c
index 90789c6..0877807 100644
--- a/src/mainboard/google/myst/bootblock.c
+++ b/src/mainboard/google/myst/bootblock.c
@@ -7,3 +7,12 @@
{
/* TODO(b/275959717): 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/myst/mainboard.c b/src/mainboard/google/myst/mainboard.c
index 09118d4..bba9fc2d 100644
--- a/src/mainboard/google/myst/mainboard.c
+++ b/src/mainboard/google/myst/mainboard.c
@@ -14,9 +14,21 @@
return fch_irq_map;
}
+static void mainboard_configure_gpios(void)
+{
+ size_t base_num_gpios, override_num_gpios;
+ const struct soc_amd_gpio *base_gpios, *override_gpios;
+
+ baseboard_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(b/270596581): Perform mainboard initialization */
+ mainboard_configure_gpios();
}
static void mainboard_enable(struct device *dev)
diff --git a/src/mainboard/google/myst/variants/baseboard/Makefile.inc b/src/mainboard/google/myst/variants/baseboard/Makefile.inc
new file mode 100644
index 0000000..9fb63f5
--- /dev/null
+++ b/src/mainboard/google/myst/variants/baseboard/Makefile.inc
@@ -0,0 +1,3 @@
+bootblock-y += gpio.c
+
+ramstage-y += gpio.c
diff --git a/src/mainboard/google/myst/variants/baseboard/gpio.c b/src/mainboard/google/myst/variants/baseboard/gpio.c
new file mode 100644
index 0000000..4383d14
--- /dev/null
+++ b/src/mainboard/google/myst/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(b/270596581): Fill gpio configuration */
+};
+
+/* GPIO configuration in bootblock */
+static const struct soc_amd_gpio bootblock_gpio_table[] = {
+ /* TODO(b/275965982): Fill bootblock gpio configuration */
+};
+
+void baseboard_gpio_table(const struct soc_amd_gpio **gpio, size_t *size)
+{
+ *size = ARRAY_SIZE(base_gpio_table);
+ *gpio = base_gpio_table;
+}
+
+__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;
+}
+
+__weak void variant_override_gpio_table(const struct soc_amd_gpio **gpio, size_t *size)
+{
+ *size = 0;
+ *gpio = NULL;
+}
diff --git a/src/mainboard/google/myst/variants/baseboard/include/baseboard/gpio.h b/src/mainboard/google/myst/variants/baseboard/include/baseboard/gpio.h
new file mode 100644
index 0000000..b94afac
--- /dev/null
+++ b/src/mainboard/google/myst/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/myst/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/myst/variants/baseboard/include/baseboard/variants.h
index 927af2f..3f69548 100644
--- a/src/mainboard/google/myst/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/myst/variants/baseboard/include/baseboard/variants.h
@@ -3,4 +3,19 @@
#ifndef __BASEBOARD_VARIANTS_H__
#define __BASEBOARD_VARIANTS_H__
+#include <gpio.h>
+
+
+/* This function provides base GPIO configuration table. */
+void baseboard_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);
+
+/*
+ * This function allows variant to override any GPIOs that are different than the base GPIO
+ * configuration provided by baseboard_gpio_table().
+ */
+void variant_override_gpio_table(const struct soc_amd_gpio **gpio, size_t *size);
+
#endif /* __BASEBOARD_VARIANTS_H__ */