summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew McRae <amcrae@google.com>2022-11-30 13:09:06 +1100
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-11-30 04:23:04 +0000
commit42c5871768555b69026135cdbfc846744ace27e8 (patch)
treede9756c7d762431495ed3b55a6d229142f713eb6
parenta147fd5e333e940ff831cd09964ca855b3f78755 (diff)
downloadchrome-ec-42c5871768555b69026135cdbfc846744ace27e8.tar.gz
nissa: Allow sub-board support to be optional
Make sub-board support a config option so that variants can have fixed hardware configurations without having to deal with sub-board options. BUG=b:260779639 TEST=build nissa boards BRANCH=none Change-Id: Icac6767a9405362ba229626a1038e2bc4c42895c Signed-off-by: Andrew McRae <amcrae@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4059932 Reviewed-by: Peter Marheine <pmarheine@chromium.org>
-rw-r--r--zephyr/program/nissa/CMakeLists.txt4
-rw-r--r--zephyr/program/nissa/Kconfig9
-rw-r--r--zephyr/program/nissa/src/common.c10
-rw-r--r--zephyr/program/nissa/src/sub_board.c10
4 files changed, 21 insertions, 12 deletions
diff --git a/zephyr/program/nissa/CMakeLists.txt b/zephyr/program/nissa/CMakeLists.txt
index 101146507b..967fff2229 100644
--- a/zephyr/program/nissa/CMakeLists.txt
+++ b/zephyr/program/nissa/CMakeLists.txt
@@ -8,7 +8,7 @@ find_package(Zephyr REQUIRED HINTS "${ZEPHYR_BASE}")
zephyr_include_directories(include)
zephyr_library_sources("src/common.c")
-zephyr_library_sources("src/sub_board.c")
+zephyr_library_sources_ifdef(CONFIG_NISSA_SUB_BOARD "src/sub_board.c")
zephyr_library_sources_ifdef(CONFIG_AP_PWRSEQ "src/board_power.c")
if(DEFINED CONFIG_BOARD_NIVVIKS)
@@ -96,4 +96,4 @@ if(DEFINED CONFIG_BOARD_XIVUR)
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_FAN "xivur/src/fan.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_USBC "xivur/src/usbc.c")
zephyr_library_sources_ifdef(CONFIG_PLATFORM_EC_CHARGER "xivur/src/charger.c")
-endif() \ No newline at end of file
+endif()
diff --git a/zephyr/program/nissa/Kconfig b/zephyr/program/nissa/Kconfig
index 2eb694577d..a7fb4c666a 100644
--- a/zephyr/program/nissa/Kconfig
+++ b/zephyr/program/nissa/Kconfig
@@ -2,6 +2,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+config NISSA_SUB_BOARD
+ bool "Nissa sub-board support"
+ default y
+ help
+ Enable the sub-board support for Nissa boards.
+ This uses a common fw_config bitfield to select
+ one of a number of option sub-boards with different
+ hardware configurations.
+
config BOARD_NIVVIKS
bool "Google Nivviks Board"
help
diff --git a/zephyr/program/nissa/src/common.c b/zephyr/program/nissa/src/common.c
index 155dc541d4..d437bfca47 100644
--- a/zephyr/program/nissa/src/common.c
+++ b/zephyr/program/nissa/src/common.c
@@ -187,3 +187,13 @@ __override int pd_is_valid_input_voltage(int mv)
return true;
}
#endif
+
+/* Trigger shutdown by enabling the Z-sleep circuit */
+__override void board_hibernate_late(void)
+{
+ gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_en_slp_z), 1);
+ /*
+ * The system should hibernate, but there may be
+ * a small delay, so return.
+ */
+}
diff --git a/zephyr/program/nissa/src/sub_board.c b/zephyr/program/nissa/src/sub_board.c
index 830e361ac1..e8e9648ba6 100644
--- a/zephyr/program/nissa/src/sub_board.c
+++ b/zephyr/program/nissa/src/sub_board.c
@@ -286,13 +286,3 @@ static void board_init(void)
#endif
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-/* Trigger shutdown by enabling the Z-sleep circuit */
-__override void board_hibernate_late(void)
-{
- gpio_pin_set_dt(GPIO_DT_FROM_NODELABEL(gpio_en_slp_z), 1);
- /*
- * The system should hibernate, but there may be
- * a small delay, so return.
- */
-}