From e734adfb78d5f82be5b34695584cea63aa23b6b3 Mon Sep 17 00:00:00 2001 From: Dawid Niedzwiecki Date: Fri, 3 Feb 2023 07:57:57 +0000 Subject: [PATCH] subsys/mgmt/ec_host_cmd: update directory structure The Host Commands can be used with different transport layers e.g. SHI or eSPI. The code that provides the peripheral API and allows sending and receiving Host Commands via different transport layers is not actually drivers of a peripheral, so move it to the subsys/mgmt/ec_host_cmd folder. Signed-off-by: Dawid Niedzwiecki --- CODEOWNERS | 1 - drivers/CMakeLists.txt | 1 - drivers/Kconfig | 1 - include/zephyr/mgmt/{ => ec_host_cmd}/ec_host_cmd.h | 6 +++--- .../ec_host_cmd}/ec_host_cmd_periph.h | 6 +++--- .../ec_host_cmd}/ec_host_cmd_simulator.h | 8 ++++---- subsys/mgmt/ec_host_cmd/CMakeLists.txt | 2 ++ subsys/mgmt/ec_host_cmd/Kconfig | 2 ++ subsys/mgmt/ec_host_cmd/ec_host_cmd_handler.c | 4 ++-- .../mgmt/ec_host_cmd}/ec_host_cmd_periph/CMakeLists.txt | 0 .../mgmt/ec_host_cmd}/ec_host_cmd_periph/Kconfig | 0 .../ec_host_cmd_periph/ec_host_cmd_periph_espi.c | 4 ++-- .../ec_host_cmd_periph/ec_host_cmd_periph_shi.h | 0 .../ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c | 4 ++-- .../ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c | 4 ++-- .../ec_host_cmd_periph/ec_host_cmd_simulator.c | 2 +- tests/lib/cpp/cxx/src/main.cpp | 1 - tests/subsys/mgmt/ec_host_cmd/src/main.c | 4 ++-- 18 files changed, 25 insertions(+), 25 deletions(-) rename include/zephyr/mgmt/{ => ec_host_cmd}/ec_host_cmd.h (97%) rename include/zephyr/{drivers/ec_host_cmd_periph => mgmt/ec_host_cmd}/ec_host_cmd_periph.h (94%) rename include/zephyr/{drivers/ec_host_cmd_periph => mgmt/ec_host_cmd}/ec_host_cmd_simulator.h (83%) rename {drivers => subsys/mgmt/ec_host_cmd}/ec_host_cmd_periph/CMakeLists.txt (100%) rename {drivers => subsys/mgmt/ec_host_cmd}/ec_host_cmd_periph/Kconfig (100%) rename {drivers => subsys/mgmt/ec_host_cmd}/ec_host_cmd_periph/ec_host_cmd_periph_espi.c (96%) rename {drivers => subsys/mgmt/ec_host_cmd}/ec_host_cmd_periph/ec_host_cmd_periph_shi.h (100%) rename {drivers => subsys/mgmt/ec_host_cmd}/ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c (99%) rename {drivers => subsys/mgmt/ec_host_cmd}/ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c (99%) rename {drivers => subsys/mgmt/ec_host_cmd}/ec_host_cmd_periph/ec_host_cmd_simulator.c (96%) diff --git a/CODEOWNERS b/CODEOWNERS index 1401059128a..92dad37048a 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -262,7 +262,6 @@ /drivers/dma/*iproc_pax* @raveenp /drivers/dma/*intel_adsp* @teburd @abonislawski /drivers/dma/*xmc4xxx* @talih0 -/drivers/ec_host_cmd_periph/ @jettr /drivers/edac/ @finikorg /drivers/eeprom/ @henrikbrixandersen /drivers/eeprom/eeprom_stm32.c @KwonTae-young diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index 1194ef03362..af5bccc8da6 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -25,7 +25,6 @@ add_subdirectory_ifdef(CONFIG_DAC dac) add_subdirectory_ifdef(CONFIG_DAI dai) add_subdirectory_ifdef(CONFIG_DISPLAY display) add_subdirectory_ifdef(CONFIG_DMA dma) -add_subdirectory_ifdef(CONFIG_EC_HOST_CMD_PERIPH ec_host_cmd_periph) add_subdirectory_ifdef(CONFIG_EDAC edac) add_subdirectory_ifdef(CONFIG_EEPROM eeprom) add_subdirectory_ifdef(CONFIG_ENTROPY_HAS_DRIVER entropy) diff --git a/drivers/Kconfig b/drivers/Kconfig index f8db418a1a5..ef3059e16cc 100644 --- a/drivers/Kconfig +++ b/drivers/Kconfig @@ -22,7 +22,6 @@ source "drivers/debug/Kconfig" source "drivers/disk/Kconfig" source "drivers/display/Kconfig" source "drivers/dma/Kconfig" -source "drivers/ec_host_cmd_periph/Kconfig" source "drivers/edac/Kconfig" source "drivers/eeprom/Kconfig" source "drivers/entropy/Kconfig" diff --git a/include/zephyr/mgmt/ec_host_cmd.h b/include/zephyr/mgmt/ec_host_cmd/ec_host_cmd.h similarity index 97% rename from include/zephyr/mgmt/ec_host_cmd.h rename to include/zephyr/mgmt/ec_host_cmd/ec_host_cmd.h index b391f815bc3..36c43ed7ff5 100644 --- a/include/zephyr/mgmt/ec_host_cmd.h +++ b/include/zephyr/mgmt/ec_host_cmd/ec_host_cmd.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_H_ -#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_H_ +#ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_H_ +#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_H_ /** * @brief EC Host Command Interface @@ -216,4 +216,4 @@ enum ec_host_cmd_status { * @} */ -#endif /* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_H_ */ +#endif /* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_H_ */ diff --git a/include/zephyr/drivers/ec_host_cmd_periph/ec_host_cmd_periph.h b/include/zephyr/mgmt/ec_host_cmd/ec_host_cmd_periph.h similarity index 94% rename from include/zephyr/drivers/ec_host_cmd_periph/ec_host_cmd_periph.h rename to include/zephyr/mgmt/ec_host_cmd/ec_host_cmd_periph.h index a8a5e79ea84..fe2be6c960c 100644 --- a/include/zephyr/drivers/ec_host_cmd_periph/ec_host_cmd_periph.h +++ b/include/zephyr/mgmt/ec_host_cmd/ec_host_cmd_periph.h @@ -9,8 +9,8 @@ * @brief Public APIs for Host Command Peripherals that respond to host commands */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_HOST_CMD_PERIPH_H_ -#define ZEPHYR_INCLUDE_DRIVERS_HOST_CMD_PERIPH_H_ +#ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_PERIPH_H_ +#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_PERIPH_H_ #include #include @@ -122,4 +122,4 @@ static inline int ec_host_cmd_periph_send( } #endif -#endif /* ZEPHYR_INCLUDE_DRIVERS_HOST_CMD_PERIPH_H_ */ +#endif /* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_PERIPH_H_ */ diff --git a/include/zephyr/drivers/ec_host_cmd_periph/ec_host_cmd_simulator.h b/include/zephyr/mgmt/ec_host_cmd/ec_host_cmd_simulator.h similarity index 83% rename from include/zephyr/drivers/ec_host_cmd_periph/ec_host_cmd_simulator.h rename to include/zephyr/mgmt/ec_host_cmd/ec_host_cmd_simulator.h index fda1cbae7c7..7eef3272131 100644 --- a/include/zephyr/drivers/ec_host_cmd_periph/ec_host_cmd_simulator.h +++ b/include/zephyr/mgmt/ec_host_cmd/ec_host_cmd_simulator.h @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#ifndef ZEPHYR_INCLUDE_DRIVERS_EC_HOST_CMD_SIMULATOR_H_ -#define ZEPHYR_INCLUDE_DRIVERS_EC_HOST_CMD_SIMULATOR_H_ +#ifndef ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_SIMULATOR_H_ +#define ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_SIMULATOR_H_ /** * @file @@ -14,7 +14,7 @@ */ /* For ec_host_cmd_periph_api_send function pointer type */ -#include +#include /** * @brief Install callback for when this device would sends data to host @@ -42,4 +42,4 @@ void ec_host_cmd_periph_sim_install_send_cb(ec_host_cmd_periph_api_send cb); */ int ec_host_cmd_periph_sim_data_received(const uint8_t *buffer, size_t len); -#endif /* ZEPHYR_INCLUDE_DRIVERS_EC_HOST_CMD_SIMULATOR_H_ */ +#endif /* ZEPHYR_INCLUDE_MGMT_EC_HOST_CMD_EC_HOST_CMD_SIMULATOR_H_ */ diff --git a/subsys/mgmt/ec_host_cmd/CMakeLists.txt b/subsys/mgmt/ec_host_cmd/CMakeLists.txt index e1251dd7e8f..e72e4aded30 100644 --- a/subsys/mgmt/ec_host_cmd/CMakeLists.txt +++ b/subsys/mgmt/ec_host_cmd/CMakeLists.txt @@ -2,3 +2,5 @@ zephyr_library() zephyr_library_sources(ec_host_cmd_handler.c) + +add_subdirectory_ifdef(CONFIG_EC_HOST_CMD_PERIPH ec_host_cmd_periph) diff --git a/subsys/mgmt/ec_host_cmd/Kconfig b/subsys/mgmt/ec_host_cmd/Kconfig index 72e243100de..dfaaf47f8e1 100644 --- a/subsys/mgmt/ec_host_cmd/Kconfig +++ b/subsys/mgmt/ec_host_cmd/Kconfig @@ -33,6 +33,8 @@ config EC_HOST_CMD_HANDLER_PRIO process the command on time and the AP will abort the waiting for response and be unable to boot the system properly. +source "subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/Kconfig" + endif # EC_HOST_CMD endmenu diff --git a/subsys/mgmt/ec_host_cmd/ec_host_cmd_handler.c b/subsys/mgmt/ec_host_cmd/ec_host_cmd_handler.c index ea344c6f52b..2567ecbd82d 100644 --- a/subsys/mgmt/ec_host_cmd/ec_host_cmd_handler.c +++ b/subsys/mgmt/ec_host_cmd/ec_host_cmd_handler.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#include +#include #include #include #include diff --git a/drivers/ec_host_cmd_periph/CMakeLists.txt b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/CMakeLists.txt similarity index 100% rename from drivers/ec_host_cmd_periph/CMakeLists.txt rename to subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/CMakeLists.txt diff --git a/drivers/ec_host_cmd_periph/Kconfig b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/Kconfig similarity index 100% rename from drivers/ec_host_cmd_periph/Kconfig rename to subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/Kconfig diff --git a/drivers/ec_host_cmd_periph/ec_host_cmd_periph_espi.c b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_espi.c similarity index 96% rename from drivers/ec_host_cmd_periph/ec_host_cmd_periph_espi.c rename to subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_espi.c index 931b6dd9b12..ca091d131ca 100644 --- a/drivers/ec_host_cmd_periph/ec_host_cmd_periph_espi.c +++ b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_espi.c @@ -9,9 +9,9 @@ #include #include -#include +#include #include -#include +#include BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) == 1, "Invalid number of eSPI peripherals"); diff --git a/drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi.h b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi.h similarity index 100% rename from drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi.h rename to subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi.h diff --git a/drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c similarity index 99% rename from drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c rename to subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c index be90f9aa376..2dd3cce7dde 100644 --- a/drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c +++ b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi_ite.c @@ -8,12 +8,12 @@ #include "ec_host_cmd_periph_shi.h" -#include +#include #include #include #include #include -#include +#include #include #include #include diff --git a/drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c similarity index 99% rename from drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c rename to subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c index f235f24c504..bcb7dba3f62 100644 --- a/drivers/ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c +++ b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_periph_shi_npcx.c @@ -9,10 +9,10 @@ #include "ec_host_cmd_periph_shi.h" #include -#include +#include #include #include -#include +#include #include #include diff --git a/drivers/ec_host_cmd_periph/ec_host_cmd_simulator.c b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_simulator.c similarity index 96% rename from drivers/ec_host_cmd_periph/ec_host_cmd_simulator.c rename to subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_simulator.c index 693706e4d91..d188e963914 100644 --- a/drivers/ec_host_cmd_periph/ec_host_cmd_simulator.c +++ b/subsys/mgmt/ec_host_cmd/ec_host_cmd_periph/ec_host_cmd_simulator.c @@ -9,7 +9,7 @@ #include #include -#include +#include #include #ifndef CONFIG_ARCH_POSIX diff --git a/tests/lib/cpp/cxx/src/main.cpp b/tests/lib/cpp/cxx/src/main.cpp index e5f0b74884c..b8bb787388e 100644 --- a/tests/lib/cpp/cxx/src/main.cpp +++ b/tests/lib/cpp/cxx/src/main.cpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include diff --git a/tests/subsys/mgmt/ec_host_cmd/src/main.c b/tests/subsys/mgmt/ec_host_cmd/src/main.c index 2e362dbe5ff..9ee7fb447b0 100644 --- a/tests/subsys/mgmt/ec_host_cmd/src/main.c +++ b/tests/subsys/mgmt/ec_host_cmd/src/main.c @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#include +#include #include /* Variables used to record what is "sent" to host for verification. */