diff --git a/boards/arm/actinius_icarus/CMakeLists.txt b/boards/arm/actinius_icarus/CMakeLists.txt index 5682578f59c..a747a3fdffa 100644 --- a/boards/arm/actinius_icarus/CMakeLists.txt +++ b/boards/arm/actinius_icarus/CMakeLists.txt @@ -5,6 +5,4 @@ zephyr_library() -if (CONFIG_BOARD_ACTINIUS_ICARUS_NS) - zephyr_library_sources(board.c) -endif() +add_subdirectory(${ZEPHYR_BASE}/boards/common/actinius actinius_common) diff --git a/boards/arm/actinius_icarus/Kconfig b/boards/arm/actinius_icarus/Kconfig deleted file mode 100644 index 503debb00f7..00000000000 --- a/boards/arm/actinius_icarus/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# Actinius Icarus board configuration - -# Copyright (c) 2019 Actinius -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ACTINIUS_ICARUS || BOARD_ACTINIUS_ICARUS_NS - -module = BOARD_ICARUS -module-str = Board Control -source "subsys/logging/Kconfig.template.log_config" - -endif # BOARD_ACTINIUS_ICARUS || BOARD_ACTINIUS_ICARUS_NS diff --git a/boards/arm/actinius_icarus/Kconfig.defconfig b/boards/arm/actinius_icarus/Kconfig.defconfig index 9d81e1a511a..6994aac280d 100644 --- a/boards/arm/actinius_icarus/Kconfig.defconfig +++ b/boards/arm/actinius_icarus/Kconfig.defconfig @@ -8,6 +8,8 @@ if BOARD_ACTINIUS_ICARUS || BOARD_ACTINIUS_ICARUS_NS config BOARD default "actinius_icarus" +source "boards/common/actinius/Kconfig" + # For the secure version of the board the firmware is linked at the beginning # of the flash, or into the code-partition defined in DT if it is intended to # be loaded by MCUboot. If the secure firmware is to be combined with a non- diff --git a/boards/arm/actinius_icarus/board.c b/boards/arm/actinius_icarus/board.c deleted file mode 100644 index b5b5b3621bd..00000000000 --- a/boards/arm/actinius_icarus/board.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019-2022 Actinius - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_ICARUS_LOG_LEVEL); - -#define CHARGER_ENABLE_NODE DT_NODELABEL(charger_enable) - -static int set_sim_select_pin(void) -{ - const struct gpio_dt_spec sim = - GPIO_DT_SPEC_GET(DT_NODELABEL(sim_select), sim_gpios); - - if (!device_is_ready(sim.port)) { - LOG_ERR("The SIM Select Pin port is not ready"); - return -ENODEV; - } - - if (DT_ENUM_IDX(DT_NODELABEL(sim_select), sim) == 0) { - (void)gpio_pin_configure_dt(&sim, GPIO_OUTPUT_HIGH); - LOG_INF("eSIM is selected"); - } else { - (void)gpio_pin_configure_dt(&sim, GPIO_OUTPUT_LOW); - LOG_INF("External SIM is selected"); - } - - return 0; -} - -#if DT_NODE_EXISTS(CHARGER_ENABLE_NODE) - -static int set_charger_enable_pin(void) -{ - const struct gpio_dt_spec charger_en = - GPIO_DT_SPEC_GET(CHARGER_ENABLE_NODE, gpios); - - if (!device_is_ready(charger_en.port)) { - LOG_ERR("The Charger Enable Pin port is not ready"); - return -ENODEV; - } - - if (DT_ENUM_IDX(CHARGER_ENABLE_NODE, charger) == 0) { - (void)gpio_pin_configure_dt(&charger_en, GPIO_OUTPUT_LOW); - LOG_INF("Charger is set to auto"); - } else { - (void)gpio_pin_configure_dt(&charger_en, GPIO_OUTPUT_HIGH); - LOG_INF("Charger is disabled"); - } - - return 0; -} - -#endif /* DT_NODE_EXISTS(CHARGER_ENABLE_NODE) */ - -static int board_actinius_icarus_init(const struct device *dev) -{ - ARG_UNUSED(dev); - - int result; - - result = set_sim_select_pin(); - if (result < 0) { - LOG_ERR("Failed to set the SIM Select Pin (error: %d)", result); - /* do not return so that the rest of the init process is attempted */ - } - -#if DT_NODE_EXISTS(CHARGER_ENABLE_NODE) - result = set_charger_enable_pin(); - if (result < 0) { - LOG_ERR("Failed to set the Charger Enable Pin (error: %d)", result); - /* do not return so that the rest of the init process is attempted */ - } -#endif /* DT_NODE_EXISTS(CHARGER_ENABLE_NODE) */ - - return result; -} - -/* Needs to happen after GPIO driver init */ -SYS_INIT(board_actinius_icarus_init, POST_KERNEL, 99); diff --git a/boards/arm/actinius_icarus_bee/CMakeLists.txt b/boards/arm/actinius_icarus_bee/CMakeLists.txt index c825edf00fd..b54029984d1 100644 --- a/boards/arm/actinius_icarus_bee/CMakeLists.txt +++ b/boards/arm/actinius_icarus_bee/CMakeLists.txt @@ -5,6 +5,4 @@ zephyr_library() -if (CONFIG_BOARD_ACTINIUS_ICARUS_BEE_NS) - zephyr_library_sources(board.c) -endif() +add_subdirectory(${ZEPHYR_BASE}/boards/common/actinius actinius_common) diff --git a/boards/arm/actinius_icarus_bee/Kconfig b/boards/arm/actinius_icarus_bee/Kconfig deleted file mode 100644 index 8f62907cde2..00000000000 --- a/boards/arm/actinius_icarus_bee/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# Actinius Icarus board configuration - -# Copyright (c) 2021 Actinius -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ACTINIUS_ICARUS_BEE || BOARD_ACTINIUS_ICARUS_BEE_NS - -module = BOARD_ICARUS_BEE -module-str = Board Control -source "subsys/logging/Kconfig.template.log_config" - -endif # BOARD_ACTINIUS_ICARUS_BEE || BOARD_ACTINIUS_ICARUS_BEE_NS diff --git a/boards/arm/actinius_icarus_bee/Kconfig.defconfig b/boards/arm/actinius_icarus_bee/Kconfig.defconfig index 40900311774..309a45a61d4 100644 --- a/boards/arm/actinius_icarus_bee/Kconfig.defconfig +++ b/boards/arm/actinius_icarus_bee/Kconfig.defconfig @@ -8,6 +8,8 @@ if BOARD_ACTINIUS_ICARUS_BEE || BOARD_ACTINIUS_ICARUS_BEE_NS config BOARD default "actinius_icarus_bee" +source "boards/common/actinius/Kconfig" + # For the secure version of the board the firmware is linked at the beginning # of the flash, or into the code-partition defined in DT if it is intended to # be loaded by MCUboot. If the secure firmware is to be combined with a non- diff --git a/boards/arm/actinius_icarus_bee/board.c b/boards/arm/actinius_icarus_bee/board.c deleted file mode 100644 index e127cf7866b..00000000000 --- a/boards/arm/actinius_icarus_bee/board.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021-2022 Actinius - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_ICARUS_BEE_LOG_LEVEL); - -static int board_actinius_icarus_bee_init(const struct device *dev) -{ - const struct gpio_dt_spec sim = - GPIO_DT_SPEC_GET(DT_NODELABEL(sim_select), sim_gpios); - - ARG_UNUSED(dev); - - if (!device_is_ready(sim.port)) { - LOG_ERR("The SIM Select Pin port is not ready"); - - return -ENODEV; - } - - if (DT_ENUM_IDX(DT_NODELABEL(sim_select), sim) == 0) { - (void)gpio_pin_configure_dt(&sim, GPIO_OUTPUT_HIGH); - LOG_INF("eSIM is selected"); - } else { - (void)gpio_pin_configure_dt(&sim, GPIO_OUTPUT_LOW); - LOG_INF("External SIM is selected"); - } - - return 0; -} - -/* Needs to happen after GPIO driver init */ -SYS_INIT(board_actinius_icarus_bee_init, POST_KERNEL, 99); diff --git a/boards/arm/actinius_icarus_som/CMakeLists.txt b/boards/arm/actinius_icarus_som/CMakeLists.txt index af50b08c869..b54029984d1 100644 --- a/boards/arm/actinius_icarus_som/CMakeLists.txt +++ b/boards/arm/actinius_icarus_som/CMakeLists.txt @@ -5,6 +5,4 @@ zephyr_library() -if (CONFIG_BOARD_ACTINIUS_ICARUS_SOM_NS) - zephyr_library_sources(board.c) -endif() +add_subdirectory(${ZEPHYR_BASE}/boards/common/actinius actinius_common) diff --git a/boards/arm/actinius_icarus_som/Kconfig b/boards/arm/actinius_icarus_som/Kconfig deleted file mode 100644 index b2ce51901e7..00000000000 --- a/boards/arm/actinius_icarus_som/Kconfig +++ /dev/null @@ -1,12 +0,0 @@ -# Actinius Icarus SoM board configuration - -# Copyright (c) 2021 Actinius -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_ACTINIUS_ICARUS_SOM || BOARD_ACTINIUS_ICARUS_SOM_NS - -module = BOARD_ICARUS_SOM -module-str = Board Control -source "subsys/logging/Kconfig.template.log_config" - -endif # BOARD_ACTINIUS_ICARUS_SOM || BOARD_ACTINIUS_ICARUS_SOM_NS diff --git a/boards/arm/actinius_icarus_som/Kconfig.defconfig b/boards/arm/actinius_icarus_som/Kconfig.defconfig index 185d8f0758d..473acfea29f 100644 --- a/boards/arm/actinius_icarus_som/Kconfig.defconfig +++ b/boards/arm/actinius_icarus_som/Kconfig.defconfig @@ -8,6 +8,8 @@ if BOARD_ACTINIUS_ICARUS_SOM || BOARD_ACTINIUS_ICARUS_SOM_NS config BOARD default "actinius_icarus_som" +source "boards/common/actinius/Kconfig" + # For the secure version of the board the firmware is linked at the beginning # of the flash, or into the code-partition defined in DT if it is intended to # be loaded by MCUboot. If the secure firmware is to be combined with a non- diff --git a/boards/arm/actinius_icarus_som/board.c b/boards/arm/actinius_icarus_som/board.c deleted file mode 100644 index fe19ae60bf0..00000000000 --- a/boards/arm/actinius_icarus_som/board.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2021-2022 Actinius - * - * SPDX-License-Identifier: Apache-2.0 - */ - -#include -#include -#include - -#include -LOG_MODULE_REGISTER(board_control, CONFIG_BOARD_ICARUS_SOM_LOG_LEVEL); - -static int board_actinius_icarus_som_init(const struct device *dev) -{ - const struct gpio_dt_spec sim = - GPIO_DT_SPEC_GET(DT_NODELABEL(sim_select), sim_gpios); - - ARG_UNUSED(dev); - - if (!device_is_ready(sim.port)) { - LOG_ERR("The SIM Select Pin port is not ready"); - - return -ENODEV; - } - - if (DT_ENUM_IDX(DT_NODELABEL(sim_select), sim) == 0) { - (void)gpio_pin_configure_dt(&sim, GPIO_OUTPUT_HIGH); - LOG_INF("eSIM is selected"); - } else { - (void)gpio_pin_configure_dt(&sim, GPIO_OUTPUT_LOW); - LOG_INF("External SIM is selected"); - } - - return 0; -} - -/* Needs to happen after GPIO driver init */ -SYS_INIT(board_actinius_icarus_som_init, POST_KERNEL, 99);