From 114d7c3ada2db48dd8ec2a845e3869a30e80e12d Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 2 Sep 2016 15:58:16 -0500 Subject: [PATCH] mainboard/google/reef: provide baseboard and variant concepts To further the ability of multiple variant boards to share code provide a place to land the split up changes. This patch provides the tooling using a new Kconfig value, VARIANT_DIR, as well as the Make plumbing. The directory layout with a single variant, reef (which is also the baseboard), looks like this: variants/baseboard - code variants/baseboard/include/baseboard - headers variants/reef - code variants/reef/include/variant - headers New boards would then add themselves under their board name within the 'variants' directory. No split has been done with providing different logic yet. This is purely a organizational change. BUG=chrome-os-partner:56677 Change-Id: Ib73a3c8a3729546257623171ef6d8fa7a9f16514 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/16418 Tested-by: build bot (Jenkins) Reviewed-by: Duncan Laurie --- src/mainboard/google/reef/Kconfig | 4 ++++ src/mainboard/google/reef/Makefile.inc | 7 +++++++ src/mainboard/google/reef/acpi/mainboard.asl | 4 ++-- src/mainboard/google/reef/bootblock.c | 4 ++-- src/mainboard/google/reef/chromeos.c | 4 ++-- src/mainboard/google/reef/ec.c | 2 +- src/mainboard/google/reef/mainboard.c | 4 ++-- src/mainboard/google/reef/romstage.c | 2 +- src/mainboard/google/reef/smihandler.c | 4 ++-- .../baseboard/include/baseboard}/ec.h | 4 ++-- .../baseboard/include/baseboard}/gpio.h | 8 +++---- .../reef/variants/reef/include/variant/ec.h | 21 +++++++++++++++++++ .../reef/variants/reef/include/variant/gpio.h | 21 +++++++++++++++++++ 13 files changed, 71 insertions(+), 18 deletions(-) rename src/mainboard/google/reef/{ => variants/baseboard/include/baseboard}/ec.h (98%) rename src/mainboard/google/reef/{ => variants/baseboard/include/baseboard}/gpio.h (99%) create mode 100644 src/mainboard/google/reef/variants/reef/include/variant/ec.h create mode 100644 src/mainboard/google/reef/variants/reef/include/variant/gpio.h diff --git a/src/mainboard/google/reef/Kconfig b/src/mainboard/google/reef/Kconfig index 817fcc9596..6ef45ccde6 100644 --- a/src/mainboard/google/reef/Kconfig +++ b/src/mainboard/google/reef/Kconfig @@ -32,6 +32,10 @@ config MAINBOARD_DIR string default google/reef +config VARIANT_DIR + string + default "reef" if BOARD_GOOGLE_REEF + config MAINBOARD_PART_NUMBER string default "Reef" if BOARD_GOOGLE_REEF diff --git a/src/mainboard/google/reef/Makefile.inc b/src/mainboard/google/reef/Makefile.inc index bb3dd8f0fe..f2da3794d5 100644 --- a/src/mainboard/google/reef/Makefile.inc +++ b/src/mainboard/google/reef/Makefile.inc @@ -11,3 +11,10 @@ ramstage-y += mainboard.c verstage-$(CONFIG_CHROMEOS) += chromeos.c smm-$(CONFIG_HAVE_SMI_HANDLER) += smihandler.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/reef/acpi/mainboard.asl b/src/mainboard/google/reef/acpi/mainboard.asl index 5bc82a13fe..0b2fdc8a32 100644 --- a/src/mainboard/google/reef/acpi/mainboard.asl +++ b/src/mainboard/google/reef/acpi/mainboard.asl @@ -13,8 +13,8 @@ * GNU General Public License for more details. */ -#include "../ec.h" -#include "../gpio.h" +#include +#include Scope (\_SB) { diff --git a/src/mainboard/google/reef/bootblock.c b/src/mainboard/google/reef/bootblock.c index 56af987467..7a767ecadf 100644 --- a/src/mainboard/google/reef/bootblock.c +++ b/src/mainboard/google/reef/bootblock.c @@ -16,8 +16,8 @@ #include #include #include -#include "ec.h" -#include "gpio.h" +#include +#include void bootblock_mainboard_init(void) { diff --git a/src/mainboard/google/reef/chromeos.c b/src/mainboard/google/reef/chromeos.c index 5c526dc6e4..ea0f68e236 100644 --- a/src/mainboard/google/reef/chromeos.c +++ b/src/mainboard/google/reef/chromeos.c @@ -18,8 +18,8 @@ #include #include #include -#include "ec.h" -#include "gpio.h" +#include +#include #define GPIO_PCH_WP GPIO_75 #define GPIO_EC_IN_RW GPIO_41 diff --git a/src/mainboard/google/reef/ec.c b/src/mainboard/google/reef/ec.c index fd35eedcfc..612708ec5c 100644 --- a/src/mainboard/google/reef/ec.c +++ b/src/mainboard/google/reef/ec.c @@ -18,7 +18,7 @@ #include #include #include -#include "ec.h" +#include static void ramstage_ec_init(void) { diff --git a/src/mainboard/google/reef/mainboard.c b/src/mainboard/google/reef/mainboard.c index 92e5609b91..832019da23 100644 --- a/src/mainboard/google/reef/mainboard.c +++ b/src/mainboard/google/reef/mainboard.c @@ -21,8 +21,8 @@ #include #include #include -#include "ec.h" -#include "gpio.h" +#include +#include static void mainboard_init(void *chip_info) { diff --git a/src/mainboard/google/reef/romstage.c b/src/mainboard/google/reef/romstage.c index aa1b18d2b8..6a7ed93557 100644 --- a/src/mainboard/google/reef/romstage.c +++ b/src/mainboard/google/reef/romstage.c @@ -16,7 +16,7 @@ #include #include #include -#include "gpio.h" +#include static const struct lpddr4_swizzle_cfg board_swizzle = { /* CH0_DQA[0:31] SoC pins -> U22 LPDDR4 module pins */ diff --git a/src/mainboard/google/reef/smihandler.c b/src/mainboard/google/reef/smihandler.c index d33222be9d..bbbdbcbeeb 100644 --- a/src/mainboard/google/reef/smihandler.c +++ b/src/mainboard/google/reef/smihandler.c @@ -20,8 +20,8 @@ #include #include #include -#include "ec.h" -#include "gpio.h" +#include +#include void mainboard_smi_gpi_handler(const struct gpi_status *sts) { diff --git a/src/mainboard/google/reef/ec.h b/src/mainboard/google/reef/variants/baseboard/include/baseboard/ec.h similarity index 98% rename from src/mainboard/google/reef/ec.h rename to src/mainboard/google/reef/variants/baseboard/include/baseboard/ec.h index c4b1505c2c..7763630715 100644 --- a/src/mainboard/google/reef/ec.h +++ b/src/mainboard/google/reef/variants/baseboard/include/baseboard/ec.h @@ -13,8 +13,8 @@ * GNU General Public License for more details. */ -#ifndef MAINBOARD_EC_H -#define MAINBOARD_EC_H +#ifndef BASEBOARD_EC_H +#define BASEBOARD_EC_H #include diff --git a/src/mainboard/google/reef/gpio.h b/src/mainboard/google/reef/variants/baseboard/include/baseboard/gpio.h similarity index 99% rename from src/mainboard/google/reef/gpio.h rename to src/mainboard/google/reef/variants/baseboard/include/baseboard/gpio.h index 9f0722599c..d43c35f7f3 100644 --- a/src/mainboard/google/reef/gpio.h +++ b/src/mainboard/google/reef/variants/baseboard/include/baseboard/gpio.h @@ -9,12 +9,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ -#ifndef MAINBOARD_GPIO_H -#define MAINBOARD_GPIO_H +#ifndef BASEBOARD_GPIO_H +#define BASEBOARD_GPIO_H #include @@ -370,4 +370,4 @@ static const struct pad_config sleep_gpio_table[] = { #define MEM_CONFIG0 GPIO_101 #endif /* __ACPI__ */ -#endif /* MAINBOARD_GPIO_H */ +#endif /* BASEBOARD_GPIO_H */ diff --git a/src/mainboard/google/reef/variants/reef/include/variant/ec.h b/src/mainboard/google/reef/variants/reef/include/variant/ec.h new file mode 100644 index 0000000000..586f1064f4 --- /dev/null +++ b/src/mainboard/google/reef/variants/reef/include/variant/ec.h @@ -0,0 +1,21 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2016 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef MAINBOARD_EC_H +#define MAINBOARD_EC_H + +#include + +#endif diff --git a/src/mainboard/google/reef/variants/reef/include/variant/gpio.h b/src/mainboard/google/reef/variants/reef/include/variant/gpio.h new file mode 100644 index 0000000000..6d1ce5a0e4 --- /dev/null +++ b/src/mainboard/google/reef/variants/reef/include/variant/gpio.h @@ -0,0 +1,21 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2016 Google Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the + * GNU General Public License for more details. + */ + +#ifndef MAINBOARD_GPIO_H +#define MAINBOARD_GPIO_H + +#include + +#endif /* MAINBOARD_GPIO_H */