From 85c52c5d97070b2e07d34e3a6c60ef5609b8bf2d Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Mon, 6 Jan 2020 22:02:01 -0700 Subject: mb/google/dedede: Add GPIO stubs Add stubbed out GPIO configuration and perform GPIO initialization during bootblock and ramstage. BUG=b:144768001 TEST=Build Test Change-Id: I1397b6a433e5046650f64f7eb9a84c51eb0c7441 Signed-off-by: Karthikeyan Ramasubramanian Reviewed-on: https://review.coreboot.org/c/coreboot/+/38278 Reviewed-by: Aamir Bohra Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- src/mainboard/google/dedede/Kconfig | 4 +++ src/mainboard/google/dedede/Makefile.inc | 4 +++ src/mainboard/google/dedede/bootblock.c | 7 ++++- src/mainboard/google/dedede/mainboard.c | 7 ++++- .../google/dedede/variants/baseboard/Makefile.inc | 5 ++++ .../google/dedede/variants/baseboard/gpio.c | 33 ++++++++++++++++++++++ .../baseboard/include/baseboard/variants.h | 6 ++++ .../dedede/variants/dedede/include/variant/gpio.h | 14 +++++++++ 8 files changed, 78 insertions(+), 2 deletions(-) create mode 100644 src/mainboard/google/dedede/variants/baseboard/Makefile.inc create mode 100644 src/mainboard/google/dedede/variants/baseboard/gpio.c create mode 100644 src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h (limited to 'src/mainboard/google') diff --git a/src/mainboard/google/dedede/Kconfig b/src/mainboard/google/dedede/Kconfig index 02e4e51a77..7c42404d09 100644 --- a/src/mainboard/google/dedede/Kconfig +++ b/src/mainboard/google/dedede/Kconfig @@ -32,4 +32,8 @@ config UART_FOR_CONSOLE int default 2 +config VARIANT_DIR + string + default "dedede" if BOARD_GOOGLE_DEDEDE + endif #BOARD_GOOGLE_BASEBOARD_DEDEDE diff --git a/src/mainboard/google/dedede/Makefile.inc b/src/mainboard/google/dedede/Makefile.inc index c2fc4198ef..8f501131e1 100644 --- a/src/mainboard/google/dedede/Makefile.inc +++ b/src/mainboard/google/dedede/Makefile.inc @@ -4,3 +4,7 @@ ramstage-y += mainboard.c subdirs-y += variants/baseboard CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include + +VARIANT_DIR:=$(call strip_quotes,$(CONFIG_VARIANT_DIR)) +subdirs-y += variants/$(VARIANT_DIR) +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include diff --git a/src/mainboard/google/dedede/bootblock.c b/src/mainboard/google/dedede/bootblock.c index 11186f775c..8685fa776a 100644 --- a/src/mainboard/google/dedede/bootblock.c +++ b/src/mainboard/google/dedede/bootblock.c @@ -6,9 +6,14 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include 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/dedede/mainboard.c b/src/mainboard/google/dedede/mainboard.c index 51b1aa4346..3b36abe661 100644 --- a/src/mainboard/google/dedede/mainboard.c +++ b/src/mainboard/google/dedede/mainboard.c @@ -6,11 +6,16 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ +#include #include 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/dedede/variants/baseboard/Makefile.inc b/src/mainboard/google/dedede/variants/baseboard/Makefile.inc new file mode 100644 index 0000000000..7c092e44c2 --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/Makefile.inc @@ -0,0 +1,5 @@ +bootblock-y += gpio.c + +ramstage-y += gpio.c + +smm-y += gpio.c diff --git a/src/mainboard/google/dedede/variants/baseboard/gpio.c b/src/mainboard/google/dedede/variants/baseboard/gpio.c new file mode 100644 index 0000000000..c94af6fb7f --- /dev/null +++ b/src/mainboard/google/dedede/variants/baseboard/gpio.c @@ -0,0 +1,33 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#include +#include +#include + +/* 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; +} diff --git a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h index b326ec0468..ebcd594a9b 100644 --- a/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/dedede/variants/baseboard/include/baseboard/variants.h @@ -12,4 +12,10 @@ #include #include +/* 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); + #endif /*__BASEBOARD_VARIANTS_H__ */ diff --git a/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h b/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h new file mode 100644 index 0000000000..bf23f6e457 --- /dev/null +++ b/src/mainboard/google/dedede/variants/dedede/include/variant/gpio.h @@ -0,0 +1,14 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2020 The coreboot project Authors. + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef MAINBOARD_GPIO_H +#define MAINBOARD_GPIO_H + +#include + +#endif /* MAINBOARD_GPIO_H */ -- cgit v1.2.3