summaryrefslogtreecommitdiff
path: root/src/mainboard/google/brya
diff options
context:
space:
mode:
authorSubrata Banik <subratabanik@google.com>2024-05-24 01:40:27 +0530
committerSubrata Banik <subratabanik@google.com>2024-05-24 05:50:05 +0000
commit4050ef091a18507617786648f901dd1eb477a8d5 (patch)
treedfdf7ff6f5a80c31afba8f71c0cc969ce1838981 /src/mainboard/google/brya
parent2889787522eac3895611c777b959eb66272b4c08 (diff)
mb/google/trulo: Refactor gpio pad configuration
This patch tries to simplify the baseboard/variant GPIO programming for Google/Trulo. The idea is to let each variant maintain its own complete GPIO PAD configuration table instead of having a back-and-forth call between baseboard and variants. With this patch coreboot performing GPIO programming is now much simpler where the common code block calls into respective variants and gets the gpio table prior to the pad configuration. BUG=b:334826281 ([TWL] Decouple GPIO from baseboard to variant) TEST=Able to build google/orisa. Change-Id: I4ab88ac094a45c608cd894feb5eeec24b867527a Signed-off-by: Subrata Banik <subratabanik@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/82629 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Eric Lai <ericllai@google.com> Reviewed-by: Dinesh Gehlot <digehlot@google.com> Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Diffstat (limited to 'src/mainboard/google/brya')
-rw-r--r--src/mainboard/google/brya/variants/baseboard/trulo/Makefile.mk5
-rw-r--r--src/mainboard/google/brya/variants/orisa/Makefile.mk5
-rw-r--r--src/mainboard/google/brya/variants/orisa/gpio.c (renamed from src/mainboard/google/brya/variants/baseboard/trulo/gpio.c)17
-rw-r--r--src/mainboard/google/brya/variants/trulo/Makefile.mk5
-rw-r--r--src/mainboard/google/brya/variants/trulo/gpio.c51
5 files changed, 72 insertions, 11 deletions
diff --git a/src/mainboard/google/brya/variants/baseboard/trulo/Makefile.mk b/src/mainboard/google/brya/variants/baseboard/trulo/Makefile.mk
index 54a5c5b5c9..be05cd4e5c 100644
--- a/src/mainboard/google/brya/variants/baseboard/trulo/Makefile.mk
+++ b/src/mainboard/google/brya/variants/baseboard/trulo/Makefile.mk
@@ -1,8 +1,3 @@
## SPDX-License-Identifier: GPL-2.0-only
-bootblock-y += gpio.c
-
romstage-y += memory.c
-romstage-y += gpio.c
-
-ramstage-y += gpio.c
diff --git a/src/mainboard/google/brya/variants/orisa/Makefile.mk b/src/mainboard/google/brya/variants/orisa/Makefile.mk
new file mode 100644
index 0000000000..91f031e7a4
--- /dev/null
+++ b/src/mainboard/google/brya/variants/orisa/Makefile.mk
@@ -0,0 +1,5 @@
+## SPDX-License-Identifier: GPL-2.0-only
+
+bootblock-y += gpio.c
+romstage-y += gpio.c
+ramstage-y += gpio.c
diff --git a/src/mainboard/google/brya/variants/baseboard/trulo/gpio.c b/src/mainboard/google/brya/variants/orisa/gpio.c
index 410f194f65..beee6fcb29 100644
--- a/src/mainboard/google/brya/variants/baseboard/trulo/gpio.c
+++ b/src/mainboard/google/brya/variants/orisa/gpio.c
@@ -16,19 +16,24 @@ static const struct pad_config early_gpio_table[] = {
/* TODO */
};
-const struct pad_config *__weak variant_gpio_table(size_t *num)
+/* Fill romstage gpio configuration */
+static const struct pad_config romstage_gpio_table[] = {
+ /* TODO */
+};
+
+const struct pad_config *variant_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(gpio_table);
return gpio_table;
}
-const struct pad_config *__weak variant_gpio_override_table(size_t *num)
+const struct pad_config *variant_gpio_override_table(size_t *num)
{
*num = 0;
return NULL;
}
-const struct pad_config *__weak variant_early_gpio_table(size_t *num)
+const struct pad_config *variant_early_gpio_table(size_t *num)
{
*num = ARRAY_SIZE(early_gpio_table);
return early_gpio_table;
@@ -39,8 +44,8 @@ static const struct cros_gpio cros_gpios[] = {
};
DECLARE_CROS_GPIOS(cros_gpios);
-const struct pad_config *__weak variant_romstage_gpio_table(size_t *num)
+const struct pad_config *variant_romstage_gpio_table(size_t *num)
{
- *num = 0;
- return NULL;
+ *num = ARRAY_SIZE(romstage_gpio_table);
+ return romstage_gpio_table;
}
diff --git a/src/mainboard/google/brya/variants/trulo/Makefile.mk b/src/mainboard/google/brya/variants/trulo/Makefile.mk
new file mode 100644
index 0000000000..91f031e7a4
--- /dev/null
+++ b/src/mainboard/google/brya/variants/trulo/Makefile.mk
@@ -0,0 +1,5 @@
+## SPDX-License-Identifier: GPL-2.0-only
+
+bootblock-y += gpio.c
+romstage-y += gpio.c
+ramstage-y += gpio.c
diff --git a/src/mainboard/google/brya/variants/trulo/gpio.c b/src/mainboard/google/brya/variants/trulo/gpio.c
new file mode 100644
index 0000000000..beee6fcb29
--- /dev/null
+++ b/src/mainboard/google/brya/variants/trulo/gpio.c
@@ -0,0 +1,51 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#include <baseboard/gpio.h>
+#include <baseboard/variants.h>
+#include <soc/gpio.h>
+#include <types.h>
+#include <vendorcode/google/chromeos/chromeos.h>
+
+/* Pad configuration in ramstage */
+static const struct pad_config gpio_table[] = {
+ /* TODO */
+};
+
+/* Early pad configuration in bootblock */
+static const struct pad_config early_gpio_table[] = {
+ /* TODO */
+};
+
+/* Fill romstage gpio configuration */
+static const struct pad_config romstage_gpio_table[] = {
+ /* TODO */
+};
+
+const struct pad_config *variant_gpio_table(size_t *num)
+{
+ *num = ARRAY_SIZE(gpio_table);
+ return gpio_table;
+}
+
+const struct pad_config *variant_gpio_override_table(size_t *num)
+{
+ *num = 0;
+ return NULL;
+}
+
+const struct pad_config *variant_early_gpio_table(size_t *num)
+{
+ *num = ARRAY_SIZE(early_gpio_table);
+ return early_gpio_table;
+}
+
+static const struct cros_gpio cros_gpios[] = {
+ /* TODO */
+};
+DECLARE_CROS_GPIOS(cros_gpios);
+
+const struct pad_config *variant_romstage_gpio_table(size_t *num)
+{
+ *num = ARRAY_SIZE(romstage_gpio_table);
+ return romstage_gpio_table;
+}