diff options
-rw-r--r-- | src/mainboard/google/rex/Kconfig | 4 | ||||
-rw-r--r-- | src/mainboard/google/rex/Makefile.inc | 5 | ||||
-rw-r--r-- | src/mainboard/google/rex/bootblock.c | 7 | ||||
-rw-r--r-- | src/mainboard/google/rex/mainboard.c | 6 | ||||
-rw-r--r-- | src/mainboard/google/rex/romstage.c | 7 | ||||
-rw-r--r-- | src/mainboard/google/rex/variants/baseboard/include/baseboard/variants.h | 8 | ||||
-rw-r--r-- | src/mainboard/google/rex/variants/baseboard/rex/Makefile.inc | 5 | ||||
-rw-r--r-- | src/mainboard/google/rex/variants/baseboard/rex/gpio.c | 34 | ||||
-rw-r--r-- | src/mainboard/google/rex/variants/rex0/include/variant/gpio.h | 8 |
9 files changed, 81 insertions, 3 deletions
diff --git a/src/mainboard/google/rex/Kconfig b/src/mainboard/google/rex/Kconfig index b9388a3f36..1c9ed235c0 100644 --- a/src/mainboard/google/rex/Kconfig +++ b/src/mainboard/google/rex/Kconfig @@ -31,4 +31,8 @@ config MAINBOARD_FAMILY 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 e0c4003b5a..f839c328fd 100644 --- a/src/mainboard/google/rex/Makefile.inc +++ b/src/mainboard/google/rex/Makefile.inc @@ -4,7 +4,12 @@ romstage-y += romstage.c ramstage-y += mainboard.c +VARIANT_DIR:=$(call strip_quotes,$(CONFIG_VARIANT_DIR)) +BASEBOARD_DIR:=$(call strip_quotes,$(CONFIG_BASEBOARD_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 8a7b93a968..328480e3bc 100644 --- a/src/mainboard/google/rex/bootblock.c +++ b/src/mainboard/google/rex/bootblock.c @@ -1,8 +1,13 @@ /* 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 3dc2c41d69..d7c31565b9 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 b8ad127cef..a993d14689 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 d16d3dad53..a2fc805287 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 0000000000..6c29346470 --- /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 0000000000..d9c31666ae --- /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 0000000000..27c87b3fe7 --- /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__ */ |