From 8446935d3b81e37ba3590812d6f39b430f0d426e Mon Sep 17 00:00:00 2001 From: Felix Singer Date: Sat, 21 Nov 2020 13:55:28 +0000 Subject: [PATCH] mb/clevo/cml-u: Get rid of gpio.h and use C files instead MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Split up gpio.h into two seperate compilation units, gpio.c and gpio_early.c, containing the complete configuration and a minimal configuration used in early stages. Tested on clevo/l140cu and it still boots. Change-Id: I5b056e8faac0c426a37501dbc175373c22dde339 Signed-off-by: Felix Singer Reviewed-on: https://review.coreboot.org/c/coreboot/+/47836 Tested-by: build bot (Jenkins) Reviewed-by: Michael Niewöhner --- src/mainboard/clevo/cml-u/Makefile.inc | 4 +++- src/mainboard/clevo/cml-u/bootblock.c | 4 ++-- .../clevo/cml-u/include/mainboard/gpio.h | 9 ++++++++ src/mainboard/clevo/cml-u/ramstage.c | 4 ++-- .../l140cu/{include/variant/gpio.h => gpio.c} | 23 ++++--------------- .../clevo/cml-u/variants/l140cu/gpio_early.c | 17 ++++++++++++++ 6 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 src/mainboard/clevo/cml-u/include/mainboard/gpio.h rename src/mainboard/clevo/cml-u/variants/l140cu/{include/variant/gpio.h => gpio.c} (95%) create mode 100644 src/mainboard/clevo/cml-u/variants/l140cu/gpio_early.c diff --git a/src/mainboard/clevo/cml-u/Makefile.inc b/src/mainboard/clevo/cml-u/Makefile.inc index de3c774c99..b69c257966 100644 --- a/src/mainboard/clevo/cml-u/Makefile.inc +++ b/src/mainboard/clevo/cml-u/Makefile.inc @@ -1,8 +1,10 @@ -CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/include bootblock-y += bootblock.c +bootblock-y += variants/$(VARIANT_DIR)/gpio_early.c ramstage-y += ramstage.c +ramstage-y += variants/$(VARIANT_DIR)/gpio.c ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c subdirs-y += variants/$(VARIANT_DIR) diff --git a/src/mainboard/clevo/cml-u/bootblock.c b/src/mainboard/clevo/cml-u/bootblock.c index 427b02328f..d75158cd1f 100644 --- a/src/mainboard/clevo/cml-u/bootblock.c +++ b/src/mainboard/clevo/cml-u/bootblock.c @@ -2,9 +2,9 @@ #include #include -#include +#include void bootblock_mainboard_init(void) { - gpio_configure_pads(early_gpio_table, ARRAY_SIZE(early_gpio_table)); + mainboard_configure_early_gpios(); } diff --git a/src/mainboard/clevo/cml-u/include/mainboard/gpio.h b/src/mainboard/clevo/cml-u/include/mainboard/gpio.h new file mode 100644 index 0000000000..c6393beebb --- /dev/null +++ b/src/mainboard/clevo/cml-u/include/mainboard/gpio.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef MAINBOARD_GPIO_H +#define MAINBOARD_GPIO_H + +void mainboard_configure_early_gpios(void); +void mainboard_configure_gpios(void); + +#endif diff --git a/src/mainboard/clevo/cml-u/ramstage.c b/src/mainboard/clevo/cml-u/ramstage.c index 824adfc134..771c6aae7b 100644 --- a/src/mainboard/clevo/cml-u/ramstage.c +++ b/src/mainboard/clevo/cml-u/ramstage.c @@ -1,11 +1,11 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include -#include +#include static void init_mainboard(void *chip_info) { - gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); + mainboard_configure_gpios(); } struct chip_operations mainboard_ops = { diff --git a/src/mainboard/clevo/cml-u/variants/l140cu/include/variant/gpio.h b/src/mainboard/clevo/cml-u/variants/l140cu/gpio.c similarity index 95% rename from src/mainboard/clevo/cml-u/variants/l140cu/include/variant/gpio.h rename to src/mainboard/clevo/cml-u/variants/l140cu/gpio.c index 1f7d119947..475c2d56da 100644 --- a/src/mainboard/clevo/cml-u/variants/l140cu/include/variant/gpio.h +++ b/src/mainboard/clevo/cml-u/variants/l140cu/gpio.c @@ -1,24 +1,10 @@ /* SPDX-License-Identifier: GPL-2.0-only */ -#ifndef MAINBOARD_GPIO_H -#define MAINBOARD_GPIO_H - +#include #include #include -#ifndef __ACPI__ - /* Name format: / */ - -/* Early pad configuration in romstage. */ -static const struct pad_config early_gpio_table[] = { - PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), /* UART2_RXD */ - PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1), /* UART2_TXD */ - PAD_NC(GPP_C22, UP_20K), - PAD_NC(GPP_C23, UP_20K), -}; - -/* Pad configuration in ramstage. */ static const struct pad_config gpio_table[] = { /* ------- GPIO Group GPD ------- */ PAD_NC(GPD0, NONE), @@ -251,6 +237,7 @@ static const struct pad_config gpio_table[] = { PAD_NC(GPP_H23, UP_20K), }; -#endif - -#endif +void mainboard_configure_gpios(void) +{ + gpio_configure_pads(gpio_table, ARRAY_SIZE(gpio_table)); +} diff --git a/src/mainboard/clevo/cml-u/variants/l140cu/gpio_early.c b/src/mainboard/clevo/cml-u/variants/l140cu/gpio_early.c new file mode 100644 index 0000000000..274efaf77f --- /dev/null +++ b/src/mainboard/clevo/cml-u/variants/l140cu/gpio_early.c @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include +#include + +/* Name format: / */ +static const struct pad_config early_gpio_table[] = { + PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), /* UART2_RXD */ + PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1), /* UART2_TXD */ + PAD_NC(GPP_C22, UP_20K), + PAD_NC(GPP_C23, UP_20K), +}; + +void mainboard_configure_early_gpios(void) +{ + gpio_configure_pads(early_gpio_table, ARRAY_SIZE(early_gpio_table)); +}