Eric Lai has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/64593 )
Change subject: mb/google/rex: Add GPIO stubs ......................................................................
mb/google/rex: Add GPIO stubs
Add stubbed out GPIO configuration and perform GPIO initialization during bootblock, romstage and ramstage.
BUG=b:224325352 TEST=util/abuild/abuild -p none -t google/rex -a -c max
Signed-off-by: Eric Lai eric_lai@quanta.corp-partner.google.com Change-Id: I51426f9557dafc357fc54a971b6f76fac5323e0a --- M src/mainboard/google/rex/Kconfig M src/mainboard/google/rex/Makefile.inc M src/mainboard/google/rex/bootblock.c M src/mainboard/google/rex/mainboard.c M src/mainboard/google/rex/romstage.c M src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h A src/mainboard/google/rex/variants/baseboard/rex/Makefile.inc A src/mainboard/google/rex/variants/baseboard/rex/gpio.c A src/mainboard/google/rex/variants/rex0/include/variant/gpio.h 9 files changed, 79 insertions(+), 4 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/93/64593/1
diff --git a/src/mainboard/google/rex/Kconfig b/src/mainboard/google/rex/Kconfig index b9388a3..1c9ed23 100644 --- a/src/mainboard/google/rex/Kconfig +++ b/src/mainboard/google/rex/Kconfig @@ -31,4 +31,8 @@ config MAINBOARD_PART_NUMBER default "Rex" if BOARD_GOOGLE_REX0
+config VARIANT_DIR + string + default "rex0" if BOARD_GOOGLE_REX0 + endif # BOARD_GOOGLE_REX_COMMON diff --git a/src/mainboard/google/rex/Makefile.inc b/src/mainboard/google/rex/Makefile.inc index e0c4003..917958d 100644 --- a/src/mainboard/google/rex/Makefile.inc +++ b/src/mainboard/google/rex/Makefile.inc @@ -4,7 +4,11 @@
ramstage-y += mainboard.c
+VARIANT_DIR:=$(call strip_quotes,$(CONFIG_VARIANT_DIR)) + subdirs-y += variants/baseboard/$(BASEBOARD_DIR) +subdirs-y += variants/$(VARIANT_DIR)
CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/$(BASEBOARD_DIR)/include +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include diff --git a/src/mainboard/google/rex/bootblock.c b/src/mainboard/google/rex/bootblock.c index fe6fc0f..817dd0f 100644 --- a/src/mainboard/google/rex/bootblock.c +++ b/src/mainboard/google/rex/bootblock.c @@ -1,9 +1,12 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <baseboard/variants.h> #include <bootblock_common.h>
void bootblock_mainboard_init(void) { - /* TODO: Perform mainboard initialization */ + const struct pad_config *pads; + size_t num; + pads = variant_early_gpio_table(&num); + gpio_configure_pads(pads, num); } - diff --git a/src/mainboard/google/rex/mainboard.c b/src/mainboard/google/rex/mainboard.c index 3dc2c41..d7c3156 100644 --- a/src/mainboard/google/rex/mainboard.c +++ b/src/mainboard/google/rex/mainboard.c @@ -1,10 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <baseboard/variants.h> #include <device/device.h>
static void mainboard_init(void *chip_info) { - /* TODO: Perform mainboard initialization */ + const struct pad_config *pads; + size_t num; + pads = variant_gpio_table(&num); + gpio_configure_pads(pads, num); }
static void mainboard_enable(struct device *dev) diff --git a/src/mainboard/google/rex/romstage.c b/src/mainboard/google/rex/romstage.c index 341df15..a993d14 100644 --- a/src/mainboard/google/rex/romstage.c +++ b/src/mainboard/google/rex/romstage.c @@ -1,9 +1,14 @@ /* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <baseboard/variants.h> #include <fsp/api.h> #include <soc/romstage.h>
void mainboard_memory_init_params(FSPM_UPD *memupd) { - /* ToDo : Fill FSP-M memory params */ + const struct pad_config *pads; + size_t pads_num; + + pads = variant_romstage_gpio_table(&pads_num); + gpio_configure_pads(pads, pads_num); } diff --git a/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h index d16d3da..a2fc805 100644 --- a/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h @@ -6,4 +6,12 @@ #include <soc/gpio.h> #include <stdint.h>
+/* The next set of functions return the gpio table and fill in the number of entries for + * each table. + */ + +const struct pad_config *variant_gpio_table(size_t *num); +const struct pad_config *variant_early_gpio_table(size_t *num); +const struct pad_config *variant_romstage_gpio_table(size_t *num); + #endif /*__BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/google/rex/variants/baseboard/rex/Makefile.inc b/src/mainboard/google/rex/variants/baseboard/rex/Makefile.inc new file mode 100644 index 0000000..6c29346 --- /dev/null +++ b/src/mainboard/google/rex/variants/baseboard/rex/Makefile.inc @@ -0,0 +1,5 @@ +bootblock-y += gpio.c + +romstage-y += gpio.c + +ramstage-y += gpio.c diff --git a/src/mainboard/google/rex/variants/baseboard/rex/gpio.c b/src/mainboard/google/rex/variants/baseboard/rex/gpio.c new file mode 100644 index 0000000..d9c3166 --- /dev/null +++ b/src/mainboard/google/rex/variants/baseboard/rex/gpio.c @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <baseboard/gpio.h> +#include <baseboard/variants.h> +#include <soc/gpio.h> + +/* Pad configuration in ramstage */ +static const struct pad_config gpio_table[] = { + /* ToDo: Fill gpio configuration */ +}; + +/* Early pad configuration in bootblock */ +static const struct pad_config early_gpio_table[] = { + /* ToDo: Fill early gpio configuration */ +}; + +const struct pad_config *__weak variant_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(gpio_table); + return gpio_table; +} + +const struct pad_config *__weak variant_early_gpio_table(size_t *num) +{ + *num = ARRAY_SIZE(early_gpio_table); + return early_gpio_table; +} + +/* Create the stub for romstage gpio, typically use for power sequence */ +const struct pad_config *__weak variant_romstage_gpio_table(size_t *num) +{ + *num = 0; + return NULL; +} diff --git a/src/mainboard/google/rex/variants/rex0/include/variant/gpio.h b/src/mainboard/google/rex/variants/rex0/include/variant/gpio.h new file mode 100644 index 0000000..27c87b3 --- /dev/null +++ b/src/mainboard/google/rex/variants/rex0/include/variant/gpio.h @@ -0,0 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#ifndef __MAINBOARD_GPIO_H__ +#define __MAINBOARD_GPIO_H__ + +#include <baseboard/gpio.h> + +#endif /* __MAINBOARD_GPIO_H__ */