Arthur Heymans has uploaded this change for review. ( https://review.coreboot.org/28630
Change subject: mb/asrock/g41c-gs: Link separate gpio.c files ......................................................................
mb/asrock/g41c-gs: Link separate gpio.c files
With the addition of new boards using macros to set per board settings in the same gpio.c file is getting too complicated so link separate files.
Change-Id: I3ab05f1af6ba0a04dd827816b3bcaa506a3f6aff Signed-off-by: Arthur Heymans arthur@aheymans.xyz --- M src/mainboard/asrock/g41c-gs/Kconfig M src/mainboard/asrock/g41c-gs/Makefile.inc C src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/gpio.c C src/mainboard/asrock/g41c-gs/variants/g41c-gs/gpio.c R src/mainboard/asrock/g41c-gs/variants/g41m-gs/gpio.c 5 files changed, 7 insertions(+), 88 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/30/28630/1
diff --git a/src/mainboard/asrock/g41c-gs/Kconfig b/src/mainboard/asrock/g41c-gs/Kconfig index ad2fe22..f9dddfd 100644 --- a/src/mainboard/asrock/g41c-gs/Kconfig +++ b/src/mainboard/asrock/g41c-gs/Kconfig @@ -41,6 +41,12 @@ string default "asrock/g41c-gs"
+config VARIANT_DIR + string + default "g41c_gs_r2" if BOARD_ASROCK_G41C_GS_R2_0 + default "g41c-gs" if BOARD_ASROCK_G41C_GS + default "g41m-gs" if BOARD_ASROCK_G41M_GS + config MAINBOARD_PART_NUMBER string default "G41C-GS R2.0" if BOARD_ASROCK_G41C_GS_R2_0 diff --git a/src/mainboard/asrock/g41c-gs/Makefile.inc b/src/mainboard/asrock/g41c-gs/Makefile.inc index 0786d6f..82e72fb 100644 --- a/src/mainboard/asrock/g41c-gs/Makefile.inc +++ b/src/mainboard/asrock/g41c-gs/Makefile.inc @@ -1,4 +1,4 @@ ramstage-y += cstates.c -romstage-y += gpio.c +romstage-y += variants/$(VARIANT_DIR)/gpio.c
ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads diff --git a/src/mainboard/asrock/g41c-gs/gpio.c b/src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/gpio.c similarity index 79% copy from src/mainboard/asrock/g41c-gs/gpio.c copy to src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/gpio.c index b6ccbad..6299d62 100644 --- a/src/mainboard/asrock/g41c-gs/gpio.c +++ b/src/mainboard/asrock/g41c-gs/variants/g41c-gs-r2/gpio.c @@ -45,27 +45,18 @@ .gpio10 = GPIO_DIR_OUTPUT, .gpio12 = GPIO_DIR_INPUT, .gpio13 = GPIO_DIR_INPUT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio14 = GPIO_DIR_OUTPUT, -#else .gpio14 = GPIO_DIR_INPUT, -#endif .gpio15 = GPIO_DIR_OUTPUT, .gpio16 = GPIO_DIR_OUTPUT, .gpio18 = GPIO_DIR_OUTPUT, .gpio20 = GPIO_DIR_OUTPUT, .gpio24 = GPIO_DIR_OUTPUT, .gpio25 = GPIO_DIR_OUTPUT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio26 = GPIO_DIR_OUTPUT, -#else .gpio26 = GPIO_DIR_INPUT, -#endif .gpio27 = GPIO_DIR_OUTPUT, .gpio28 = GPIO_DIR_INPUT, };
-#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41C_GS_R2_0) static const struct pch_gpio_set1 pch_gpio_set1_level = { .gpio10 = GPIO_LEVEL_LOW, .gpio15 = GPIO_LEVEL_LOW, @@ -76,31 +67,10 @@ .gpio25 = GPIO_LEVEL_LOW, .gpio27 = GPIO_LEVEL_LOW, }; -#else /* BOARD_ASROCK_G41C_GS, BOARD_ASROCK_G41M_GS*/ -static const struct pch_gpio_set1 pch_gpio_set1_level = { - .gpio10 = GPIO_LEVEL_LOW, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio14 = GPIO_LEVEL_HIGH, -#endif - .gpio15 = GPIO_LEVEL_LOW, - .gpio16 = GPIO_LEVEL_HIGH, - .gpio18 = GPIO_LEVEL_LOW, - .gpio20 = GPIO_LEVEL_HIGH, - .gpio24 = GPIO_LEVEL_HIGH, - .gpio25 = GPIO_LEVEL_LOW, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio26 = GPIO_LEVEL_LOW, -#endif - .gpio27 = GPIO_LEVEL_LOW, -}; -#endif
static const struct pch_gpio_set1 pch_gpio_set1_invert = { .gpio0 = GPIO_INVERT, .gpio6 = GPIO_INVERT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio8 = GPIO_INVERT, -#endif .gpio12 = GPIO_INVERT, .gpio13 = GPIO_INVERT, }; diff --git a/src/mainboard/asrock/g41c-gs/gpio.c b/src/mainboard/asrock/g41c-gs/variants/g41c-gs/gpio.c similarity index 79% copy from src/mainboard/asrock/g41c-gs/gpio.c copy to src/mainboard/asrock/g41c-gs/variants/g41c-gs/gpio.c index b6ccbad..52cd611 100644 --- a/src/mainboard/asrock/g41c-gs/gpio.c +++ b/src/mainboard/asrock/g41c-gs/variants/g41c-gs/gpio.c @@ -45,62 +45,32 @@ .gpio10 = GPIO_DIR_OUTPUT, .gpio12 = GPIO_DIR_INPUT, .gpio13 = GPIO_DIR_INPUT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio14 = GPIO_DIR_OUTPUT, -#else .gpio14 = GPIO_DIR_INPUT, -#endif .gpio15 = GPIO_DIR_OUTPUT, .gpio16 = GPIO_DIR_OUTPUT, .gpio18 = GPIO_DIR_OUTPUT, .gpio20 = GPIO_DIR_OUTPUT, .gpio24 = GPIO_DIR_OUTPUT, .gpio25 = GPIO_DIR_OUTPUT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio26 = GPIO_DIR_OUTPUT, -#else .gpio26 = GPIO_DIR_INPUT, -#endif .gpio27 = GPIO_DIR_OUTPUT, .gpio28 = GPIO_DIR_INPUT, };
-#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41C_GS_R2_0) static const struct pch_gpio_set1 pch_gpio_set1_level = { .gpio10 = GPIO_LEVEL_LOW, .gpio15 = GPIO_LEVEL_LOW, .gpio16 = GPIO_LEVEL_HIGH, - .gpio18 = GPIO_LEVEL_HIGH, - .gpio20 = GPIO_LEVEL_LOW, - .gpio24 = GPIO_LEVEL_HIGH, - .gpio25 = GPIO_LEVEL_LOW, - .gpio27 = GPIO_LEVEL_LOW, -}; -#else /* BOARD_ASROCK_G41C_GS, BOARD_ASROCK_G41M_GS*/ -static const struct pch_gpio_set1 pch_gpio_set1_level = { - .gpio10 = GPIO_LEVEL_LOW, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio14 = GPIO_LEVEL_HIGH, -#endif - .gpio15 = GPIO_LEVEL_LOW, - .gpio16 = GPIO_LEVEL_HIGH, .gpio18 = GPIO_LEVEL_LOW, .gpio20 = GPIO_LEVEL_HIGH, .gpio24 = GPIO_LEVEL_HIGH, .gpio25 = GPIO_LEVEL_LOW, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio26 = GPIO_LEVEL_LOW, -#endif .gpio27 = GPIO_LEVEL_LOW, }; -#endif
static const struct pch_gpio_set1 pch_gpio_set1_invert = { .gpio0 = GPIO_INVERT, .gpio6 = GPIO_INVERT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) - .gpio8 = GPIO_INVERT, -#endif .gpio12 = GPIO_INVERT, .gpio13 = GPIO_INVERT, }; diff --git a/src/mainboard/asrock/g41c-gs/gpio.c b/src/mainboard/asrock/g41c-gs/variants/g41m-gs/gpio.c similarity index 81% rename from src/mainboard/asrock/g41c-gs/gpio.c rename to src/mainboard/asrock/g41c-gs/variants/g41m-gs/gpio.c index b6ccbad..cea01cf 100644 --- a/src/mainboard/asrock/g41c-gs/gpio.c +++ b/src/mainboard/asrock/g41c-gs/variants/g41m-gs/gpio.c @@ -45,62 +45,35 @@ .gpio10 = GPIO_DIR_OUTPUT, .gpio12 = GPIO_DIR_INPUT, .gpio13 = GPIO_DIR_INPUT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) .gpio14 = GPIO_DIR_OUTPUT, -#else - .gpio14 = GPIO_DIR_INPUT, -#endif .gpio15 = GPIO_DIR_OUTPUT, .gpio16 = GPIO_DIR_OUTPUT, .gpio18 = GPIO_DIR_OUTPUT, .gpio20 = GPIO_DIR_OUTPUT, .gpio24 = GPIO_DIR_OUTPUT, .gpio25 = GPIO_DIR_OUTPUT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) .gpio26 = GPIO_DIR_OUTPUT, -#else - .gpio26 = GPIO_DIR_INPUT, -#endif .gpio27 = GPIO_DIR_OUTPUT, .gpio28 = GPIO_DIR_INPUT, };
-#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41C_GS_R2_0) static const struct pch_gpio_set1 pch_gpio_set1_level = { .gpio10 = GPIO_LEVEL_LOW, - .gpio15 = GPIO_LEVEL_LOW, - .gpio16 = GPIO_LEVEL_HIGH, - .gpio18 = GPIO_LEVEL_HIGH, - .gpio20 = GPIO_LEVEL_LOW, - .gpio24 = GPIO_LEVEL_HIGH, - .gpio25 = GPIO_LEVEL_LOW, - .gpio27 = GPIO_LEVEL_LOW, -}; -#else /* BOARD_ASROCK_G41C_GS, BOARD_ASROCK_G41M_GS*/ -static const struct pch_gpio_set1 pch_gpio_set1_level = { - .gpio10 = GPIO_LEVEL_LOW, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) .gpio14 = GPIO_LEVEL_HIGH, -#endif .gpio15 = GPIO_LEVEL_LOW, .gpio16 = GPIO_LEVEL_HIGH, .gpio18 = GPIO_LEVEL_LOW, .gpio20 = GPIO_LEVEL_HIGH, .gpio24 = GPIO_LEVEL_HIGH, .gpio25 = GPIO_LEVEL_LOW, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) .gpio26 = GPIO_LEVEL_LOW, -#endif .gpio27 = GPIO_LEVEL_LOW, }; -#endif
static const struct pch_gpio_set1 pch_gpio_set1_invert = { .gpio0 = GPIO_INVERT, .gpio6 = GPIO_INVERT, -#if IS_ENABLED(CONFIG_BOARD_ASROCK_G41M_GS) .gpio8 = GPIO_INVERT, -#endif .gpio12 = GPIO_INVERT, .gpio13 = GPIO_INVERT, };